Item_tfms resize vs aug_transforms resize

I am trying to understand why both of these are used in a vision_learner. I understand that item_tfms will just resize each image on the CPU. But why do we then need to resize it again during batch_tfms/aug_transforms. Wouldn’t it be better to resize it just once either during item_tfms or batch_tfms? I think I am missing something important but I couldn’t find an answer anywhere.

1 Like

AFAIK The size param in the aug_transforms refers to the size of the batch, not the item. The image resize happens in item_tfms.

As per docs, it is - Output size, duplicated if one value is specified. I think batch size is specified at the dataloader level with the parameter bs.

This one seems to concur - Notice that it takes the percentage of the image first and then resizes it to the size defined in the parameters, and not the other way around.

If I understand correctly, the item_tfms Resize changes the image to a (still rather large) size, so that all training images have the same size from the beginning.
We want to present different cutouts of the same image to the model, e.g. just the section with the ear of the animal or the section with the eyes when working with animal pictures.
In batch_tfms aug_transforms size, we choose the size of the cutout that the image is cropped to in a particular batch (a smaller size).