1.《Towards High-Resolution Salient Object Detection》
针对高分辨率显著性检测任务。提供第一个高分辨率显著性检测数据集,同时给出对应网络模型。
网络结构如下:
GSN给出全局的整体预测,主要负责简单部分。LRN针对局部patch, 主要负责修正不确定的子区域。GLFN混合GSN,LRN输出和原始img, 给出最终预测。
(1)GSN(Global Semantic Network)和LRN(Local Refinement Network)网络结构:
(2)APS(Attended Patch Sampling)
在GNS指导下,选择不确定区域,送到LRN模块进一步修正
(3)GLFN(Global Local Fusion Network)
使用密集连接,后接4个空洞卷积扩大感受区域,最后再通过卷积给出最终显著预测图。
2.《Optimizing the F-measure for Threshold-free Salient Object Detection》
将显著性评测指标F-measure 改为loss,用于指导训练,思想简单效果好。
In the standard F-measure, the true positive, false positive
and false negative are defined as the number of corresponding
samples:
˙Yt is the binary prediction binarized by threshold t and Y is the ground-truth saliency map,1(·) is an indicator function that evaluates to 1 if its argument is true and 0 otherwise.
该形式不可微分,所以不能直接用于网络,于是改进为:
根据precision,recall计算公式:
F-measure 公式为:
所以,FLoss 形式如下:
注意:loss的计算直接用原始saliency map, 不经过阈值二值化,这点和F-measure计算不同。
FLoss的变体 Log-FLoss 形式如下:
相较于交叉熵损失,FLoss 的梯度有限制,有效预防梯度爆炸现象; 在饱和地区,即预测图和Ground Truth 接近时也有一定的梯度产生,更有利于训练,从而给出更优预测图。
代码实现:
引自http://kaizhao.net/fmeasure
In Functional interface:
def floss(prediction, target, beta=0.3, log_like=False):
EPS = 1e-10
N = N = prediction.size(0)
TP = (prediction * target).view(N, -1).sum(dim=1)
H = beta * target.view(N, -1).sum(dim=1) + prediction.view(N, -1).sum(dim=1)
fmeasure = (1 + beta) * TP / (H + EPS)
if log_like:
floss = -torch.log(fmeasure)
else:
floss = (1 - fmeasure)
return floss
In Module interface:
from torch import nn
class FLoss(nn.Module):
def __init__(self, beta=0.3, log_like=False):
super(FLoss, self).__init__()
self.beta = beta
self.log_like = log_like
def forward(self, prediction, target):
EPS = 1e-10
N = prediction.size(0)
TP = (prediction * target).view(N, -1).sum(dim=1)
H = self.beta * target.view(N, -1).sum(dim=1) + prediction.view(N, -1).sum(dim=1)
fmeasure = (1 + self.beta) * TP / (H + EPS)
if self.log_like:
floss = -torch.log(fmeasure)
else:
floss = (1 - fmeasure)
return floss