|
|
Improved YOLOv5s-based algorithm for printed circuit board defect detection |
Zhuguo ZHOU1,2( ),Yujun LU1,*( ),Liye LV1,2 |
1. School of Mechanical Engineering, Zhejiang Sci-Tech University, Hangzhou 310018, China 2. Longgang Institute of Zhejiang Sci-Tech University, Wenzhou 325802, China |
|
|
Abstract A defect detection method based on improved YOLOv5s was proposed aiming at the problems that exist in printed circuit board (PCB), such as small defect targets that are not easy to be identified, high false detection rate, and large model size that is not easy to be deployed. Hierarchical density-based clustering k-means (hierarchical density-based K-means, HDBK-means) algorithm was used to regroup to get the anchor frame more suitable for the characteristics of PCB defects. The feature extraction module in the YOLOv5s backbone was replaced with a reparameterized normalized cross stage partial efficient layer aggregation network (RepNCSPELAN) improved by spatial and channel reconstruction convolution (SCConv), which greatly improved the speed of model inference while ensuring accuracy. Then the recognition ability of the model for defective targets at various scales can be improved by introducing reparameterized detail-enhanced generalized feature pyramid network (RDEGFPN) for feature fusion while reducing the computational resource consumption. Dynamic upsample (DySample) was used to innovate the feature fusion network to form generalized dynamic feature pyramid network (GDFPN), which improved the lightweight and efficiency of the model and made the model easier to deploy. Comparative experiments conducted on public PCB datasets demonstrate that the proposed algorithm achieves a 3.8% improvement in mean average precision (mAP), a 2.9% enhancement in precision, and a 26.9% reduction in model size, while achieving a detection speed of 138.1 frames per second. The deployment of the model on the RK3568 platform meets the requirements for real-time detection and embedded device implementation.
|
Received: 02 August 2024
Published: 28 July 2025
|
|
Fund: 浙江理工大学龙港研究院资助项目(LGYJY2021004). |
Corresponding Authors:
Yujun LU
E-mail: 2284545699@qq.com;luet_lyj@zstu.edu.cn
|
基于改进YOLOv5s的印刷电路板缺陷检测算法
针对印刷电路板(PCB)存在的缺陷目标较小不易被识别、误检率高以及模型尺寸较大不易部署等问题,提出基于改进YOLOv5s的缺陷检测方法. 该方法使用基于密度分层聚类的K-means (HDBK-means) 算法,重新聚类得到更适合PCB缺陷特点的锚框. 使用经空间与通道重建卷积 (SCConv) 改进的重参数化非线性跨阶段部分高效层聚合网络 (RepNCSPELAN) 替换YOLOv5s主干中的特征提取模块,在保证精度的前提下,大大提高了模型推理速度. 通过引入重参数化细节增强广义特征金字塔网络 (RDEGFPN) 进行特征融合,提升模型对于各个尺度缺陷目标的识别能力,减少计算资源消耗. 使用动态上采样(DySample)对特征融合网络进行二次创新,形成广义动态特征融合金字塔网络 (GDFPN),提高模型的轻量级与高效性,使得模型更容易部署. 在公共PCB数据集上进行的对比实验表明,该算法将平均精度均值(mAP)提高了3.8%,将精度提高了2.9%,模型大小减少了26.9%,模型的检测速度达到138.1帧/s. 将模型部署到RK3568平台上进行检测,满足了实时检测与嵌入式设备部署的要求.
关键词:
印刷电路板,
YOLOv5s,
聚类算法,
特征提取,
特征融合
|
|
[1] |
XIAO Z, WANG Z, LIU D, et al A path planning algorithm for PCB surface quality automatic inspection[J]. Journal of Intelligent Manufacturing, 2021, 33 (6): 1- 13
|
|
|
[2] |
黄银花, 李东波. 高速高精度印刷电路板表面贴装自动光学检测系统的研究 [J]. 机床与液压, 2014, 42(21): 105-108. HUANG Yinhua , LI Dongbo. Research on high-speed and high-precision automatic optical inspection system for surface mount technology of printed circuit board [J]. Machine Tool and Hydraulics, 2014, 42(21): 105-108.
|
|
|
[3] |
赵翔宇, 周亚同, 何峰, 等 分层提取匹配印刷电路板元器件缺陷检测[J]. 仪表技术与传感器, 2018, (8): 84- 89 ZHAO Xiangyu, ZHOU Yatong, HE Feng, et al Defect detection of printed circuit board components based on hierarchical extraction and matching[J]. Instrument Technique and Sensor, 2018, (8): 84- 89
doi: 10.3969/j.issn.1002-1841.2018.08.022
|
|
|
[4] |
郭庆梅, 刘宁波, 王中训, 等. 基于深度学习的目标检测算法综述 [J]. 探测与控制学报, 2023, 45(6): 10-20. GUO Qingmei, LIU Ningbo , WANG Zhongxun, et al. A review of object detection algorithms based on deep learning [J]. Journal of Detection and Control, 2023, 45(6): 10-20.
|
|
|
[5] |
赵景波, 杜保帅 基于深度学习的小目标检测技术发展[J]. 电光与控制, 2023, 30 (2): 63- 70 ZHAO Jingbo, DU Baoshuai Development of small object detection technology based on deep learning[J]. Electronics Optics and Control, 2023, 30 (2): 63- 70
doi: 10.3969/j.issn.1671-637X.2023.02.012
|
|
|
[6] |
谢富, 朱定局 深度学习目标检测方法综述[J]. 计算机系统应用, 2022, 31 (2): 1- 12 XIE Fu, ZHU Dingju A review of deep learning-based object detection methods[J]. Computer Systems and Application, 2022, 31 (2): 1- 12
|
|
|
[7] |
HU B, WANG J H Detection of PCB surface defects with improved faster-RCNN and feature pyramid network[J]. IEEE Access, 2020, (8): 108335- 108345
|
|
|
[8] |
TSAI D-M, CHOU Y-H Fast and precise positioning in PCBs using deep neural network regression[J]. IEEE Transactions on Instrumentation and Measurement, 2019, 69 (7): 4692- 4701
|
|
|
[9] |
ZHANG H, JIANG L, LI C CS-ResNet: cost-sensitive residual convolutional neural network for PCB cosmetic defect detection[J]. Expert Systems with Applications, 2021, 185: 115673
doi: 10.1016/j.eswa.2021.115673
|
|
|
[10] |
张艳, 张明路, 吕晓玲, 等 深度学习小目标检测算法研究综述[J]. 计算机工程与应用, 2022, 58 (15): 1- 17 ZHANG Yan, ZHANG Minglu, LV Xiaoling, et al A review of deep learning-based small object detection algorithms[J]. Computer Engineering and Applications, 2022, 58 (15): 1- 17
doi: 10.3778/j.issn.1002-8331.2112-0176
|
|
|
[11] |
王永利, 曹江涛, 姬晓飞 基于卷积神经网络的PCB缺陷检测与识别算法[J]. 电子测量与仪器学报, 2019, 33 (8): 78- 84 WANG Yongli, CAO Jiangtao, JI Xiaofei PCB defect detection and recognition algorithm based on convolutional neural network[J]. Journal of Electronic Measurement and Instrumentation, 2019, 33 (8): 78- 84
|
|
|
[12] |
苏佳, 贾欣雨, 侯卫民 基于YOLO-J的PCB缺陷检测算法[J]. 计算机集成制造系统, 2024, 30 (11): 3984- 3998 SU Jia, JIA Xinyu, HOU Weimin PCB defect detection algorithm based on YOLO-J[J]. Computer Integrated Manufacturing Systems, 2024, 30 (11): 3984- 3998
|
|
|
[13] |
王淑青, 张子言, 朱文鑫, 等 基于改进YOLOv5的PCB板表面缺陷检测[J]. 仪表技术与传感器, 2023, (5): 106- 111 WANG Shuqing, ZHANG Ziyan, ZHU Wenxin, et al Surface defect detection of PCB based on improved YOLOv5[J]. Instrument Technique and Sensor, 2023, (5): 106- 111
doi: 10.3969/j.issn.1002-1841.2023.05.020
|
|
|
[14] |
WANG X, ZHANG H Y, LIU Q H, et al You-only-look-once multiple-strategy printed circuit board defect detection model[J]. IEEE Multimedia, 2024, 31 (1): 76- 87
|
|
|
[15] |
GEOFFREY S, MAHMOOD A-K. An implementation of the HDBSCAN* clustering algorithm [J], Applied Sciences, 2022, 12(5): 2405.
|
|
|
[16] |
WANG Z, WU L, LI T, et al A smoke detection model based on improved YOLOv5[J]. Mathematics, 2022, 10 (7): 1190
doi: 10.3390/math10071190
|
|
|
[17] |
葛程鹏, 赵东, 王蕊, 等 基于改进DBSCAN和距离共识评估的分段点云去噪方法[J]. 系统仿真学报, 2024, 36 (8): 1800- 1809 GE Chengpeng, ZHAO Dong, WANG Rui, et al A denoising method for segmented point cloud based on improved DBSCAN and distance consensus evaluation[J]. Journal of System Simulation, 2024, 36 (8): 1800- 1809
|
|
|
[18] |
CHIEN-YAO W, YEH IH, HONG-YUAN MARK L. YOLOv9: learning what you want to learn using programmable gradient information [EB/OL]. (2024-02-29) [2024-08-01]. https://doi.org/10.48550/arXiv.2402.13616.
|
|
|
[19] |
HE J J, ZHANG S H, YANG C H, et al. Pest recognition in microstates state: an improvement of YOLOv7 based on spatial and channel reconstruction convolution for feature redundancy and vision transformer with bi-level routing attention [J]. Frontiers in Plant Science, 2024, 15: 1327237.
|
|
|
[20] |
XU X Z, JIANG Y Q, CHEN W H, et al. DAMO-YOLO : a report on real-time object detection design [EB/OL]. (2023-04-24) [2024-08-01]. https://doi.org/10.48550/arXiv.2211.15444.
|
|
|
[21] |
CHEN Z X, HE Z W, LU Z-M DEA-Net: single image dehazing based on detail-enhanced convolution and content-guided attention[J]. IEEE Transactions on Image Processing, 2024, 33: 1002- 1015
doi: 10.1109/TIP.2024.3354108
|
|
|
[22] |
LIU W Z, LU H, FU H T, et al. Learning to upsample by learning to sample [EB/OL]. (2023-08-29) [2024-08-01]. https://doi.org/10.48550/arXiv.2308.15085.
|
|
|
[23] |
CHENG C S, HOU C J, WEN X, et al Small-sample underwater target detection: a joint approach utilizing diffusion and YOLOv7 model[J]. Remote Sensing, 2023, 15 (19): 4772
doi: 10.3390/rs15194772
|
|
|
[24] |
GUO A, SUN K Q, ZHANG Z Y A lightweight YOLOv8 integrating FasterNet for real-time underwater object detection[J]. Journal of Real-Time Image Processing, 2024, 21 (2): 1- 15
|
|
|
[25] |
XIAO G S, HOU S L, ZHOU H Y PCB defect detection algorithm based on CDI-YOLO[J]. Scientific Reports, 2024, 14 (1): 7351
doi: 10.1038/s41598-024-57491-3
|
|
|
[26] |
ZHOU G A, YU L J, SU Y X, et al Lightweight PCB defect detection algorithm based on MSD-YOLO[J]. Cluster Computing, 2023, 27 (3): 3559- 3573
|
|
|
[27] |
YUAN Z H, TANG X Y, NING H, et al LW-YOLO: lightweight deep learning model for fast and precise defect detection in printed circuit boards[J]. Symmetry, 2024, 16 (4): 418
doi: 10.3390/sym16040418
|
|
|
[28] |
TANG J L, LIU S B, ZHAO D X, et al PCB-YOLO: an improved detection algorithm of PCB surface defects based on YOLOv5[J]. Sustainability, 2023, 15 (7): 5963
doi: 10.3390/su15075963
|
|
|
|
Viewed |
|
|
|
Full text
|
|
|
|
|
Abstract
|
|
|
|
|
Cited |
|
|
|
|
|
Shared |
|
|
|
|
|
Discussed |
|
|
|
|