How to set crop size in tfms_from_model(arch, sz)

Hi!
I got stuck…
I need to use centercrop with 32 pixels size in tfms = tfms_from_model(arch, sz)

How to pass this parameter?

Greetings,
Tom

I think you will have to make your own transform (instead of the default from model) and then set the crop param as part of your transform - you can just pass 32 for the size to get a 32x32 square of the center:

crop(x, size, row_pct:uniform=0.5, col_pct:uniform=0.5)
x: Image to transform
size: Size of the crop, if it’s an int, the crop will be square

https://docs.fast.ai/vision.transform.html#_crop

1 Like

Thanks!
I’ll try that