The data block API seems intuitive. One thing I don’t understand.
My main folder (PATH) containts a ‘train’, ‘valid’ and ‘test’ folder. The labels are in a .csv file (‘labels.csv’) in the same main folder. The .csv file has the filenames without extensions and labels.
I made a chain of methods like below:
data = (ImageItemList.from_folder(PATH, extensions='.tif')
.use_partial_data(sample_pct = .1, seed= 34)
.label_from_df(pd.read_csv('labels.csv'))
.random_split_by_pct(valid_pct=0.2, seed=34)
.transform(tfms, size = 96)
.databunch(bs=64)).normalize(imagenet_stats)
In an earlier example on the forum you used label_from_csv. I can’t find this method in the docs.
Essentially I’m trying to translate the following, after addition of .use_partial_data:
data = ImageDataBunch.from_csv(PATH, folder='train', test='test', csv_labels='labels.csv', suffix='.tif', valid_pct = 0.2, ds_tfms=get_transforms(do_flip=True, flip_vert=True), size=sz, bs=bs
).normalize(imagenet_stats)
How do I label the inputs using the folder structure and a .csv file, considering the partial data approach?