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

Unable to train T2T-ViT for 384 x 384 image #53

Open
SK124 opened this issue May 15, 2021 · 1 comment
Open

Unable to train T2T-ViT for 384 x 384 image #53

SK124 opened this issue May 15, 2021 · 1 comment

Comments

@SK124
Copy link

SK124 commented May 15, 2021

Hi! Can you suggest what part of the code should be modified to prevent the following error? Also, Can i train images on my own input dimensions like 448 or 608?

from models.t2t_vit import *
model = T2t_vit_14()
inp=torch.rand(2,3,384,384)
out=model(inp)
out.shape

RuntimeError Traceback (most recent call last)
in ()
1 inp=torch.rand(2,3,384,384)
----> 2 out=model(inp)
3 out.shape

2 frames
/content/T2T-ViT/models/t2t_vit.py in forward_features(self, x)
159 cls_tokens = self.cls_token.expand(B, -1, -1)
160 x = torch.cat((cls_tokens, x), dim=1)
--> 161 x = x + self.pos_embed
162 x = self.pos_drop(x)
163

RuntimeError: The size of tensor a (577) must match the size of tensor b (197) at non-singleton dimension 1

@yuanli2333
Copy link
Collaborator

Hi,

If you want to train our model with other image size like 384x384, please use:

from models.t2t_vit import *
model = T2t_vit_14(img_size=384)

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