Open ratom opened 1 year ago
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])
config = ViTConfig() model2 = ViTModel(config)
layers_trans = list(model2.children()) model2 = nn.Sequential(*layers_trans[:-2])
cka = CKA(model1, model2, model1_name="ResNet50", model2_name="ViT-B")
cka.compare(dataloader)
cka.plot_results(save_path="/content/drive/MyDrive/resnet50vit-b.png")
Try specifying dataloader2 for model2.
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")