关于弱监督一些记录

Posted by kevin on December 6, 2020

关于 CAM 系列

CAM

CAM

CAM 里面,在经过 softmax 之前的某类别得分为如下公式

equation1

可以看到 $\sum_{x,y}f_k(x,y)$ 是第 k 个通道经过 GAP 之后的值,变形后得到右边的式子,这里将 CAM 的 map 用如下式子表示

cam2

也就是说,该类别的 CAM 直接反映了该处的激活值对分类得分的重要性

但是 CAM 关注的区域只是最具 discriminative 性质的区域,分类狗的时候可能在 CAM 上只激活狗的头部。并且 CAM 不能很好的适用于所有网络,因为它要求将全连接层换成 GAP,这样就得重新训练模型,因此后来的 Grad-CAM 尝试解决这个问题

Grad-CAM

如果不用 GAP 的话怎么得到某个类别对应的在 feature map 上的权重呢,Grad-CAM 提出求导数的思想,通过链式法则用 softmax 之前的 score 对最后一层 feature map 求偏导得到每一层的权重,公式如下

grad-cam1

Z 是 feature map 上的所有像素点个数,这其实做的是跟 GAP 相似的事情,所以最后得到的 Grad-CAM map 用如下公式表示

g-cam2

用 ReLU 只保留对最终的 score 有正贡献的神经元,并且和 CAM 相似,对这个公式在 spatial 上进行累加得到的就是最终分类的得分 $S_c$

论文中有严格的数学推理证明 CAM 的权重和 Grad-CAM 的权重其实是一样的,可以去看看

CAM关注显著区域的解决方案

To alleviate this problem, Wei et al. (Wei et al. 2017a) propose to adopt an iterative erasing strategy. MDC (Wei et al. 2018) proposes to merge multiple CAMs with different dilation rates. DSRG (Huang et al. 2018) proposes to dynamically fill in the sparse seeds by region growing. Wang et al. (Wang et al. 2018) propose to alternately train a superpixel based classification network and the segmentation network. Other works (Briq, Moeller, and Gall 2018; Kolesnikov and Lampert 2016) propose some heuristic constraints. The concurrent work FickleNet (Lee et al. 2019) randomly drops connections in each sliding window. Although these methods are effective, they ignore the rich relationships across different images, while we prove that the cross-image relationship is effective for obtaining consistent and integral regions for weakly supervised segmentation.