Author Login Chief Editor Login Reviewer Login Editor Login Remote Office

Computer Engineering ›› 2024, Vol. 50 ›› Issue (12): 318-328. doi: 10.19678/j.issn.1000-3428.0068588

• Graphics and Image Processing • Previous Articles     Next Articles

PCB Defect Detection Algorithm Based on Improved YOLOv7

ZHANG Xu1,2,3,*(), CHEN Cifa1,3, DONG Fangmin1,3   

  1. 1. College of Computer and Information Technology, China Three Gorges University, Yichang 443002, Hubei, China
    2. Hubei Key Laboratory of Intelligent Vision Based Monitoring for Hydroelectric Engineering, China Three Gorges University, Yichang 443002, Hubei, China
    3. Hubei Province Engineering Technology Research Center for Construction Quality Testing Equipments, China Three Gorges University, Yichang 443002, Hubei, China
  • Received:2023-10-16 Online:2024-12-15 Published:2024-12-29
  • Contact: ZHANG Xu

基于改进YOLOv7的PCB缺陷检测算法

张旭1,2,3,*(), 陈慈发1,3, 董方敏1,3   

  1. 1. 三峡大学计算机与信息学院, 湖北 宜昌 443002
    2. 三峡大学水电工程智能视觉监测湖北省重点实验室, 湖北 宜昌 443002
    3. 三峡大学湖北省建筑质量检测装备工程技术研究中心, 湖北 宜昌 443002
  • 通讯作者: 张旭
  • 基金资助:
    国家自然科学基金新疆联合基金重点项目

Abstract:

Achieving enhanced detection accuracy is a challenging task in the field of PCB defect detection. To address this problem, this study proposes a series of improvement methods based on PCB defect detection. First, a novel attention mechanism, referred to as BiFormer, is introduced. This mechanism uses dual-layer routing to achieve dynamic sparse attention, thereby reducing the amount of computation required. Second, an innovative upsampling operator called CARAFE is employed. This operator combines semantic and content information for upsampling, thereby making the upsampling process more comprehensive and efficient. Finally, a new loss function based on the MPDIoU metric, referred to as the LMPDIoU loss function, is adopted. This loss function effectively addresses unbalanced categories, small targets, and denseness problems, thereby further improving image detection performance. The experimental results reveal that the model achieves a significant improvement in mean Average Precision (mAP) with a score of 93.91%, 13.12 percentage points higher than that of the original model. In terms of recognition accuracy, the new model reached a score of 90.55%, representing an improvement of 8.74 percentage points. These results show that the introduction of the BiFormer attention mechanism, CARAFE upsampling operator, and LMPDIoU loss function effectively improves the accuracy and efficiency of PCB defect detection. Thus, the proposed methods provide valuable references for research in industrial inspection, laying the foundation for future research and applications.

Key words: PCB defect, BiFormer attention mechanism, MPDIoU loss function, upsampling operator CARAFE, target detection

摘要:

在PCB缺陷检测领域中检测精度的提高一直是1个具有挑战性的任务。为了解决这个问题, 提出一系列基于PCB缺陷检测的改进方法。首先, 引入一种新的注意力机制, 即BiFormer注意力机制, 这种机制利用双层路由实现动态的稀疏注意力, 从而减少计算量; 其次, 采用一种创新的上采样算子CARAFE, 能够结合语义信息与内容信息进行上采样, 使得上采样过程更加全面且高效; 最后, 基于MPDIoU度量采用一种新的损失函数, 即LMPDIoU损失函数, 能够有效地处理不平衡类别、小目标和密集性问题, 从而进一步提高图像检测的性能。实验结果表明, 所提改进后的模型在平均精度均值(mAP)方面取得了显著提高, 达到了93.91%, 与原YOLOv5模型相比提高了13.12个百分点, 同时, 在识别精度方面, 所提改进后的模型表现也非常出色, 达到了90.55%, 与原YOLOv5模型相比提高了8.74个百分点。引入BiFormer注意力机制、CARAFE上采样算子以及LMPDIoU损失函数, 对于提高PCB缺陷检测的精度和效率具有非常积极的作用, 为工业检测领域的研究提供了有价值的参考。

关键词: PCB缺陷, BiFormer注意力机制, MPDIoU损失函数, 上采样算子CARAFE, 目标检测