[AutoAssign]AutoAssign: Differentiable Label Assignment for Dense Object Detection

paper:https://arxiv.org/abs/2007.03496
code:https://github.com/Megvii-BaseDetection/AutoAssign


文中对于Label; Assignment的定义:

Determining positive/negative samples for object detection is known as label assignment.

1. Motivation

目前主流的label assignmnet方法主要分为2种:
(1)Anchor-Based Detectors 如RetinaNet是在每一个位置上准备了多种尺度以及比例的anchor,并且使用IOU来对正负样本进行resort;
(2) Anchor-Free Detectors 如FCOS,对于每一个object选取一个固定的中心区域的部分作为正的空间位置,并且通过FPN的尺度限制,来选择每个特定的FPN的stage上的正样本。
这些center prior方法在主流数据集上表现优异,但是在现实生活,对于香蕉以及雨伞等类别,这种采样方法可能就会选择到object外的location,就无法涵盖了类别的多样性分布。

the diverse distributions of categories

近期的一些研究中,如GuidedAnchoring和MetaAnchor在采样前动态的改变anchor shape的先验知识。ATSS,FreeAnchor等方法自适应对每一个object的spatial维度以及scale维度进行建模。
然而,这些方法只能在部分的label assignment实现data-driven。其他部分还是需要人的先验设置,阻止了label assignmnet的进一步优化。作者基于以下的直观想法为动机:

Intuitively, sampling locations on objects is better than background because they are prone to generate higher quality proposals. Motivated by this, we present Auto-Assign, which makes label assignment fully data-dependent and appearance-aware.

2. Contribution

作者认为的3个方面的贡献:
(1)提出了一种外观识别和完全可微分(differentiable)的标签分配加权机制。,它使spatial和scale任务得以统一的优化。

The entire process of weighting is differentiable and can be conveniently optimized by back-propagation during training.

(2)提出了2种权重模型(Center Weighting 和 Confidence Weighting)以在空间和尺度维度上调整特定类别(category-specific)的先验分布和特定实例(instances-specific)的采样策略。
(3)Auto-Assgin在MS COCO上得到COCO,在其他的数据集如PASCAL VOC等数据集也有很强大的竞争力。

3. Method

采用anchor-free的FCOS结构,去除了预定义的anchors并且直接在每一个特征的位置上预测物体。
网络会输出三个直,classification score,localization offsets和implicit-objectness score。

在这里插入图片描述

AutoAssign的网络结构以及训练时的样本选取策略

3.1 Prior-level : Center Weighting

G ( d ⃗ ∣ μ ⃗ , σ ⃗ ) = e − ( d ⃗ − μ ⃗ ) 2 2 σ ⃗ 2 (1) G(\vec d| \vec \mu, \vec \sigma )= e^{\frac{-(\vec d - \vec \mu)^2}{2\vec \sigma^2}} \tag {1} G(d μ ,σ )=e2σ 2(d μ )2(1)
G是一种基于类别的高斯形式的权重函数。这个中心加权模块保证了越靠近bbox中心的location会拥有更高的weights,而距离越远则weights会越低。
其中, d ⃗ \vec d d 表示在沿x和y方向上,在一个物体的内部的确定位置,相对于它自己box center的偏移。 μ ⃗ \vec \mu μ σ ⃗ \vec \sigma σ 是2哥可以学习的参数,维度为(K,2),其中K为数据集中类别的总数。因此对于每一个特定的类别,都有2个自适应的参数。G控制loss,这些参数都是可以反向传播优化的。
对于每一个物体,在每一个FPN上使用G分别计算location weights。

3.2 Instance-level: Confidence Weighting

作者提出了一个新的观点,即使在GT内,所有的location也会被当作正样本或负样本,而不是原来的label assignment的策略,如果在gt 内部,就只会作为正样本。

3.2.1 Classification confidence

由于在bbox中,gt几乎不能占据所有的空间,因此初始化的正样本集合会包含背景的location,这是需要思考的,因为在之前的label assignment中, 例如FCOS,如果当location位于GT bbox内部,那么就认为它是正样本。
为了从较差的location中压缩噪声候选框(Noisy Candidate)(也就是正样本集合中的背景,以及负样本集合中的前景),作者提出了一个Implicit-ObjectNess。
ImpObj不需要显示的label,组成与FCOS中的center-ness相似,但是center-ness具有缺乏显示监督的问题。
ImpObj的功能是判断location是前景还是背景的二分类。
AutoAssign 使用ImpObj和classification score(element-wise multiply)作为修正后的classification confidence。

3.2.2 Joint confidence indicator

