摘要
针对目前PCB缺陷检测算法在实际应用中检测精度低等问题,提出基于改进YOLOv5s的PCB缺陷检测算法YOLOv5-TGs。该算法以YOLOv5s算法模型为基础,首先在主干网络中引入Swin Transformer结构,并取代C3模块中的Bottleneck模块,并使用Ghost卷积模块替换Conv模块,降低了模型的计算复杂度,实现轻量化,同时增加了其接收域,增强PCB缺陷的小目标的特征表达能力;其次,在颈部网络的C3结构后面添加全局注意力机制,更大程度地保留通道和空间信息,在减少特征信息弥散的情况下放大全局跨纬度的交互特征,提高检测效率。最后用SIoU损失函数来代替原有的CIoU损失函数,通过在损失函数代价中引入方向性,加快模型收敛速度,提高回归精度。本文实验使用的是北京大学实验室公开发布的PCB缺陷数据集,结果表明:改进算法的平均精度均值达到98.2%,精确率达到95.5%;相较于YOLOv5s,改进算法的平均精度均值提升了7.3%,精确率提升了7.5%。
A PCB defect detection algorithm YOLOv5-TGs based on improved YOLOv5s is proposed to address the low detection accuracy of current PCB defect detection algorithms in practical applications.This algorithm is based on the YOLOv5s algorithm model.Firstly,the Swin Transformer structure is introduced into the backbone network,replacing the bottleneck module in the C3 module.The Ghost Conv module is used to replace the Conv module,reducing the computational complexity of the model and achieving lightweight.At the same time,the receiver domain is increased to enhance the feature expression ability of small targets with PCB defects.Secondly,a global attention mechanism is added after the C3 structure of the Neck network to preserve channel and spatial information to a greater extent,amplifying global cross latitude interactive features while reducing feature information dispersion and improving detection efficiency.Finally,the SIoU loss function is used to replace the original CIoU loss function.By introducing directionality into the cost of the loss function,the convergence speed of the model is accelerated and the regression accuracy is improved.The experiment in this article used a PCB defect dataset publicly released by the Peking University laboratory,and the results showed that theimproved algorithm achieved an average accuracy mean(mAP)of 98.2%and an accuracy rate of 95.5%.Compared to YOLOv5s,mAP has improved by 7.3%and accuracy by 7.5%.
作者
徐一奇
肖金球
谢翔
XU Yiqi;XIAO Jinqiu;XIE Xiang(College of Electronics and Information Engineering,Suzhou University of Science and Technology,Suzhou 215009,China;Intelligent Measurement and Control Engineering Technology Research Center,Suzhou 215009,China;College of Physical Science and Technology,Suzhou University of Science and Technology,Suzhou 215009,China)
出处
《微电子学与计算机》
2024年第10期21-34,共14页
Microelectronics & Computer
基金
中国住房与城乡建设部项目(341111601)
江苏省住房和城乡建设厅项目(34173164)。