人群检测、密集遮挡——Repulsion Loss: Detecting Pedestrians in a Crowd

Repulsion Loss: Detecting Pedestrians in a Crowd
Xinlong Wang
Megvii

本文提出了RepLoss,为loss添加了额外的项:与目标附近的gt非目标物体及周围的其它非同目标的预测box之间的排斥项。提升了密集场景下的行人检测性能。亦可用于返回的目标检测。


1. Introduction

目标检测领域中,最重要的挑战之一就是遮挡。遮挡有两类:不同类和同类遮挡。后者也可称为crowd occlusion。

行人检测中,密集人群是最主要的遮挡形式。这跟应用场景有关:视频监控或自动驾驶中,行人通常聚集在一起并互相遮挡。如CityPerson数据集,验证集标注了3157个行人,其中与另一个行人重叠IoU大于0.1的占到了48.8%,与另一个行人重叠IoU大于0.3的占到了26.4%。这一问题严重损害了行人检测的性能。

人群的主要问题是它极大地增加了为行人定位的难度。当一个行人T被另一个行人B遮挡时,检测器极易混淆——因为两个行人有类似的外观特征。结果就是本该框住T的限位框很可能偏移到B。而且由于所有初步检测结果会进一步使用NMS处理,偏移了的T的限位框可能会被B的限位框给抑制,让T成为漏检。密集人群让检测器对NMS阈值非常敏感:过高的阈值会导致更多的false positive,反之则会有更多的漏检。

图1

前沿的两步目标检测框架使用限位框回归来进行物体定位,即训练一个回归器,缩小候选和gt框之间的距离。但现有方法只要求候选与其指定的目标接近,没有考虑它周围的物体。如图1中,在标准限位框回归loss中,它对偏移到周围物体上的限位框并没有额外惩罚。这让我们思考:如果我们想检出人群中的一个人,该怎样利用他周围物体的位置呢?

受磁铁的特性启示,本论文提出了一个新的定位技术,称为Repulsion Loss(RepLoss)。使用RepLoss,每个候选不仅需要靠近赋予的目标T,还需离其它GT目标远。例如图1中的偏移向B的红色限位框会得到额外的惩罚,因为它与周围的一个非目标的对象重叠了。

Object Localization. 目标检测中的目标定位通常构造为回归问题,将初始候选重定位到赋予的目标。R-CNN使用欧几里得距离为候选坐标训练线性回归模型。Fast R-CNN使用$Smooth_{L1}$ Loss替换了欧氏距离。[24]提出了RPN,将会进行两次限位框回归。Densebox提出了一个无锚点的全卷积检测框架。[29]提出了IoU Loss,最大化gt框和预测框的IoU。

Pedestrian Detection. 传统行人检测,如ACF,LDCF,Checkboard,在Integral Channel Feature(IDF)上以滑动窗口的方式,使用各种滤波器来定位目标。[28,30]中使用了来自深度网络的特征,送入boosted decision forest。[21]提出了以多任务训练的网络,进一步提升了检测性能。[23, 27, 34]中使用了基于部位的模型,来处理被遮挡的行人。[13]致力于提升NMS的健壮性,但最终依赖于一个用于后处理的额外网络。

3. What is the Impact of Crowd Occlusion?

3.1 Preliminaries

CityPerson是一个基于语义分割数据集CityScape的行人检测数据集,拥有在德国数个城市拍摄的5000张图片。共约35000个行人,13000个忽略区域,标注了所有行人及其可见部分。采用了FPPI False Positive per Image的范围在$[10^{-2}, 10^0]$的log miss率的$MR^{-2}$指标(越低越好)。

我们使用了Faster R-CNN作为baseline检测器。我们将其中的骨干网从VGG-16替换为更快的ResNet-50网络。需要注意的是ResNet很少用于行人检测,因为它的下采样率过大,让网络很难检出并定位小的行人。为此我们使用了dilated卷积,使最终特征图为原图的1/8。

图2

3.2 Analysis on Failure Cases

Miss Detections. 我们先分析baseline检测结果中因人群遮挡导致的漏检。因为CityPerson提供了每个行人的可见部分的标注,我们可以计算出其遮挡率:$occ \triangleq 1 - \frac {area(BBox_{visible})} {area(BBox)} $。当$occ \ge 0.1$时,我们定义为遮挡,当$occ \ge 0.1$且与任意其它行人的$IoU \ge 0.1$时,我们定义为人群遮挡。从验证集中的1579个行人标注,可以提取出两个子集:有801个遮挡的reasonable-occ和有479个人群的reasonable-crowd。后者也是前者的子集。

