@Sylvain in the camvid notebook, when using data_blocks to create an image data bunch (screenshot below from the course’s notebook), what if I want to change the default for the resizing method to be “SQUISH” instead of the default “CROP”?
In the documentation, I can pass it to apply_transforms to apply it on an Image object, like the example, but is there a way to do it while creating the data bunch object?
I’m not sure if this is what you’re looking for. But, you can take a look over here. From forum wiki for lesson-3: https://forums.fast.ai/t/deep-learning-lesson-3-notes/29829.
Here is an example using Planet dataset.
we are using a little subset of it, to make it easy to try things out.
planet = untar_data(URLs.PLANET_TINY)
planet_tfms = get_transforms(flip_vert=True, max_lighting=0.1, max_zoom=1.05, max_warp=0.)
data = ImageDataBunch.from_csv(planet, folder='train', size=128, suffix='.jpg', sep = ' ', ds_tfms=planet_tfms)
With the data block API we can rewrite this like that:
data = (ImageFileList.from_folder(planet)
#Where to find the data? -> in planet and its subfolders
.label_from_csv('labels.csv', sep=' ', folder='train', suffix='.jpg')
#How to label? -> use the csv file labels.csv in path,
#add .jpg to the names and take them in the folder train
#How to split in train/valid? -> randomly with the default 20% in valid
#How to convert to datasets? -> use ImageMultiDataset
#Data augmentation? -> use tfms with a size of 128
#Finally? -> use the defaults for conversion to databunch
Check this out: https://www.youtube.com/watch?v=PW2HKkzdkKY&feature=youtu.be&t=26m
Hope this helps.