I’m sorry if this is a silly question, but it’s not clear to me how to run the model on the test images once it’s ready.
When we say:
learn.predict
It’s giving the predictions for the validation set, right? So how do we get it to give predictions for the test set? And are the folder names built into fastai, so the test set needs to be in a folder called “test”?
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-21-fb6c65c01ca6> in <module>()
1 print('learn: {}'.format(learn.predict))
----> 2 preds = learn.predict(is_test=True)
3 print(preds)
~/fastai/courses/dl1/fastai/learner.py in predict(self, is_test)
100 self.load('tmp')
101
--> 102 def predict(self, is_test=False): return self.predict_with_targs(is_test)[0]
103
104 def predict_with_targs(self, is_test=False):
~/fastai/courses/dl1/fastai/learner.py in predict_with_targs(self, is_test)
104 def predict_with_targs(self, is_test=False):
105 dl = self.data.test_dl if is_test else self.data.val_dl
--> 106 return predict_with_targs(self.model, dl)
107
108 def TTA(self, n_aug=4, is_test=False):
~/fastai/courses/dl1/fastai/model.py in predict_with_targs(m, dl)
119 if hasattr(m, 'reset'): m.reset()
120 preda,targa = zip(*[(get_prediction(m(*VV(x))),y)
--> 121 for *x,y in iter(dl)])
122 return to_np(torch.cat(preda)), to_np(torch.cat(targa))
123
TypeError: 'NoneType' object is not iterable
Which looks like it’s because test_dl (test dataloader?) is None, and indeed when I say print(data.test_dl) that’s the case.
So for some reason when I make the data object using:
data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(arch, sz))
it’s not making a Data.test_dl object, right? Am I missing a step somewhere? I think the only important lines in my code before this point (other than imports) are:
I have two sets inside test and am getting the error:
FileNotFoundError: [Errno 2] No such file or directory: ‘./data/NewSkinImageSet/valid’
I think my question is, where should the ‘test’ datasets sit in the folder structure and why is it looking for a validation set?
Thanks
Tony