图2是各集下的$MR^{-2}$。

图3a中,红线说明了在crowd集中,不同的检测得分阈值下gt的miss数。现实应用中只会考虑信心分高的限位框,而这样的漏检率说明真实应用还远未成熟。

图3

False Positive. 接下来分析有多少由人群遮挡导致的fp。我们将所有fp分为3类:背景,定位和人群错误。背景是预测框与任意gt框IoU都小于0.1的。定位错是与一个gt行人IoU大于0.1,人群错是与只是两个gt行人IoU大于0.1。

图3b中的红线说明fp中有20%由人群导致。图4中,我们观察到人群错通常是一个预测框或多或少地偏移到附近的无目标的gt对象,或框住了多个重叠的gt物体的并集。不仅如此,人群错通常有相对更高的信心分,导致top-rank中的fp。

图4

4. Repulsion Loss

RepLoss由3部分组成:

$L_{Attr} $是吸引attraction项,让预测框靠近分配的目标。$L_{RepGT}$和$L_{RepBox}$是排斥repulsion项,让预测框远离周围的gt物体和其它赋予了不同目标的预测出的框。

出于简便,我们仅考虑双类检测,假定所有gt物体都是同一类。设$P = (l_P, t_P, w_P, h_P)$,$G = (l_G,t_G,w_G,h_G)$分别为候选框和gt框。$P_+ = \{ P\}$是所有正候选(与至少一个gt框的IoU高,如大于0.5)的集合,$\mathcal G = \{G\}$是一张图中所有gt框的集合。

Attraction Term. 这一项loss在现有限位框回归计算中广泛应用。为便于比较,我们采用了$Smooth_{L1}$距离。其平滑参数设为了2。对一个候选$P \in \mathcal P_+$,我们将与它有最大IoU的gt框分配给它:$G_{Attr}^P = \arg \max _{G \in \mathcal G} IoU(G,P)$。$B^P$是从候选P回归得到的预测框。则Attraction Loss可以计算如下:

Repulsion Term(RepGT). 这个Loss设计用于使候选远离其周围的非目标gt物体。对一个候选$P \in \mathcal P_+$,其排斥gt对象定义为除其目标之外IoU最大的gt物体:

受[29]的IoU Loss启发,RepGT通过惩罚$B^P$和$G_{Rep}^P$间的重叠来计算。这个重叠定义为Intersection over Ground-truth (IoG):$IoG(B,G) \triangleq \frac {area(B \cap G)} {area(G)}$,RepGT Loss定义如下:

其中:

是一个平滑的ln函数,在(0,1)上连续可微,$\sigma \in [0,1)$是平滑参数,调节loss对异常值的敏感度。图5显示出来不同$\sigma$下的曲线。从公式4、5可以看出,当一个候选与一个非目标的gt物体重叠越多,RepGT会给与更大的惩罚。

图5

Repulsion Term (RepBox). 在大部分检测框架中,NMS是一个必要的后处理步骤,合并应该框住同一个物体的初步预测框。但检测结果受NMS影响很大,尤其是人群的情况。我们提出了RepBox Loss来使检测器对NMS不那么敏感:让有不同目标的候选互相排斥。我们将候选集$\mathcal P_+$根据他们各自的目标分为$|\mathcal G|$个互斥的子集:$\mathcal P_+ = \mathcal P_1 \cap \mathcal P_2 \cap … \cap \mathcal P_{|\mathcal G|}$,则对于从两个不同子集中随机采样的两个候选,$P_i \in \mathcal P_i$和$P_j \in \mathcal P_j$,其中$i,j = 1,2,…,|\mathcal G|$,且$i \neq j$,我们期望预测出的框$B^{P_i}$和$B^{P_j}$的重叠越小越好。则RepBox Loss计算如下:

其中$\mathbb 1$是identity函数,$\epsilon$是一个小常量,防止除以0。从公式6我们可以看出,要最小化RepBox Loss,有不同目标的预测框IoU必须小。这说明RepBox能降低属于不同目标的预测框被NMS合并的可能。

4.1 Discussion

Distance Metric. 值得讨论的是在惩罚项中,我们选择了IoG或IoU,而不是$Smooth_{L1}$作为距离度量。原因是前两个的值限制在[0,1],而$Smooth_{L1}$是无界的。假如我们在RepGT中使用$Smooth_{L1}$,它会要求预测框与其排斥的gt物体越远越好。而IoG评价方式则只需它们之间重叠最小,更符合我们的动机。

