首页|ViT和注意力融合的类别不均衡PCB缺陷检测方法

ViT和注意力融合的类别不均衡PCB缺陷检测方法

扫码查看
针对实际环境下印刷电路板(PCB)缺陷样本难以收集造成的数据长尾分布和检测精度低以及ViT用于检测时计算复杂度高等问题,提出多尺度ViT特征提取和注意力特征融合的端到端PCB缺陷检测算法.首先结合ViT和部分卷积构建多尺度特征提取网络,利用层级多头注意力对不同尺度的特征图执行自适应的注意力操作,使网络能够更好地捕捉局部和全局信息进而增强其特征提取能力,部分卷积可以降低计算开销.其次,基于能量空域抑制的无参数注意力机制将多尺度特征有效融合,提升网络融合特征图的表达能力.最后,引入对类别不均衡敏感的分类函数对网络的损失函数进行改进,增强网络对类别不平衡数据的拟合程度,提高网络的泛化能力.在 3 种不同类型的公开PCB数据集上的实验结果表明,所提出的检测算法在PCB表面缺陷数据集的平均精度均值(mAP)均有提升,分别为 99.13%、98.67%,99.82%;在类别不均衡的PCB缺陷检测任务上,相较于改进前方法,mAP提升了 11.94%,网络检测速度达到 25 FPS,为PCB缺陷的检测提供了一种快速、有效的方法.
ViT and attention fusion for class-imbalanced PCB defect detection
Addressing the challenges of a long-tailed distribution of data and low detection accuracy caused by the difficulty in collecting defect samples for printed circuit boards(PCBs)in real-world environments,as well as the high computational complexity when using Vision Transformer(ViT)for detection,we propose an end-to-end PCB defect detection algorithm that incorporates multi-scale ViT feature extraction and attention feature fusion.Firstly,a multi-scale feature extraction network is constructed by combining ViT and partial convolution.Hierarchical multi-head attention is employed to perform adaptive attention operations on different scales of feature maps,enabling the network to better capture local and global information,thereby enhancing its feature extraction capabilities.Partial convolution is utilized to reduce computational costs.Secondly,a non-parametric attention mechanism based on the energy domain suppression effectively fuses multi-scale features,enhancing the expressive power of the network's fused feature maps.Finally,a classification function sensitive to class imbalance is introduced to improve the loss function of the network,enhancing its fitting ability to imbalanced data and improving generalization.The experimental results on three different types of publicly available PCB datasets indicate that the proposed detection algorithm shows improvement in the mean Average Precision(mAP)for PCB surface defect datasets,with respective values of 99.13%,98.67%,and 99.82% .In the case of class-imbalanced PCB defect detection tasks,the mAP is improved by 11.94% compared to the previous method,and the network achieves a detection speed of 25 FPS,providing a fast and effective approach for PCB defect detection.

defect detectionprinted circuit boardsvision transformerattention mechanismmulti-scale feature extraction

陈俊英、李朝阳、席月芸、刘冲

展开 >

西安建筑科技大学信息与控制工程学院 西安 710055

缺陷检测 印刷电路板 Vision Transformer 注意力机制 多尺度特征提取

国家自然科学基金陕西省自然科学基础研究计划

621033162023-JC-YB-562

2024

仪器仪表学报
中国仪器仪表学会

仪器仪表学报

CSTPCD北大核心
影响因子:2.372
ISSN:0254-3087
年,卷(期):2024.45(4)