I know I’m late, but for future users:
I had a dataset which had a train.csv containing all the filenames and labels, and a folder “train” which contains both train and test images that are not included in the train.csv file, but I had “sample_submissions.csv” which cointained the test filenames, I loaded the dataset by doing the following:
test_data = ImageList.from_csv(path="./data/train",csv_name="../sample_submission.csv",header="infer")
data = ImageDataBunch.from_csv(path="./data/",folder="train",csv_labels="./train.csv",ds_tfms=get_transforms()
data.add_test(test_data)
If you print “data”
you could see the test set is loaded to the ImageDataBunch
ImageDataBunch;
Train: LabelList (13628 items)
x: ImageList
Image (3, 150, 150),Image (3, 150, 150),Image (3, 150, 150),Image (3, 150, 150),Image (3, 150, 150)
y: CategoryList
0,4,5,0,4
Path: data;
Valid: LabelList (3406 items)
x: ImageList
Image (3, 150, 150),Image (3, 150, 150),Image (3, 150, 150),Image (3, 150, 150),Image (3, 150, 150)
y: CategoryList
3,4,1,2,0
Path: data;
Test: LabelList (7301 items)
x: ImageList
Image (3, 150, 150),Image (3, 150, 150),Image (3, 150, 150),Image (3, 150, 150),Image (3, 150, 150)
y: EmptyLabelList
,,,,
Path: data