另外,RepGT Loss采用IoG而不是IoU的原因在于,在基于IoU的loss中,回归器也许会仅仅只通过简单地扩大限位框尺寸,增大分母$area(B^P \cup G_{Rep}^P)$来最小化loss。而IoG的分母是常量(gt限位框),只能最小化分子:重叠部分$area(B^P \cap G_{Rep}^P)$。

Smooth Parameter $\sigma$. 与[29]那样直接使用$\ln(IoU)$作为loss函数相比,我们在RepGT和RepBox中都引入了一个平滑ln函数$Smooth_{ln}$和一个平滑参数$\sigma$。由于预测的框比gt对象更多,所以RepBox异常值比RepGT更多,则RepBox Loss应对异常值更不敏感(更小的$\sigma$)。更多关于$\sigma$及额外的权重$\alpha, \beta$细节见5.2

5. Experiment

首先在5.1中给出了实现细节,5.2中在CityPerson分布评估分析了RepGT和RepBox,5.3中在CItyPerson和Caltech-USA上与SOTA的方法进行了比较。

详细翻译就不做了,参见原论文。

5.1 Experiment Settings

训练采用了自研框架。在CityPerson和Caltech-USA分别训练了80k和160k个iter,初始lr为0.016,并分别在前60k和120k后除以10。SGD在4路GPU上优化,每个mini-batch每块GPU有1张图片。decay为0.0001,动量为0.9。为了与之前的方法比较,没有进行多尺度训练/测试。Caltech-USA使用了10x集(约42k帧)。使用了OHEM加速收敛。

表1、2
图2

5.2 Ablation Study

表3

表4

图7

图8

表5

References

