ZF4444 / MMAL-Net

This is a PyTorch implementation of the paper "Multi-branch and Multi-scale Attention Learning for Fine-Grained Visual Categorization (MMAL-Net)" (Fan Zhang, Meng Li, Guisheng Zhai, Yizhao Liu).
250 stars 57 forks source link

Gradient of maximum score with respect to input image is 'None' #8

Closed RMalikM closed 4 years ago

RMalikM commented 4 years ago

I am trying to compute the saliency maps for MMAL-Net. I am following this blog. I have trained MMAL-Net on my custom data. To compute the saliency map we first forward an image through the network and compute the score. Then we need to compute gradients of maximum score with respect to each pixel of the input image. This is done using the backward() function from torch.autograd(). In my case, when I use backward() on maximum score its gradients are None.

While the method in the blog works other model that are available in torch but for MMAL-Net gradients are None.

Is there any suggestions how to fix it or am I missing something?