I have created DataBunch from folder and added Test set. This is a binary classification problem. Each of my train, valid and test set has two folders for each class.

my folder structure is:

Train Validation Test
ClassA ClassA ClassA
ClassB ClassB ClassB

For the validation folder I can have prediction and target values but for the test set target values are all equal to zero tensors.(targets_t = tensor([0,0,0,…0,0,0]). That is not correct. I would like to get target values for my test folder. How can I fix this ?


In fastai, test set means unlabelled data I want to predict, that’s why your labels are all 0s. It’s useful for a Kaggle competition when you want to make a submission for instance.
If you want to validate on another dataset, I’d advise to create a second data object where your put this set in validation and change the data of your learner with learn.data = new_data.

1 Like

Thank you so much for your help! İt works now.

I think I’m being really dense here, but when your training data is from_csv and your test is from_folder is there some trick to getting the labelled preds?