计算机工程与应用 ›› 2024, Vol. 60 ›› Issue (16): 217-227.DOI: 10.3778/j.issn.1002-8331.2305-0297

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

基于改进YOLOv5的X光违禁品检测算法

曾泓翔,文志诚   

  1. 湖南工业大学 计算机学院,湖南 株洲 412007
  • 出版日期:2024-08-15 发布日期:2024-08-15

X-Ray Contraband Detection Algorithm Based on Improved YOLOv5

ZENG Hongxiang, WEN Zhicheng   

  1. School of Computer Science, Hunan University of Technology, Zhuzhou, Hunan 412007, China
  • Online:2024-08-15 Published:2024-08-15

摘要: 针对安检X光图像的违禁品检测效率问题以及小尺寸违禁品的漏检误检问题,提出了一种基于改进YOLOv5的X光违禁品检测算法。该算法引入了ProFPN的结构,能够在FPN+PAN的基础上增加原始特征信息,提高检测精度;相比于原始YOLOv5增加了一层160×160的小目标检测层,使之拥有四尺度的特征融合,提高对小尺寸目标的学习能力;使用k-means++算法重新生成锚框尺寸,使之更加适合自制数据集的目标框大小,提高检测效率;采用了EIOU Loss作为回归损失函数,使目标框和锚框的宽高差异最小化,进一步提高检测框的定位精度和收敛速度。实验结果表明,改进后的算法在公开X光安检数据集上相比于原始YOLOv5算法mAP@0.5提高了4.7个百分点;相比于其他主流的目标检测算法,在参数量和运算量最小的情况下mAP@0.5最多提高了28.6个百分点,同样具有一定的优越性。

关键词: 深度学习, YOLOv5算法, X光违禁品检测, ProFPN, k-means++, EIOU Loss

Abstract: Aiming at the contraband detection efficiency of security X-ray images and the problem of missing and false detection of small size contraband, an X-ray contraband detection algorithm based on improved YOLOv5 is proposed. ProFPN structure is introduced in this algorithm, which can increase the participation of original feature information on the basis of FPN+PAN and improves the detection accuracy. Compared with the original YOLOv5, a small target detection layer of 160×160 is added to make it have four-scale feature fusion, which improves the learning ability of small-size targets. The size of anchor frame is reconstructed using k-means++ algorithm to make it more suitable for the target frame size of self-made dataset and improve the detection efficiency. EIOU Loss is adopted as a regression loss function, which minimizes the difference between the width and height of the target frame and the anchor frame, and further improves the positioning accuracy and convergence speed of the detection frame. Experimental results show that compared with the original YOLOv5 algorithm mAP@0.5, the improved algorithm has an increase of 4.7 percentage points in the public X-ray security dataset. Compared with other mainstream target detection algorithms, mAP@0.5 improves by 28.6 percentage points at most when the number of parameters and operation amount are minimal, which also has certain advantages.

Key words: deep learning, YOLOv5 algorithm, X-ray contraband detection, ProFPN, k-means++, EIOU Loss