Crop_pad doesn't seem to work properly with apply_tfms

I am testing crop_pad(). When I call as follows, it works as expected.

crop_pad(get_ex(), size=int(size), padding_mode='zeros', row_pct=0.0, col_pct=0.0)

However, when I call as follows, crop_pad doesn’t work as expected. No crop and no pad is applied.

tfms = [crop_pad(size=int(size), padding_mode='zeros', row_pct=0.0, col_pct=0.0)]
get_ex().apply_tfms(tfms).show(ax=ax, title=f'size = {int(size)}')

I think both results should be same. Did I miss something? I am using fastai 1.0.38.

Thank you very much!

When you use apply_tfms you need to set the size you want, so you should add size =int(size) in your call.

Thank you for the reply. I tried to add =int(size) to apply_tfms call but the result doesn’t change. Did I do something wrong?

Best regards.

It’s all linked to the resizing in apply_tfms: crop_pad is used but on an image that was resized so that its lower dimension is equal to the size you pass.