Guided GradCam- getting blank image

I am trying to implement Gradcam https://github.com/jacobgil/pytorch-grad-cam/blob/master/gradcam.py in Pytorch to visualise classification of Embryo Cells. Though I am getting a good result on my GradCam…
Guided Back Propagation (gb), and guided gradcam gb are completely blank

I am sharing all the three images …
cam gb gb

I would really appreciate it if anyone can help me with it…

gb_model = GuidedBackpropReLUModel(model=model, use_cuda=True)
gb = gb_model(input, index=target_index)
gb = gb.transpose((1, 2, 0))
cam_mask = cv2.merge([mask, mask, mask])
cam_gb = deprocess_image(cam_mask*gb)
gb = deprocess_image(gb)
cv2.imwrite(‘gb.jpg’, gb)
cv2.imwrite(‘cam_gb.jpg’, cam_gb)

Code generating the gb.jpg and cam_gb.jpg
Thank you in Advance

I’m not familiar with the linked repository, but could you try to use Captum?
I think these methods are also implemented there.

CC @Narine_Kokhlikyan who will know, if Captum can be used for this use case. :slight_smile:

1 Like

Thanks @ptrblck for mentioning this tool, It looks great. Ill try to implement with it. :slight_smile:

1 Like