计算机工程与应用 ›› 2024, Vol. 60 ›› Issue (10): 266-275.DOI: 10.3778/j.issn.1002-8331.2308-0444

• 图形图像处理 • 上一篇    下一篇

改进YOLOv7的X光图像危险品检测算法

张继龙,赵军,李金龙   

  1. 兰州交通大学 机电工程学院,兰州 730070
  • 出版日期:2024-05-15 发布日期:2024-05-15

Improved Dangerous Goods Detection in X-Ray Images of YOLOv7

ZHANG Jilong, ZHAO Jun, LI Jinlong   

  1. School of Mechatronic Engineering, Lanzhou Jiaotong University, Lanzhou 730070, China
  • Online:2024-05-15 Published:2024-05-15

摘要: 针对X光安检图像在危险品检测时背景复杂、遮挡严重、尺度多变等问题,对YOLOv7算法进行了改进,在提高检测精度的同时使网络更加轻量化。首先构建PS-ELAN模块替换原主干网络中的ELAN模块,减少网络计算量和内存占用,同时提升网络的特征提取能力。其次将无参注意力机制SimAM与可变形卷积DCNv2融合至颈部网络的下采样阶段,提高网络对X光图像危险品关键特征的捕捉能力。最后引入Dynamic Head模块,增强检测头的尺度感知、空间感知和任务感知,提高网络的检测性能。实验结果表明,改进后的算法在自制数据集和CLCXray数据集上的平均精度均值(mean average precision,mAP)比原YOLOv7模型分别提高了4.7个百分点和1.2个百分点,参数量和计算量分别下降了16.2%和23.1%。改进后的算法提高了检测能力,同时更为轻量化,可在实际安检中起到很好的辅助作用。

关键词: 深度学习, X光安检图像, 危险品检测, YOLOv7, 注意力机制

Abstract: Aiming at the problems of complex background, serious occlusion and variable scale of X-ray security inspection images in dangerous goods detection, the YOLOv7 algorithm is improved, which improves the detection accuracy and makes the network more lightweight. Firstly, the PS-ELAN module is built to replace the ELAN module in the original backbone network, which reduces the network computing amount and memory occupation, and improves the feature extraction capability of the network. Secondly, the parameter-free attention mechanism SimAM and deformable convolutional DCNv2 are fused into the downsampling stage of the neck network to improve the network’s ability to capture the key features of dangerous goods in X-ray images. Finally, the Dynamic Head module is introduced to enhance the scale perception, spatial perception and task perception of the detection head, and improve the detection performance of the network. Experimental results show that the mean average precision (mAP) of the improved algorithm on the self-made dataset and CLCXray dataset is improved by 4.7 percentage points and 1.2 percentage points, respectively, and the number of parameters and calculations are reduced by 16.2% and 23.1%, respectively. The improved algorithm makes detection capability lighter, which can play a good role in actual security checks.

Key words: deep learning, X-ray security inspection image, dangerous goods, YOLOv7, attention mechanism