计算机工程与应用 ›› 2025, Vol. 61 ›› Issue (17): 102-111.DOI: 10.3778/j.issn.1002-8331.2503-0054

• 目标检测专题 • 上一篇    下一篇

YOLOv11-MAS:一种高效的PCB缺陷检测算法

殷旭鹏,赵兴强   

  1. 1.南京信息工程大学 自动化学院,南京 210044
    2.南京信息工程大学 江苏省大数据分析技术重点实验室,南京 210044
  • 出版日期:2025-09-01 发布日期:2025-09-01

YOLOv11-MAS: Efficient PCB Defect Detection Algorithm

YIN Xupeng, ZHAO Xingqiang   

  1. 1.School of Automation, Nanjing University of Information Science & Technology, Nanjing 210044, China
    2.Jiangsu Key Laboratory of Big Data Analysis Technology, Nanjing University of Information Science & Technology, Nanjing 210044, China
  • Online:2025-09-01 Published:2025-09-01

摘要: 随着电子设备对印刷电路板(printed circuit board,PCB)的要求越来越高,在PCB加工过程中的缺陷检测工作也愈发重要,但由于缺陷特征目标小、类别复杂且难以区分,传统检测方法在精度和鲁棒性方面存在局限。为此,对最新的YOLOv11版本改进,形成了PCB缺陷检测模型——YOLOv11-MAS。在骨干网络部分设计并嵌入中值增强空间通道注意力模块(median-enhanced channel and spatial attention block,MECS),以中值增强与深度卷积的方式扩大感受野,提高对PCB电路板特殊缺陷的识别能力。在颈部网络部分,采用自适应分层特征融合网络(adaptive hierarchical feature integration network,AHFIN),通过自适应加权融合多尺度特征,以增强对主干网络信息的利用,使模型能够精准关注关键缺陷区域。此外,将YOLOv11的损失函数替换为滑动对齐损失函数(slide alignment loss,SAL),通过优化边界框的界定,提高对复杂缺陷类型的检测能力。实验结果表明,YOLOv11-MAS模型在PCB缺陷数据集中的多个指标均表现优异,mAP值达到93.1%,较YOLOv11提升了7.8个百分点,同时在NVIDIA Jetson Xavier嵌入式设备上的检测帧率达49.6帧/s,能满足工业实时检测需求。

关键词: 缺陷检测, 小目标检测, YOLOv11, 注意力机制, 损失函数

Abstract: PCB defect detection is crucial in electronic engineering. However, traditional detection methods face limitations in accuracy and robustness due to the small size, complex categories, and indistinguishability of defect features. To address these challenges, this paper proposes an improved YOLOv11-based PCB defect detection model: YOLOv11-MAS. The model incorporates a median-enhanced channel and spatial attention block (MECS) in the backbone to enhance defect feature extraction through an improved attention mechanism. Median enhancement and depth wise convolution are employed to expand the receptive field and improve the recognition of various special defects on PCBs. In the neck part, an adaptive hierarchical feature integration network (AHFIN) is introduced to adaptively weight and fuse multi-scale features, thereby enhancing the utilization of information from the backbone and enabling the model to focus precisely on key defect areas. Additionally, the CIoU loss function of YOLOv11 is replaced with a slide alignment loss (SAL) function. By optimizing bounding box definition and considering center deviation, size ratio, and angle differences, SAL introduces adaptive weights for difficult and easy samples to accurately regress target boxes and improve detection capabilities for complex defect types. Experimental results demonstrate that the YOLOv11-MAS model achieves excellent performance on multiple PCB defect datasets, with an mAP of 93.1%, a 7.8 percentage points improvement over YOLOv11, and a detection speed of 49. 6 frames per second on the NVIDIA Jetson Xavier, which meets the requirements for real-time detection.

Key words: defect detection, small target detection, YOLOv11, attention mechanism, loss function