Skip to content

Input Shape for Training and Inference with Pretrained Models #1112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hamac03 opened this issue Apr 2, 2025 · 1 comment
Open

Input Shape for Training and Inference with Pretrained Models #1112

hamac03 opened this issue Apr 2, 2025 · 1 comment

Comments

@hamac03
Copy link

hamac03 commented Apr 2, 2025

Hi,

I'm currently training models using a backbone like ResNet50, which is pretrained on ImageNet with an input shape of 3x224x224. I was wondering if it's possible to use a larger input size, such as 3x320x320 or 3x416x416, and still benefit from the pretrained weights, or does the input shape need to be strictly 224x224?

Are there any constraints or considerations when using larger input sizes with pretrained models?

Best regards,
Ha

@qubvel
Copy link
Collaborator

qubvel commented Apr 6, 2025

Hey @hamac03, yes, you can use any size for convolutional backbones, e.g. 512x512. Usually, the only requirement is for the size to be divisible by 32. You can even train on 512x512 input and then inference on 1024x1024 and have similar or even better performance. But it's always better to check the metrics on your particular model and dataset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants