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

issue with MobileNetV4HybridLarge for non square images #12

Open
ilyassmoummad opened this issue Jul 22, 2024 · 0 comments
Open

issue with MobileNetV4HybridLarge for non square images #12

ilyassmoummad opened this issue Jul 22, 2024 · 0 comments

Comments

@ilyassmoummad
Copy link

Hi, thanks for the cool torch reproduction!
I'm trying to use the code for rectangular grayscale images (I modified conv0 input channel to 1).

When running

x = torch.rand(1, 1, 128, 251).cuda()
model = MobileNetV4("MobileNetV4HybridLarge").cuda()

I have an error with this line of code:

context = context.view(batch_size, self.num_heads * self.key_dim, px, px)

causing this error: RuntimeError: shape '[1, 384, 8, 8]' is invalid for input of size 49152

I checked the original implementation https://github.com/tensorflow/models/blob/master/official/vision/modeling/layers/nn_blocks.py#L1489 they do divide by height and width strides but they are of value 1, any idea on how to make this work for non square images ? Thanks a lot in advance!

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

1 participant