作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2023, Vol. 49 ›› Issue (8): 240-249. doi: 10.19678/j.issn.1000-3428.0064587

• 开发研究与工程应用 • 上一篇    下一篇

基于改进YOLOv5的皮革瑕疵检测算法

刘俊豪1, 王美林1, 谢兴1, 宋烨兴1, 许莉花2   

  1. 1. 广东工业大学 信息工程学院, 广州 510006
    2. 西昌学院 机械与电气工程学院, 四川 西昌 615000
  • 收稿日期:2022-04-29 出版日期:2023-08-15 发布日期:2023-08-15
  • 作者简介:

    刘俊豪(1997—),男,硕士研究生,主研方向为计算机视觉

    王美林,副教授、博士

    谢兴,硕士研究生

    宋烨兴,硕士研究生

    许莉花,本科生

  • 基金资助:
    国家自然科学基金(U1701266); 国家自然科学基金(62002069); 广东省科技计划(2019A050513011); 广州市科技计划(202002030386)

Leather Defect Detection Algorithm Based on Improved YOLOv5

Junhao LIU1, Meilin WANG1, Xing XIE1, Yexing SONG1, Lihua XU2   

  1. 1. School of Information Engineering, Guangdong University of Technology, Guangzhou 510006, China
    2. School of Mechanical and Electrical Engineering, Xichang University, Xichang 615000, Sichuan, China
  • Received:2022-04-29 Online:2023-08-15 Published:2023-08-15

摘要:

皮革瑕疵检测是工业皮革生产行业中质量控制的重要环节,针对工业皮革瑕疵在线检测中存在计算复杂度高、对小目标检测效果差、数据样本少等问题,提出一种基于注意力机制的轻量化皮革瑕疵检测算法GPC-YOLOv5。使用工业相机采集瑕疵图片并对其进行标注,制作瑕疵数据集,利用YOLOv5s模型进行目标检测。使用ImgAug数据增强技术扩充原始数据集的数量,并在训练过程中结合Mosaic数据增强方法解决数据样本少的问题。在YOLOv5的基础上,使用轻量化的GhostNet模块替换主干网络和颈部的卷积模块,有效减少模型的参数量和计算量,通过改进激活函数减少网络复杂度并加快计算速度,以满足实时性需求。在主干网络中加入新型注意力机制Polarized Self-Attention模块,增强网络对于小目标瑕疵的特征提取能力。实验结果表明,相比YOLOv5,GPC-YOLOv5算法的参数量和计算量分别减少25.4%和28.5%,总体mAP达到89.2%,能够有效提高检测精度并加快检测速度。

关键词: 皮革瑕疵, 轻量型YOLOv5算法, 注意力机制, 深度学习, 目标检测

Abstract:

In the industrial leather production industry, leather defect detection is an important part of quality control. Aiming at the problems of high computational complexity, difficulties in small target defect detection, and few data samples, this study proposes an improved lightweight leather defect detection algorithm based on attention mechanism, GPC-YOLOv5. Defect pictures are collected using an industrial camera; whereby the images are annotated to create a defect dataset, and use the YOLOv5s model for object detection.The number of original datasets are expanded to solve the problem of few data samples using the Mosaic method combined with ImgAug data augmentation in the training process.The lightweight GhostNet module replaces the convolution module of the backbone network and neck in YOLOv5, thereby effectively reducing the number of parameters and computation load of the model.The network complexity reduces and calculations accelerate because of improving the activation function and real-time requirements are satisfied. The feature extraction ability of the network for small target defects is enhanced by adding a new attention mechanism, Polarized Self-Attention module, to the backbone network.The experimental results show that compared to YOLOv5, the GPC-YOLOv5 algorithm reduces the number of parameters and computation load by 25.4% and 28.5%, respectively, with an overall mean Average Precision(mAP) of 89.2%, effectively improving detection accuracy and accelerating detection speed.

Key words: leather defect, lightweight YOLOv5 algorithm, attention mechanism, deep learning, object detection