作者提出了一个joint confidence indicator,结合了cls和loc来在spatial和scale维度上指导加权的策略。
作者为了产生每个位置的正/负的无偏估计,除了分类之外,还应该包括loo置信度。对于localization loss L i l o c L_i^{loc} Liloc,本文使用GIOU loss
对于回归位置的loss L i l o c L_i^{loc} Liloc,计算方式如下:

P i ( l o c ) = e − λ L i l o c (2) P_i(loc)=e^{-\lambda \mathcal L_i^{loc}} \tag{2} Pi(loc)=eλLiloc(2)
并且本文将分类和回归一起结合起来,只计算一个joint confidence P i P_i Pi ,其中对于正样本候选, P i + = P i ( c l s ) ∗ P i ( l o c ) P^+_i=P_i(cls) * P_i(loc) Pi+=Pi(cls)Pi(loc)
其中 P i ( c l s ) = C l a s s i f i c a t i o n _ W e i g h t i n g × C e n t e r _ W e i g h t i n g P_i(cls)= Classification\_Weighting \times Center \_Weighting Pi(cls)=Classification_Weighting×Center_Weighting是分类得分和ImpObj得分的加权结果。对于一个负样本候选集,只需要考虑到分类任务,因此负的置信度 P i − = P i ( c l s ) P_i^-=P_i(cls) Pi=Pi(cls),这和在bbox外面的location的计算方法是一样的。

原文内容:

Then we combine classification and regression likelihood together to get the joint confidence Pi.

3.3.3 Positve weights

如果一个location有更高的置信度,我们会认为这是一个前景。给予联合confidence表示 p i + p_i^+ pi+,作者提出confidence weighting函数 C ( P i + ) C(P_i^+) C(Pi+)来重视得分高的locations,公式如下:
C ( P i + ) = e P i + / τ (3) C(P^+_i)=e^{P_i^+ / \tau} \tag{3} C(Pi+)=ePi+/τ(3)
在公式3中,其中 τ \tau τ是一个超参数来在positive loss中控制高低confidence location中的贡献。直觉来说,给定一个物体,对于bbox内部的所有物体,我们都需要专注于更精确的预测的位置上。
然而,刚开始训练的时候,网络参数都是随机初始化的,因此可能会面临一”冷启动“的问题(参考知乎专栏),如果一开始我一个坏的location恰巧分类和框回归的都还不错,那么它的w+就会很高,也就是说它的权重就会较大,监督训练对它的关照就会不断增大,这样就导致有一些好的location完全没有机会翻盘,让网络学成了一个过拟合的模样。因此就要引入一个之前公式1的center weighting的类别先验。

w i + = C ( P i + G ( d ⃗ i ) ∑ j ∈ S n C ( P j + ) G ( d ⃗ j ) (4) \mathcal w_i^+=\frac{C(\mathcal P_i^+G(\vec d_i)}{\sum_{j \in S_n}C(\mathcal P_j^+) G(\vec d_j)} \tag{4} wi+=jSnC(Pj+)G(d j)C(Pi+G(d i)(4)
在第四个公式中,将confidence weighting module的 C ( P i + ) C(P_i^+) C(Pi+)结合了Center weighting中的类别先验 G ( d ⃗ i ) G(\vec d_i) G(d i)
,来一起产生正样本的权重 W i + W_i^+ Wi+

3.3.4 Negative weights

bbox中通道都会包含一些真正的背景的locations。我们同样需要加权这些负样本的loss来压缩和消除错误的假正样本。

w i − = 1 − f ( i o u i ) (5) \mathcal w_i^-=1-f(iou_i) \tag{5} wi=1f(ioui)(5)
公式5中, f ( i o u i ) = 1 / ( 1 − i o u i ) f(iou_i)=1/(1-iou_i) f(ioui)=1/(1ioui) i o u i iou_i ioui表示bbox中的所有点的位置( i ∈ S n i \in S_n iSn)和所有gt box的最大IOU。
作者还归一化了 f ( i o u i ) f(iou_i) f(ioui)到[0,1]。这样就使得具有最高的IOU的location的负loss接近于0。
对于所有在bbox外面的locations, w i − w_i^- wi被置为1,当做背景。

3.3.5 Loss function

最后得到总的损失函数:

L = − ∑ n = 1 N l o g ( ∑ i ∈ S n w i + P i + ) − ∑ k ∈ S l o g ( 1 − w k − P k − ) (6) \mathcal L=-\sum \limits_{n=1}^N log(\sum_{i \in S_n}\mathcal w_i^+\mathcal P_i^+)-\sum \limits_{k \in S}log(1-\mathcal w_k^- \mathcal P_k^-) \tag{6} L=n=1Nlog(iSnwi+Pi+)kSlog(1wkPk)(6)

对于bbox内部的点,正负loss都要用各自不同的权重计算。Focal loss使用在negative loss中。

猜你喜欢

转载自blog.csdn.net/weixin_43823854/article/details/111881651