1Konny / gradcam_plus_plus-pytorch

A Simple pytorch implementation of GradCAM and GradCAM++
359 stars 95 forks source link

Not so much an issue, as a question #1

Closed wabala94 closed 5 years ago

wabala94 commented 5 years ago

Hi! Thanks for your amazing work here. You've really made testing out gradcam a breeze.

I have a question regarding the usage of these modules. When I create a saliency map using a model I have fine-tuned as the architecture, are the resulting maps shown for the original torchvision pretrained network or my fine-tuned model?

Thanks in advance.


# model is fine-tuned on task-specific classification, initialized with pretrained resnet18 torchvision model weights

model.eval()
resnet_model_dict = dict(type='resnet', arch=model, layer_name='layer4',
                        input_size=(224,224))

resnet_gradcam = GradCAM(resnet_model_dict, True)
resnet_gradcampp = GradCAMpp(resnet_model_dict, True)
1Konny commented 5 years ago

Hi.

GradCAM module will generate heatmaps using the model initialized by your fine-tuned network parameters, not by ones from torchvision.

wabala94 commented 5 years ago

Ok, that's perfect - just wanted to make sure I was understanding its usage correctly. Thanks!