[1] Z. Cai, Q. Fan, R. S. Feris, and N. Vasconcelos. A unifiedmulti-scale deep convolutional neural network for fast objectdetection. In European Conference on Computer Vision,pages 354–370. Springer, 2016. 1
[2] M. Cordts, M. Omran, S. Ramos, T. Rehfeld, M. Enzweiler,R. Benenson, U. Franke, S. Roth, and B. Schiele. Thecityscapes dataset for semantic urban scene understanding.In Proceedings of the IEEE Conference on Computer Visionand Pattern Recognition, pages 3213–3223, 2016. 3
[3] J. Dai, Y. Li, K. He, and J. Sun. R-fcn: Object detectionvia region-based fully convolutional networks. In Advancesin neural information processing systems, pages 379–387, 2016. 1, 2
[4] C. Desai, D. Ramanan, and C. C. Fowlkes. Discriminativemodels for multi-class object layout. International journalof computer vision, 95(1):1–12, 2011. 2
[5] P. Dollar, R. Appel, S. Belongie, and P. Perona. Fast feature ´pyramids for object detection. IEEE Transactions on PatternAnalysis and Machine Intelligence, 36(8):1532–1545, 2014.1, 2
[6] P. Dollar, Z. Tu, P. Perona, and S. Belongie. Integral channel ´features. 2009. 1, 2
[7] P. Dollar, C. Wojek, B. Schiele, and P. Perona. Pedestrian ´detection: A benchmark. In Computer Vision and PatternRecognition, 2009. CVPR 2009. IEEE Conference on, pages304–311. IEEE, 2009. 1, 2, 6
[8] M. Everingham, L. Van Gool, C. K. Williams, J. Winn, andA. Zisserman. The pascal visual object classes (voc) challenge.International journal of computer vision, 88(2):303–338, 2010. 2, 8
[9] R. Girshick. Fast r-cnn. In The IEEE International Conferenceon Computer Vision (ICCV), December 2015. 1, 2,5
[10] R. Girshick, J. Donahue, T. Darrell, and J. Malik. Rich featurehierarchies for accurate object detection and semanticsegmentation. In The IEEE Conference on Computer Visionand Pattern Recognition (CVPR), June 2014. 1, 2, 5
[11] K. He, G. Gkioxari, P. Dollar, and R. Girshick. Mask r-cnn. ´In The IEEE International Conference on Computer Vision(ICCV), 2017. 1, 2
[12] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learningfor image recognition. In Proceedings of the IEEE conferenceon computer vision and pattern recognition, pages770–778, 2016. 2, 3, 8
[13] J. Hosang, R. Benenson, and B. Schiele. Learning nonmaximumsuppression. In The IEEE Conference on ComputerVision and Pattern Recognition (CVPR), July 2017. 2
[14] J. Hosang, M. Omran, R. Benenson, and B. Schiele. Taking adeeper look at pedestrians. In Proceedings of the IEEE Conferenceon Computer Vision and Pattern Recognition, pages4073–4082, 2015. 1, 2
[15] L. Huang, Y. Yang, Y. Deng, and Y. Yu. Densebox: Unifyinglandmark localization with end to end object detection. arXivpreprint arXiv:1509.04874, 2015. 2
[16] A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenetclassification with deep convolutional neural networks. InAdvances in neural information processing systems, pages1097–1105, 2012. 2
[17] J. Li, X. Liang, S. Shen, T. Xu, J. Feng, and S. Yan. Scaleawarefast r-cnn for pedestrian detection. IEEE Transactionson Multimedia, 2017. 2
[18] Y. Li, H. Qi, J. Dai, X. Ji, and Y. Wei. Fully convolutionalinstance-aware semantic segmentation. In IEEE Conf.on Computer Vision and Pattern Recognition (CVPR), pages2359–2367, 2017. 2
[19] T.-Y. Lin, P. Dollar, R. Girshick, K. He, B. Hariharan, and ´S. Belongie. Feature pyramid networks for object detection.In The IEEE Conference on Computer Vision and PatternRecognition (CVPR), 2017. 1, 2
[20] T.-Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollar. Focal ´loss for dense object detection. In The IEEE InternationalConference on Computer Vision (ICCV), 2017. 1
[21] J. Mao, T. Xiao, Y. Jiang, and Z. Cao. What can help pedestriandetection? In The IEEE Conference on Computer Visionand Pattern Recognition (CVPR), 2017. 1, 2, 3, 5, 7
[22] W. Nam, P. Dollar, and J. H. Han. Local decorrelation for ´improved detection. arXiv preprint arXiv:1406.1134, 2014.2
[23] W. Ouyang and X. Wang. A discriminative deep model forpedestrian detection with occlusion handling. In ComputerVision and Pattern Recognition (CVPR), 2012 IEEE Conferenceon, pages 3258–3265. IEEE, 2012. 2
[24] S. Ren, K. He, R. Girshick, and J. Sun. Faster r-cnn: Towardsreal-time object detection with region proposal networks. InC. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, andR. Garnett, editors, Advances in Neural Information ProcessingSystems 28, pages 91–99. Curran Associates, Inc., 2015.1, 2, 3, 8
[25] A. Shrivastava, A. Gupta, and R. Girshick. Training regionbasedobject detectors with online hard example mining. InProceedings of the IEEE Conference on Computer Visionand Pattern Recognition, pages 761–769, 2016. 6
[26] K. Simonyan and A. Zisserman. Very deep convolutionalnetworks for large-scale image recognition. arXiv preprintarXiv:1409.1556, 2014. 2
[27] Y. Tian, P. Luo, X. Wang, and X. Tang. Deep learning strongparts for pedestrian detection. In Proceedings of the IEEEinternational conference on computer vision, pages 1904–1912, 2015. 2
[28] B. Yang, J. Yan, Z. Lei, and S. Z. Li. Convolutional channelfeatures. In Proceedings of the IEEE international conferenceon computer vision, pages 82–90, 2015. 2
[29] J. Yu, Y. Jiang, Z. Wang, Z. Cao, and T. Huang. Unitbox:An advanced object detection network. In Proceedings ofthe 2016 ACM on Multimedia Conference, pages 516–520.ACM, 2016. 2, 5, 6
[30] L. Zhang, L. Lin, X. Liang, and K. He. Is faster r-cnn doingwell for pedestrian detection? In European Conference onComputer Vision, pages 443–457. Springer, 2016. 2
[31] S. Zhang, R. Benenson, M. Omran, J. Hosang, andB. Schiele. How far are we from solving pedestrian detection?In IEEE Conference on Computer Vision and PatternRecognition. IEEE Computer Society, 2016. 1, 3, 6, 7
[32] S. Zhang, R. Benenson, and B. Schiele. Filtered channelfeatures for pedestrian detection. In 2015 IEEE Conferenceon Computer Vision and Pattern Recognition (CVPR), pages1751–1760. IEEE, 2015. 2
[33] S. Zhang, R. Benenson, and B. Schiele. Citypersons: A diversedataset for pedestrian detection. In The IEEE Conferenceon Computer Vision and Pattern Recognition (CVPR), 2017. 1, 2, 3, 5, 6, 7, 8
[34] C. Zhou and J. Yuan. Multi-label learning of part detectorsfor heavily occluded pedestrian detection. In Proceedingsof the IEEE Conference on Computer Vision and PatternRecognition, pages 3486–3495, 2017. 2