机械科学与技术2025,Vol.44Issue(1):9-18,10.DOI:10.13433/j.cnki.1003-8728.20240185
改进YOLOv7的PCB缺陷检测算法
An Improved YOLOv7 Algorithm for PCB Defect Detection
摘要
Abstract
In the task of detecting defects on printed circuit boards(PCB),general object detection algorithms always struggle to distinguish target defects from the background,resulting in issues such as low detection accuracy.In order to solve these problems,an improved YOLOv7 model for PCB surface defect detection is proposed.Firstly,the ELAN module is replaced with the transformer-style convolutional network(Conv2Former)module in the backbone extraction network,which preserves spatial information,strengthens global correlations,and effectively reduces the number of parameters.Secondly,to retain more information on small targets,the 20x20 layer is removed,and a 160x160 layer is added.Additionally,the introduction of the similarity-based attention mechanism(SimAM)in the feature fusion network enhances detection accuracy without introducing additional parameters.Finally,the Focal-CIoU Loss function,a combination of Focal Loss and CIoU Loss,optimizes weight allocation for high-quality and low-quality samples,and the detection effectiveness is enhanced.The improved YOLOv7 PCB surface defect detection algorithm achieves a mean average precision(mAP)of 95.3%,a 3.6%boost over the original model,with just 10.97 MB parameters and only a third of the original model.This refined model identifies PCB defects more precisely,significantly reducing leakage and false detections.关键词
PCB表面缺陷检测/YOLOv7/Conv2Former/SimAM/Focal-CIoUKey words
PCB surface defect detection/YOLOv7/Conv2Former/SimAM/Focal-CIoU分类
信息技术与安全科学引用本文复制引用
王玲,向北平,张晓勇..改进YOLOv7的PCB缺陷检测算法[J].机械科学与技术,2025,44(1):9-18,10.基金项目
四川省科技厅重点研发计划(23ZDYF0471) (23ZDYF0471)