Computer Engineering and Applications ›› 2023, Vol. 59 ›› Issue (12): 176-183.DOI: 10.3778/j.issn.1002-8331.2302-0191

• Graphics and Image Processing • Previous Articles     Next Articles

Improved Yolov7-tiny Algorithm for Steel Surface Defect Detection

QI Xiangming, DONG Xu   

  1. School of Software, Liaoning University of Technology, Huludao, Liaoning 125100, China
  • Online:2023-06-15 Published:2023-06-15

改进Yolov7-tiny的钢材表面缺陷检测算法

齐向明,董旭   

  1. 辽宁工程技术大学 软件学院,辽宁 葫芦岛 125100

Abstract: In order to improve the efficiency of small target detection of steel surface defects, an improved Yolov7-tiny steel surface defect detection algorithm is proposed. The activation function of the feature extraction network is changed  to SiLU to improve the feature extraction capability. The tensor splicing operation of the feature fusion network is combined with the weighted bidirectional feature pyramid BiFPN, and the nearest interpolation of the upper sampling part is replaced with the lightweight operator CARAFE to improve the feature fusion ability. Finally, the multi-head self-attention mechanism MHSA and SPD convolution building blocks are introduced at the output end to improve the detection performance of the output end for small targets of steel surface defects. The ablation and contrast experiments are carried out on the NEU-DET dataset. Compared with the original Yolov7-tiny algorithm, the improved algorithm has increased the mAP by 11.7 percentage points, the precision by 3.3 percentage points, and the FPS value reaches 192. The results show that the improved algorithm can effectively improve the detection efficiency of small targets of steel surface defects. Comparative experiments on the VOC2012 dataset show that the improved algorithm is universal.

Key words: steel surface, defect detection, Yolov7-tiny, SiLU, BiFPN, CARAFE, MHSA, SPD

摘要: 为提高钢材表面缺陷小目标检测效率,提出一种改进Yolov7-tiny的钢材表面缺陷检测算法。将特征提取网络的激活函数更换为SiLU,提高特征提取能力;把特征融合网络的张量拼接操作与加权双向特征金字塔BiFPN结合,再把上采样部分的最邻近插值替换为轻量级算子CARAFE,提升特征融合能力;最后在输出端引入多头自注意力机制MHSA 和SPD卷积构建块,提升输出端对钢材表面缺陷小目标的检测性能。在NEU-DET数据集上做消融和对比实验,改进算法与原Yolov7-tiny算法比较,mAP提升11.7个百分点,Precision提升3.3个百分点,FPS值达到192,结果表明改进算法能有效提升钢材表面缺陷小目标检测效率;在VOC2012数据集上做通用性对比实验,结果表明改进算法具有通用性。

关键词: 钢材表面, 缺陷检测, Yolov7-tiny, SiLU, BiFPN, CARAFE, MHSA, SPD