School of Electrical Engineering and Automation, Henan Polytechnic University, Jiaozuo 454003, China
Show less
文章历史+
Received
Published
Revised
2025-09-15
2026-08-28
2026-01-22
Online Date
2026-09-04
PDF (19676K)
摘要
针对印刷电路板(printed circuit board, PCB)表面缺陷检测任务中,现有模型难以同时兼顾检测精度、模型体积与推理速度的问题,提出了一种基于增强轻量化YOLO(enhanced lightweight YOLO, ELYOLO)的高精度PCB表面缺陷检测方法。首先,根据GhostNet(ghost network)和解耦全连接注意力机制(decoupled fully-connected attention, DFCA),提出了GLA (ghost long-range attention)模块,在轻量化主干网络(backbone)的同时保持精度;然后,根据线性注意力机制,在主干网络末端设计了MLLA(Mamba-inspired linear attention)模块,精确捕获全局上下文信息;再次,根据GSConv(grouped and shuffled convolution)和特征路径聚合,提出了一种高效颈部网络(neck),在降低计算瓶颈的同时优化了多尺度特征融合的效果。最后,采用UIoU(unified intersection over union)作为边界框回归损失函数,提升了模型的定位精度。实验结果表明:在公开PCB缺陷数据集上,相较于基线模型YOLOv11n,所提的ELYOLO模型在参数量和计算量分别降低了7.4%和17.5%,mAP50和mAP50-95分别提升了3.0和2.3个百分点,同时表现出优异的泛化能力,证明了ELYOLO可有效平衡检测精度、模型体积与推理速度。
Abstract
To address the issue that existing models struggle to simultaneously balance detection accuracy, model volume, and inference speed in printed circuit board (PCB) surface defect detection tasks, a high-precision PCB surface defect detection method based on enhanced lightweight YOLO (ELYOLO) was proposed. Firstly, based on ghost network (GhostNet) and decoupled fully-connected attention (DFCA), a ghost long-range attention (GLA) module was proposed to lighten the backbone network while maintaining accuracy. Then, according to the linear attention mechanism, a Mamba-inspired linear attention (MLLA) module was designed at the end of the backbone network to accurately capture global contextual information. Secondly, based on grouped and shuffled convolution (GSConv) and feature path aggregation, an efficient neck network was proposed, which optimized the effect of multi-scale feature fusion while reducing computational bottlenecks. Finally, unified intersection over union (UIoU) was adopted as the bounding box regression loss function to improve the localization accuracy of the model. Experimental results indicate that on the public PCB defect dataset, compared with the baseline model YOLOv11n, the number of parameters and computational cost of the proposed ELYOLO model are reduced by 7.4% and 17.5%, respectively, while mAP50 and mAP50-95 are increased by 3.0 and 2.3 percentage points, respectively. The model also demonstrates excellent generalization ability, proving that ELYOLO can effectively balance detection accuracy, model volume, and inference speed.
通过先计算KTV,该方法避免了N×N矩阵的显式构造,从而实现了线性复杂度的全局建模。然而,线性注意力因其表达能力不足而性能受限。近期表现优异的Mamba模型虽然具有线性复杂度,但其核心的遗忘门是循环长序列计算,这与视觉检测任务中所使用的GPU(graph process unit)硬件的高度并行化计算方式不兼容,严重影响推理速度。MLLA通过将Mamba的线性计算融合进并行的视觉模型架构中来解决这个问题。
如图6所示,MLLA摒弃了循环长序列计算,转而采用可并行计算的旋转位置编码(rotary position embedding, RoPE)来为模型注入位置感知能力。RoPE通过对查询(query)和键(key)向量进行旋转来嵌入位置信息。对于位于序列位置m的向量,其RoPE变换后的q'm和k'm可分别表示为
HeZ, LianY, WangY, et al. A comprehensive review of research on surface defect detection of PCBs based on machine vision[J]. Results in Engineering, 2025, 27: 106437.
[2]
LiuX. An adaptive defect-aware attention network for accurate PCB-defect detection[J]. IEEE Transactions on Instrumentation and Measurement, 2024, 73: 5040811.
[3]
ZhouW, LiC, YeZ, et al. An efficient tiny defect detection me-thod for PCB with improved YOLO through a compression training strategy[J]. IEEE Transactions on Instrumentation and Measurement, 2024, 73: 2003514.
[4]
XiaoG, HouS, ZhouH. PCB defect detection algorithm based on CDI-YOLO[J]. Scientific Reports, 2024, 14(1): 7351.
[5]
VasanV, SridharanN V, BalasundaramR J, et al. Ensemble-based deep learning model for welding defect detection and classification[J]. Engineering Applications of Artificial Intelligence, 2024, 136: 108961.
[6]
JhaS B, BabiceanuR F. Deep CNN-based visual defect detection: survey of current literature[J]. Computers in Industry, 2023, 148: 103911.
[7]
QiuJ, ShenY, LinJ, et al. An enhanced method for surface defect detection in workpieces based on improved MobileNetV2-SSD[J]. Expert Systems, 2025, 42(1): e13567.
[8]
WuX, DuanJ, YangL, et al. Intelligent cotter pins defect detection for electrified railway based on improved faster R-CNN and dilated convolution[J]. Computers in Industry, 2024, 162: 104146.
MaimaitiTuerxun, QiuJianzhuo, LiuJian, et al. Road crack detection algorithm based on improved YOLOv8n[J]. Science Technology and Engineering, 2025, 25(14): 6044-6053.
[11]
ChenW, HuangZ, MuQ, et al. PCB defect detection method based on Transformer-YOLO[J]. IEEE Access, 2022, 10: 129480-129489.
ZhangSenyi, ZhangXuesong, GuoJiaqi, et al. Dense scene pedestrian detection algorithm based on Swin Transformer improved YOLO[J]. Science Technology and Engineering, 2025, 25(21): 9018-9027.
[14]
WeiZ, YangF, ZhongK, et al. PCB-YOLO: Enhancing PCB surface defect detection with coordinate attention and multi-scale feature fusion[J]. PLoS One, 2025, 20(6): e0323684.
[15]
PeiH, ZhangC, ZhangX, et al. Recognizing materials in cultural relic images using computer vision and attention mechanism[J]. Expert Systems with Applications, 2024, 239: 122399.
YangYongyue, XiaYuanchao. Accuracy improvement of deep learning algorithm for PCB defect detection[J]. Journal of Electronic Measurement and Instrumentation, 2023, 37(5): 11-19.
WangLongye, HuangJun, ZengXiaoli. Bare board defect detection of PCB based on YOLO-PCB[J]. Science Technology and Engineering, 2024, 24(15): 6338-6345.
ChangGaoyu, ZhaoShunxiang, HouShuyu, et al. UAV aerial photography small target detection algorithm based on improved YOLOv8n[J]. Science Technology and Engineering, 2025, 25(31): 13500-13508.
ChengQing, YanHengzhi, LiYandong. Lightweight detection method of small UAVs on improved YOLOv8n[J]. Science Technology and Engineering, 2025, 25(28): 12098-12107.
[26]
DuZ, XuX, BaiZ, et al. Feature fusion strategy and improved GhostNet for accurate recognition of fish feeding behavior[J]. Computers and Electronics in Agriculture, 2023, 214: 108310.
[27]
LiY, YaoT, PanY, et al. Contextual transformer networks for visual recognition[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2023, 45(2): 1489-1500.
[28]
HeX, CaoK, ZhangJ, et al. Pan-Mamba: effective Pan-sharpening with state space model[J]. Information Fusion, 2025, 115: 102779.
[29]
LiH, LiJ, WeiH, et al. Slim-neck by GSConv: a lightweight-design for real-time detector architectures[J]. Journal of Real-Time Image Processing, 2024, 21(3): 62.
[30]
KangM, TingC, TingF, et al. ASF-YOLO: a novel YOLOmodel with attentional scale sequence fusion for cell instance segmentation[J]. Image and Vision Computing, 2024, 147: 105057.