Computer Engineering and Applications ›› 2023, Vol. 59 ›› Issue (23): 283-292.DOI: 10.3778/j.issn.1002-8331.2306-0138

• Engineering and Applications • Previous Articles     Next Articles

Improved YOLOv7 Algorithm for Small Sample Steel Plate Surface Defect Detection

DOU Zhi, HU Chenguang, LI Qinghua, ZHENG Liming   

  1. 1.School of Computer and Information Engineering, Henan Normal University, Xinxiang,Henan 453007, China
    2.Laiwu Iron and Steel Group Yinshan Section Steel Co., Ltd., Jinan 271104, China
    3.School of Mechanical and Electrical Engineering, Jinling Institute of Technology, Nanjing 211169, China
  • Online:2023-12-01 Published:2023-12-01



  1. 1.河南师范大学 计算机与信息工程学院,河南 新乡 453007
    2.莱芜钢铁集团银山型钢有限公司板带厂,济南 271104
    3.金陵科技学院 机电工程学院,南京 211169

Abstract: The steel plate manufacturing industry has its own domain specificity, with a large number of scar types, a small number of defective products, and high requirements for detection performance. Traditional defect detection algorithms cannot meet industry requirements. In addition, the industry’s data disclosure rate is extremely low, and there is a lack of sufficient training samples to make deep learning difficult to apply in this field. To solve the above problems, a small sample driven training sample generation method is proposed, it can generate large-scale samples while ensuring the diversity and authenticity of samples, making the training of deep networks feasible. At the same time, a steel plate defect detection algorithm based on improved YOLOv7 is proposed. Firstly, the ELAN module in the YOLOv7 network model is optimized to enhance the network’s ability to extract important features. Next, it uses the ACmix attention module to improve the network’s attention to small targets, effectively solving the problem of missed detection of small targets in the original network model. Finally, WIoU is introduced to replace CIoU in the original network model to optimize the loss function and improve the target positioning performance. The experimental results indicate that the improved YOLOv7 has been successfully applied to the detection of small sample steel plate defects, with obvious advantages in detection performance and higher than industry requirements.

Key words: intelligent manufacturing, defect detection, small sample, YOLOv7, attention mechanism, loss function

摘要: 钢板制造行业有其领域特殊性,伤痕类型较多,次品数量极少,且对检测性能要求较高,传统的缺陷检测算法无法达到行业要求。此外,行业数据公开率极低,缺少足够的训练样本使得深度学习难以应用于该领域。为解决上述问题,提出一种小样本驱动的训练样本生成方法,可在保证样本多样性和真实性的前提下生成大规模样本,使得深度网络的训练具备可行性。同时,提出一种基于改进YOLOv7的钢板缺陷检测算法。对YOLOv7网络模型中的ELAN模块进行了优化,增强网络对重要特征的提取能力;使用ACmix注意力模块提高网络对小目标的关注度,有效解决原网络模型对小目标的漏检问题;引入WIoU替换原网络模型中CIoU来优化损失函数,提升目标定位性能。实验结果表明:已成功将改进的YOLOv7应用于小样本钢板缺陷检测,检测性能具有较为明显的优势,且高于行业要求。

关键词: 智能制造, 缺陷检测, 小样本, YOLOv7, 注意力机制, 损失函数