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

Prithvi ViT behaviour when input size not divisible by patch size #172

Open
CarlosGomes98 opened this issue Sep 25, 2024 · 2 comments
Open
Assignees

Comments

@CarlosGomes98
Copy link
Contributor

Describe the issue
With prithvi_vit, when the input spatial dimensions are not divisible by the patch size, part of the input is ignored.
To Reproduce (optional, but appreciated)
Steps to reproduce the behavior:

  1. Create a prithvi vit model
  2. Pass to it an input of size not divisible by the patch size
  3. No error is thrown

Expected behavior (optional)
Either we should pad the input to a size divisible by the patch size, or throw an error

@Joao-L-S-Almeida Joao-L-S-Almeida self-assigned this Oct 14, 2024
@Joao-L-S-Almeida
Copy link
Member

That's strange. When using the test tests/test_backbones.py::test_vit_models_non_divisible_input (from the branch associated to this issue) I got:

>           raise EinopsError(message + "\n {}".format(e))
E           einops.EinopsError:  Error while processing rearrange-reduction pattern "b c (t tub) (h p) (w q) -> b (t h w) (tub p q c)".
E            Input tensor shape: torch.Size([1, 6, 4, 220, 230]). Additional info: {'tub': 1, 'p': 16, 'q': 16}.
E            Shape mismatch, can't divide axis of length 220 in chunks of 16

Isn't that the expected behaviour ? 

@singam96
Copy link
Contributor

singam96 commented Nov 2, 2024

Please check this PR #218

@Joao-L-S-Almeida Joao-L-S-Almeida linked a pull request Nov 5, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants