Computer Engineering and Applications ›› 2023, Vol. 59 ›› Issue (6): 221-230.DOI: 10.3778/j.issn.1002-8331.2210-0479

• Graphics and Image Processing • Previous Articles     Next Articles

Wearing Mask Pedestrian Tracking Based on Improved YOLOv7 and DeepSORT

ZHAO Yuanlong, SHAN Yugang, YUAN Jie   

  1. 1.School of Electrical Engineering, Xinjiang University, Urumqi 830017, China
    2.School of Education, Hubei University of Arts and Science, Xiangyang, Hubei 441053, China
  • Online:2023-03-15 Published:2023-03-15

改进YOLOv7与DeepSORT的佩戴口罩行人跟踪

赵元龙,单玉刚,袁杰   

  1. 1.新疆大学 电气工程学院,乌鲁木齐 830017
    2.湖北文理学院 教育学院,湖北 襄阳 441053

Abstract: A pedestrian tracking algorithm based on improved YOLOv7 and DeepSORT is proposed to solve the problem that whether pedestrians wear masks cannot be correctly judged due to face occlusion and missed detection in video sequences. The algorithm combines mask detection, pedestrian detection and tracking. Firstly, by adding attention mechanism to the backbone network of YOLOv7, shallow feature maps are added to enhance the network’s ability to perceive small targets and improve the accuracy of mask detection and pedestrian detection. Secondly, the intra-frame relationship module uses the Hungarian algorithm to correlate the intra-frame targets and mark the mask wearing of pedestrians. Then, the direction difference factor is added to the association cost of the DeepSORT algorithm to eliminate the inconsistency between the historical detection direction and the new detection speed direction of the tracking trajectory. Finally, the improved DeepSORT algorithm is used to track pedestrians and update the mask wearing mark for each track, achieve tracking of pedestrians wearing masks and those not wearing masks. The experimental results show that the average detection accuracy mAP50 of the improved YOLOv7 network is 3.83 percentage points higher than that of the original algorithm. On the MOT16 dataset, the tracking accuracy MOTA of this algorithm is 17.1 percentage points higher than that of DeepSORT algorithm, and the tracking precision MOTP is increased by 2.6% percentage points. Compared with the detection algorithm, this algorithm can track more pedestrians whether wearing masks, and has better results.

Key words: pedestrians tracking, mask detection, attention mechanism

摘要: 针对视频序列中因脸部遮挡、漏检而造成的无法正确判断行人是否佩戴口罩的问题,提出一种基于改进YOLOv7与DeepSORT的佩戴口罩行人跟踪算法。该算法将口罩检测、行人检测与跟踪相结合,通过在YOLOv7的主干网络中添加注意力机制,增加浅层特征图,加强网络对小目标的感知能力,提高口罩检测与行人检测精度;帧内关系模块利用匈牙利算法进行帧内目标关联,对行人进行口罩佩戴标记;将方向差因素加入到DeepSORT算法的关联代价中,消除跟踪轨迹的历史预测方向和新检测速度方向不一致问题;使用改进的DeepSORT算法对行人进行跟踪,并对每条轨迹进行口罩佩戴标记更新,实现对佩戴口罩与未佩戴口罩行人的跟踪。实验结果表明,改进的YOLOv7网络平均检测精度mAP50相比原始算法提升了3.83个百分点;在MOT16数据集上,该算法的跟踪准确性MOTA相较DeepSORT算法提高了17.1个百分点,跟踪精度MOTP提高了2.6个百分点。与检测算法相比,提出的算法能够跟踪到更多的行人是否佩戴了口罩,具有更好的效果。

关键词: 行人跟踪, 口罩检测, 注意力机制