• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

计算机工程与科学 ›› 2025, Vol. 47 ›› Issue (02): 276-287.

• 图形与图像 • 上一篇    下一篇

PCB表面缺陷数据集与基于YOLOv5s-P6SE的检测

梁泰然1,蒋诗新2,3,李泉洲2,3,欧阳斌1,吕盛坪1   

  1. (1.华南农业大学工程学院,广东  广州 510642;
    2.中国赛宝实验室(工业和信息化部电子第五研究所),广东 广州 511370;
    3.工业装备质量大数据工业和信息化部重点实验室,广东  广州 511370)

  • 收稿日期:2023-10-07 修回日期:2023-12-27 接受日期:2025-02-25 出版日期:2025-02-25 发布日期:2025-02-24
  • 基金资助:
    广东省自然科学基金(2021A1515012395)

PCB surface defect dataset and detection based on YOLOv5s-P6SE

LIANG Tairan1,JIANG Shixin2,3,LI Quanzhou2,3,OUYANG Bin1,Lv Shengping1   

  1. (1.College of Engineering,South China Agricultural University,Guangzhou 510642;
    2.CEPREI,Guangzhou 511370;
    3.Key Laboratory of Industrial Equipment Quality Big Data,Guangzhou 511370,China)
  • Received:2023-10-07 Revised:2023-12-27 Accepted:2025-02-25 Online:2025-02-25 Published:2025-02-24

摘要: 针对PCB生产中表面缺陷检测的需求,结合车间实际制定一个包含11种类别的缺陷分类标准,采集真实PCB表面缺陷图像,最终构建一个包含3 239幅图像4 672个缺陷目标的数据集Dataset_PCBSD。基于YOLOv5s改进得到一种新的PCB表面缺陷检测模型YOLOv5s-P6SE。为提高检测精度,在YOLOv5s中增加用于检测特大目标的P6检测层,引入了SE注意力模块和柔性非极大抑制后处理。实验结果显示,相较于基准模型YOLOv5s,YOLOv5s-P6SE在均值平均精度上提升了5.5%。同时,YOLOv5s-P6SE在mAP和模型大小上均优于Faster R-CNN、SSD、PCB缺陷检测模型YOLOv4-MN3以及DETR模型RT-DETR-L,且在平衡mAP和模型大小方面优于YOLOv8s。

关键词: 印制电路板, 表面缺陷检测, YOLOv5s-P6SE, SE注意力模块, 柔性非极大抑制

Abstract: To address the demand for surface defect detection in PCB production, a defect classification standard encompassing 11 categories was established based on actual workshop conditions, images of real PCB surface defects were collected, and finally a dataset named Dataset_PCBSD was constructed, containing 3 239 images with 4 672 defective objects. A new PCB surface defect detection model, YOLOv5s-P6SE, was developed based on improvements to YOLOv5s. To enhance detection accuracy, a P6 detection layer for detecting extremely large objects was added to YOLOv5s, along with the introduction of the SE attention module and soft non-maximum suppression post-processing. Experimental results show that YOLOv5s-P6SE achieves a 5.5% improvement in mean average precision (mAP) compared to the baseline model YOLOv5s. Additionally, YOLOv5s-P6SE outperforms Faster R-CNN, SSD, the PCB defect detection model YOLOv4-MN3, and the DETR model RT-DETR-L in terms of both mAP and model size. It also excels in balancing mAP and model size compared to YOLOv8s. 

Key words: printed circuit board, surface defect detection, YOLOv5s-P6SE, SE attention module, soft non-maximum suppression