@jeremy that’s working great thanks. One small request though…
LabelLists seems to be taking the path from the location of the original training data, despite me trying to override it. This forces me to replicate the folder structure used to train the model in order to load my test set. This happens even if I explicity set the path of the LabelList object i.e.
sd = LabelLists.load_empty(test_path/'export.pkl', tfms=get_transforms(), size=224).add_test_folder('test')
sd.path = test_path
empty_data = sd.databunch().normalize(imagenet_stats)
I think the problem lies in this method:
@classmethod
def load_empty(cls, fn:PathOrStr, tfms:TfmList=None, tfm_y:bool=False, **kwargs):
train_ds = LabelList.load_empty(fn, tfms=tfms[0], tfm_y=tfm_y, **kwargs)
valid_ds = LabelList.load_empty(fn, tfms=tfms[1], tfm_y=tfm_y, **kwargs)
return LabelLists(valid_ds.path, train=train_ds, valid=valid_ds)
Suggest changing it to something like:
def load_empty(cls, fn:PathOrStr, tfms:TfmList=None, tfm_y:bool=False, **kwargs):
path = os.path.dirname(fn)
train_ds = LabelList.load_empty(fn, tfms=tfms[0], tfm_y=tfm_y, **kwargs)
valid_ds = LabelList.load_empty(fn, tfms=tfms[1], tfm_y=tfm_y, **kwargs)
return LabelLists(path, train=train_ds, valid=valid_ds)
EDIT: My bad, if I override the path before before I add_test_folder then it works. But my suggestion stands…