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

ValueError: Input image size (32*32) doesn't match model (224*224). #13

Open
ratom opened this issue Aug 19, 2023 · 1 comment
Open

Comments

@ratom
Copy link

ratom commented Aug 19, 2023

I tried to compare Resnet50 vs ViT but got this error ValueError: Input image size (3232) doesn't match model (224224).
The code I used is

model1 = resnet50(pretrained=False)
layers_Res1 = list(model1.children())
model1 = nn.Sequential(*layers_Res1[:-1])

#model2 = resnet34(pretrained=True)
config = ViTConfig()
model2 = ViTModel(config)

Create a new model with the last two layers removed

layers_trans = list(model2.children())
model2 = nn.Sequential(*layers_trans[:-2])

cka = CKA(model1, model2,
model1_name="ResNet50", model2_name="ViT-B")
#,device='cuda')

cka.compare(dataloader)

cka.plot_results(save_path="/content/drive/MyDrive/resnet50vit-b.png")

@bryanbocao
Copy link

Try specifying dataloader2 for model2.

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