I am new to DL. I have trained my model and saved my weights.
Now I want to use this model to predict on Test Folder, and update my submission.csv file.
Thanks in Advance
def split_data_add_test_folder(self, test_folder:str=‘test’, label:Any=None):
“Add test set containing items from folder
test_folder and an arbitrary label”
items = ImageFileList.from_folder(self.path/test_folder)
return self.add_test(items, label=label)
SplitData.add_test_folder = split_data_add_test_folder.
We can add the test folder using this.
File Structure for my scenario
train\ clas1\ clas2\ ... valid\ clas1\ clas2\ ... test\
path = ‘data/train’
Also while defining the data I had to
data = ImageDataBunch.from_folder(path, train=‘train’, valid_pct=0.2, test=’…/test’, ds_tfms=tfms, size=224)
See here I had to define test = ‘…/input’,
somehow with path set at ‘data/’ I could not get the test_ds loaded.
Should I be able to mix from types in the same databunch() API call? I have a dataframe input for my train/valid images and I want to use a folder for my test images. How should I approach this?
When you call
add_test you can pass any
ItemList so you can create your train/valid with
ImageItemList.from_df then when you add the test set:
or even more direct:
add_test_from_folder should work.
Thanks for the explanation, it works. But I could not able to retrieve the test image files name.
The test image filenames will be in
When using the .add_test(…) approach, is the test data normalized automatically the same way as train data or does that have to be specified when adding the test itemlist?
Yes, anything that occurs to the validation set occurs to the test set here.