Skip to content
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

Image Size Changes from [640, 640] to [H, W] During Training? #1088

Open
wwma opened this issue Mar 10, 2025 · 1 comment
Open

Image Size Changes from [640, 640] to [H, W] During Training? #1088

wwma opened this issue Mar 10, 2025 · 1 comment

Comments

@wwma
Copy link

wwma commented Mar 10, 2025

I'm following the example from this notebook while using segmentation_models.pytorch for a semantic segmentation task.

For data augmentation, I applied common techniques like cropping and rotation. Specifically, I set the cropping size to [640, 640].

While debugging, I noticed that both the Dataset and Dataloader initially load images with the expected shape [bz, 640, 640]. However, during training, when computing the loss, the shape of image and mask changes to [bz, H, W], where H and W are the original image dimensions.

Screenshots:
Image

Image

I am trying to understand how this transformation happens.
Why does the image size change back from [640, 640] to the original size during training?
What could be causing this behavior?
Will this have any impact on the training process?

Any insights or suggestions would be greatly appreciated! Thanks in advance!

@qubvel
Copy link
Collaborator

qubvel commented Mar 21, 2025

Hi @wwma, thanks for the issue, that's indeed a strange behavior, there should be some bug somewhere, but it's hard to tell where for your specific case

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