-
在车辆行驶过程中,对行人进行检测是一个连续性的过程。在这个过程中,由于摄像头的帧率较高(如:Caltech行人检测数据集[17]中图像采集的速率为30frame/s),连续采集到的两帧图像具有很高的相似性。图 1为从Caltech行人检测数据集中随机提取的两组相邻图像及其灰度值差异(绝对值)。从图中可以看到:行人在相邻图像中的位置变化很小,在差异图像中的轮廓明显,并且影响检测的背景信息已基本剔除。基于这一事实,本文中提出了基于历史信息的区域卷积神经网络行人检测算法。
-
如图 2所示,HR-CNN的网络结构与faster R-CNN在总体上保持一致,区别在于:(1)使用本文中提出的HRPN在充分利用前一帧检测结果作为参考信息的基础上产生推荐区域,以提升推荐区域产生的速度和质量;(2)采用Inception[13]网络作为卷积层,与VGG网络相比,Inception网络结构更宽,对不同尺度物体的适应性更强,有助于提升对小目标的检测准确率。
-
在连续行人检测中,相邻图像之间具有较高的相似性。从这些图像中检测行人时,前一幅图像的检测结果以及当前图像与前一幅图像之间的相对变化,对当前图像的检测提供了非常有价值的信息:一方面,相邻两幅图像采集的时间间隔短,前一幅图像中检测到的行人在这段时间内相对位移小,以较大概率存在于当前图像的对应位置附近;另一方面,如果当前图像的某些区域和前一幅图像中的对应区域保持不变或差异很小,那么这些区域中的目标基本保持一致,在通过滑动窗口提取推荐区域时可以跳过这部分区域,而变化较大的区域需要重点进行检测。HRPN是利用这些信息对RPN网络进行优化。HRPN由历史信息处理模块(见图 3)和RPN(见图 4)两个模块组成。图 4中,k表示不同锚定框的信息量数值,d表示卷积特征图维度。各模块功能和处理过程如下。
-
利用前一幅图像和当前图像的差异对当前图像的卷积特征图进行处理,并基于前一幅图像的检测结果产生部分推荐区域。处理步骤见下。
(1) 计算灰度值差异。灰度值差异为当前图像和前一帧图像对应位置的像素值绝对差,如下所示:
$ I_{\mathrm{d}}(i, j)=\left|I_{1}(i, j)-I_{2}(i, j)\right| $
(1) 式中, I1(i, j)和I2(i, j)分别为当前待检测图像与前一帧图像对应位置的像素值,Id(i, j)为差异图像对应位置的像素值。
得到的图像差异仍能够可视化为图像,在可视化图像中明暗程度表示对应位置差异的大小。
(2) 滑动区域过滤器生成。滑动区域过滤器用于缩小RPN网络产生推荐区域时滑动窗口搜索的范围,进而提升RPN网络产生推荐区域的速度。滑动区域过滤器为二值化的灰度差异图像,关键是对灰度差异图像(见图 5)进行二值化处理。常用的二值化算法有灰度平均值法、百分比阈值法、谷底最小值法和双峰平均值法等,图 6为图 1f的灰度值直方图。可以看到, 图 6中并没有谷底和双峰,即无法通过谷底最小值法和双峰平均值法对图像进行二值化处理;而均值法得到的二值化图像相比与由百分比阈值法中百分比p=0.05和p=0.03得到的二值化图像相比噪声略大,所以本文中采用百分比阈值法对差异图像进行二值化处理。
Figure 5. Mean threshold binary image of Fig. 1f
Figure 6. Gray value histogram of Fig. 1f
灰度值差异图像由相邻两帧图像作绝对差后得到,如果两帧图像某个位置的差异越小,则灰度值图像中对应位置的灰度值越小,反之,灰度值越大,即灰度差异图像中的灰度值大小体现了相邻两帧图像之间的差异。另一方面,相关系数可以描述两帧图像的相关性,其计算方法如下式所示:
$ r = \frac{{\sum {\left[ {{I_1}(i, j) - \overline {{I_1}} } \right]} \left[ {{I_2}(i, j) - \overline {{I_2}} } \right]}}{{\sqrt {\sum {{{\left[ {{I_1}(i, j) - \overline {{I_1}} } \right]}^2}} } \sqrt {\sum {{{\left[ {{I_2}(i, j) - \overline {{I_2}} } \right]}^2}} } }} $
(2) 式中, ${\overline {{I_1}} }$和${\overline {{I_2}} }$分别为当前待检测图像和前一帧图像像素的平均值。
相关系数越大, 表示两帧图像之间的相关性越高,差异越小。所以,本文中使用两帧图像的相关系数r确定该百分比阈值t=1-r,从图 7中可见, 百分比阈值过大,则一些包含目标的区域也被过滤,而百分比过小则不能很好地过滤那些不包含目标的区域,并且百分比阈值接近t时的效果较好。
(3) 基于历史信息的区域推荐。由于前一帧检测到的结果以较大的概率存在于当前图像的对应位置附近,作者提出的基于历史信息的区域推荐将前一帧检测输出的矩形框作为当前图像潜在的推荐区域进行验证,由softmax分类器给出验证结果,如果softmax分类器判定某个潜在的推荐区域存在行人,该潜在推荐区域将作为当前图像的推荐区域输出。
-
经过历史信息处理模块后,HRPN获得一部分推荐区域,另一部分推荐区域将由RPN给出。与faster R-CNN不同的是,本文中的RPN通过滑动窗口搜索候选区域时,搜索范围是经过上述滑动区域过滤器过滤得到的,进行滑动窗口检测时所需扫描的区域有所减少,速度得到提升。
-
HR-CNN主要针对连续行人检测场景设计和优化,同时也可以用于非连续性的检测。当检测模式为非连续性时,HRPN中推荐区域仅由RPN网络模块产生,整个网络相当于faster R-CNN。由于HR-CNN采用Inception网络作为卷积网络,因此对图像中的小目标检测效果仍优于faster R-CNN。
-
训练一个深度卷积神经网络需要耗费大量的计算资源,利用迁移学习将已经训练好的模型参量迁移到新的模型中,再进行新模型的训练,可以大大降低训练的开销。本文中对提出的HR-CNN在TensorFlow神经网络框架中实现,并基于预训练的Inception V4[18]对HR-CNN在Caltech行人检测数据集上进行训练。如图 8所示,HR-CNN对Caltech数据集中部分图像检测的输出结果。由于大部分Caltech数据集图像中行人数量偏少,本文中选取了行人数量相对较多的图像进行展示。从图 8中可以看到,HR-CNN准确地检测到了图中的行人。
-
实验在一台Linux主机上进行,配置如下:10核Intel(R) Xeon(R) CPU E7-4830处理器,256GB内存和Titan X显卡,操作系统为Ubuntu 16.04,测试程序基于TensorFlow 1.8.0实现。
-
将HRPN与RPN以及选择性搜索[19](selective search)和边框[20](edge-boxes)3种区域推荐算法在交并比(intersection-over-union,IoU)为0.7的情况下进行了对比。交并比为推荐区域和标记区域的交集和并集的比值,最理想的状态是推荐区域和标记区域完全重叠,即IoU为1。但是,在实际中不可能都达到理想状态,通常认为IoU大于0.5就是一个良好的推荐结果。表 1为统计结果,其中selective search, edge-boxes和RPN的统计数据均来自于参考文献[21]。
Table 1. Recall rates with different regional recommendation algorithms
recall recommendation algorithm selective search edge-boxes RPN HRPN 50% 300 100 30 7 75% 1400 800 250 18 从表 1中可见, HRPN只需7个推荐区域就可以获得50%的召回率,18个推荐区域可以获得75%的召回率,大大优于RPN以及selective search和edge-boxes。这充分说明,结合历史信息仅需较少的推荐区域就可以获得高召回率,提升了推荐区域产生的质量。
-
在Caltech数据集上将HR-CNN与R-CNN, fast R-CNN, faster R-CNN以及adapted faster R-CNN[13]等区域推荐神经网络算法从检测准确率和速度两方面进行了对比,其中adapted faster R-CNN为ZHANG等人对faster R-CNN去除上采样后在CityPersons数据集上训练的模型,该模型在Caltech数据集上的检测效果达到了与目前最好的检测结果相近的水平。同时,为了体现HRPN的作用,本文中还对比了使用HRPN作为区域推荐网络的faster R-CNN,同adapted faster R-CNN一致,采用VGG-16作为卷积层。
在目标检测中,通常使用平均精度均值(mean average precision,MAP)作为衡量指标,行人检测中的检测目标只有行人这一种类别,因此对行人检测结果的AP也就是MAP。从表 2中可以看出:HR-CNN相较于faster R-CNN和adapted Faster R-CNN在检测速度上分别提升了5倍和2.5倍,同时检测结果的准确率与adapted faster R-CNN相比也提升了约1.5%;采用HRPN作为区域推荐网络的faster R-CNN相较于采用原faster R-CNN在检测速度提升了3倍,检测准确率提升了约11%,这是因为HRPN可以用更少的推荐区域获得更高的召回率,而检测的准确率低于HR-CNN是因为VGG-16对小目标的检测效果没有Inception V4好。
Table 2. Test results accuracy and test time with different regional recommendation algorithms
R-CNN fast R-CNN faster R-CNN adapted faster R-CNN faster R-CNN with HRPN HR-CNN time 47s 5s 198ms 99ms 64ms 39ms MAP/% 53.3% 65.7 73.2 88.7 84 90.2 图 9为HR-CNN与adapted faster R-CNN等行人检测算法的漏检率-错误率和准确率-召回率两个指标进行了比较。从图 9中可以看出,HR-CNN在两个指标上都优于其它对比方案。
基于历史信息的区域卷积神经网络行人检测
Continuous pedestrian detection by means of regional convolutional neural network based on historical information
-
摘要: 为了解决卷积神经网络在进行连续行人检测时, 检测行人速度较慢, 达不到实时性要求的问题, 采用基于历史信息的区域卷积神经网络行人检测算法, 利用前一幅图像中的检测结果对当前图像的检测过程进行优化, 将前一帧的检测结果作为对当前帧提取推荐区域的参考信息, 并使用当前帧与前一帧的灰度值差异图对当前图像的卷积特征进行过滤, 以缩小滑动窗口检测时的搜索区域。在加州理工学院行人检测数据集上进行了检测实验。结果表明, 结合历史信息的算法与先进的算法相比检测速度提升了2.5倍, 同时检测准确率提升了1.5%。该算法实现了实时行人检测, 设计的网络能有效检测小目标行人。Abstract: In order to solve the problem that convolutional neural network detection of pedestrians was slow, and did not meet the real-time requirement when performing continuous pedestrian detection, pedestrian detection algorithm of history-based region with convolutional neural network was used. Current image was detected by using the detection result in the previous image. The detection process was optimized, and the detection result of the previous image was used as reference information for extracting region proposals of the current image. Convolution feature of the current image was filtered by using the gray value difference map of the current image and the previous image to reduce the sliding window searching area. The results of Caltech pedestrian detection data set show that the algorithm combined with historical information is 2.5 times faster than the advanced algorithm, and the detection accuracy is increased by 1.5%. The algorithm implements real-time pedestrian detection, and the designed network can effectively detect small target pedestrians.
-
Figure 5. Mean threshold binary image of Fig. 1f
Figure 6. Gray value histogram of Fig. 1f
Table 1. Recall rates with different regional recommendation algorithms
recall recommendation algorithm selective search edge-boxes RPN HRPN 50% 300 100 30 7 75% 1400 800 250 18 Table 2. Test results accuracy and test time with different regional recommendation algorithms
R-CNN fast R-CNN faster R-CNN adapted faster R-CNN faster R-CNN with HRPN HR-CNN time 47s 5s 198ms 99ms 64ms 39ms MAP/% 53.3% 65.7 73.2 88.7 84 90.2 -
[1] KRIZHEVSKY A, SUTSKEVER I, HINTON G E. Imagenet classification with deep convolutional neural networks[C]//Advances in neural information processing systems. Lake Tahoe, Nevada, USA: Curran Associates Inc, 2012: 1097-1105. [2] FENG W, WANG Y D, ZHANG L. Weighted joint dimensionality extraction and classification recognition algorithm [J]. Laser Technology, 2018, 42(5): 666-672(in Chinese). [3] LIN T Y, MAIRE M, BELONGIE S, et al. Microsoft coco: Common objects in context[C]//European Conference on Computer Vision. Zurich, Switzerland: Springer, 2014: 740-755. [4] EVERINGHAM M, Van GOOL L, WILLIAMS C K I, et al. The pascal visual object classes (voc) challenge[J]. International Journal of Computer Vision, 2010, 88(2): 303-338. doi: 10.1007/s11263-009-0275-4 [5] RUSSAKOVSKY O, DENG J, SU H, et al. Imagenet large scale visual recognition challenge[J]. International Journal of Computer Vision, 2015, 115(3): 211-252. doi: 10.1007/s11263-015-0816-y [6] BENENSON R, OMRAN M, HOSANG J, et al. Ten years of pedestrian detection, what have we learned[C]//European Conference on Computer Vision. Zurich, Switzerland : Springer, 2014: 613-627. [7] ZHANG S, BENENSON R, OMRAN M, et al. How far are we from solving pedestrian detection[C]//Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. New York, USA: IEEE, 2016: 1259-1267. [8] COSTEA A D, NEDEVSCHI S. Semantic channels for fast pedestrian detection[C]//Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. New York, USA: IEEE, 2016: 2360-2368. [9] HOSANG J, OMRAN M, BENENSON R, et al. Taking a deeper look at pedestrians[C]//Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. New York, USA: IEEE, 2015: 4073-4082. [10] GIRSHICK R, DONAHUE J, DARRELL T, et al. Rich feature hierarchies for accurate object detection and semantic segmentation[C]//Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. New York, USA: IEEE, 2014: 580-587. [11] REN S, HE K, GIRSHICK R, et al. Faster R-CNN: towards real-time object detection with region proposal networks[J]. IEEE Transactions on Pattern Analysis & Machine Intelligence, 2017, 39(6): 1137-1149. [12] ZHANG L, LIN L, LIANG X, et al. Is faster R-CNN doing well for pedestrian detection[C]//European Conference on computer Vision. Amsterdam, Netherlands: Springer, 2016: 443-457. [13] ZHANG Sh Sh, BENENSON R, SCHIELE B. Citypersons: A diverse dataset for pedestrian detection[C]//The IEEE Conference on Computer Vision and Pattern Recognition (CVPR). New York, USA: IEEE, 2017: 3. [14] LI J, LIANG X, SHEN S M, et al. Scale-aware fast R-CNN for pedestrian detection[J]. IEEE Transactions on Multimedia, 2018, 20(4): 985-996. [15] GIRSHICK R. Fast R-CNN[C]//Proceedings of the IEEE International Conference on Computer Vision. New York, USA: IEEE, 2015: 1440-1448. [16] SZEGEDY C, IOFFE S, VANHOUCKE V, et al. Inception-V4, inception-resnet and the impact of residual connections on learning[J].Computer Vison and Pattern Recognition, 2016, 23(2):07261. [17] DOLLÁR P, WOJEK C, SCHIELE B, et al. Pedestrian detection: A benchmark[C]//IEEE Conference on Computer Vision and Pattern Recognition, 2009. New York, USA: IEEE, 2009: 304-311. [18] GUADARRAMA S. Tensorflow-slim image classification model library[OL].(2018-07-05)[2018-12-31].https://github.com/tensorflow/models/tree/master/research/slim. [19] UIJLINGS J R R, van de SANDE K E A, GEVERS T, et al. Selective search for object recognition[J]. International Journal of Computer Vision, 2013, 104(2): 154-171. doi: 10.1007/s11263-013-0620-5 [20] ZITNICK C L, DOLLÁR P. Edge boxes: Locating object proposals from edges[C]//European Conference on Computer Vision. Zurich, Switzerland : Springer, 2014: 391-405. [21] KONG T, YAO A, CHEN Y, et al. Hypernet: Towards accurate region proposal generation and joint object detection[C]//Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. New York, USA: IEEE, 2016: 845-853.