1Konny / gradcam_plus_plus-pytorch

A Simple pytorch implementation of GradCAM and GradCAM++
357 stars 94 forks source link

Why do we need to upsampling the image to 224? #8

Open nmpn opened 3 years ago

nmpn commented 3 years ago

Hi,

Can you please tell me why do we need to upsampling to 224 in preprocess stage?

torch_img = F.upsample(torch_img, size=(224, 224), mode='bilinear', align_corners=False)

I used my own model and if I don't upsample to 224,224, the results seem not correct.

Thank you.

PeterKim1 commented 3 years ago

Hello. I do not make this code, but i know your question's answer.

Because alexnet, vgg, resnet, densenet, squeezenet is Pretrained model, and this models trained at ImageNet.

ImageNet data's resolution is 224x224, so input shape must be 224x224.

If you don't want to upsample your data, you need to train models from scratch, can't use pretrained model.

nmpn commented 3 years ago

Hi,

Thanks for your response.

I’m using my own model, not the pre-trained one. If I don’t upsample, the results look incorrect, hence my question.

On 9 May 2021, at 13:45, @.*** wrote:



Hello. I do not make this code, but i know your question's answer.

Because alexnet, vgg, resnet, densenet, squeezenet is Pretrained model, and this models trained at ImageNet.

ImageNet data's resolution is 224x224, so input shape must be 224x224.

If you don't want to upsample your data, you need to train models from scratch, can't use pretrained model.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/1Konny/gradcam_plus_plus-pytorch/issues/8#issuecomment-835800351, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKD7W3JIUF4F3FX7QM2AEYTTMZ7WDANCNFSM4Y43BBUA.