Timm models work with any size of input images? #1653
-
I noticed that a timm model gets any size of an input image without raising an error.
I guess input image size is changed when transforms are applied (perhaps with transforms.Resize). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@bekhzod-olimov most purely convolutional nets accept any image size, this is normal, it can actually be beneficial to input images that are 20-40% larger than the train size at inference time (termed train-test discrepancy), especially if training used extensive augmentation. So yeah, I'd be hesitant to try and 'constrain' or force a fixed image size, many people also fine-tune to much higher resolution. transformer and hybrid cnn-transformer often have fixed resolutions (and will error out on different sized inputs). The resolutions that can only be set (sometimes changed from original weights) at model creation time as they have position embeddeings, blocking that is based on a pre-determined image size and if they can be resized, this is done by interpolation into a larger (or smaller embedding) In the pretrained_cfg you asked about, you can see most models with a limitation will have a |
Beta Was this translation helpful? Give feedback.
@bekhzod-olimov most purely convolutional nets accept any image size, this is normal, it can actually be beneficial to input images that are 20-40% larger than the train size at inference time (termed train-test discrepancy), especially if training used extensive augmentation. So yeah, I'd be hesitant to try and 'constrain' or force a fixed image size, many people also fine-tune to much higher resolution.
transformer and hybrid cnn-transformer often have fixed resolutions (and will error out on different sized inputs). The resolutions that can only be set (sometimes changed from original weights) at model creation time as they have position embeddeings, blocking that is based on a pre-det…