yizt / Grad-CAM.pytorch

pytorch实现Grad-CAM和Grad-CAM++,可以可视化任意分类网络的Class Activation Map (CAM)图,包括自定义的网络;同时也实现了目标检测faster r-cnn和retinanet两个网络的CAM图;欢迎试用、关注并反馈问题...

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Grad_cam++的实现和原文的计算公式不一致,请问怎么理解

zgf6781882 opened this issue · comments

    norm_factor = np.sum(gradient, axis=(1, 2))  # [C]归一化
    for i in range(len(norm_factor)):
        norm_factor[i] = 1. / norm_factor[i] if norm_factor[i] > 0. else 0.  # 避免除零
    alpha = indicate * norm_factor[:, np.newaxis, np.newaxis]  # [C,H,W]

请问怎么理解alpha的计算啊?

image

@zgf6781882 以上是计算一个通道的alpha过程示例

您好,这部分alpha的计算中,和原论文公式怎么对应呢,原论文中的alpha计算中分母含有梯度乘特征图并进行求和

Hello, this way of computing the alphas will cause all weights to be 1, and does not mach the original paper (eq. 19 in https://arxiv.org/abs/1710.11063). Can you please elaborate? Thank you!