针对PCB瑕疵检测问题,提出了基于YOLOv5s的轻量化PCB瑕疵检测算法,并基于树莓派平台搭建了一套PCB瑕疵自动检测系统。首先,在Backbone阶段使用改进的空间金字塔池化代替原有的C3网络;其次,在Backbone与Neck中引入残差结构,并在小目标检测层面加入CBAM注意力机制;最后,将所提轻量化算法部署到树莓派上,并使用NCS2套件进行辅助加速,通过摄像头进行自动检测。通过测试,所提算法检测PCB瑕疵mAP达到99.1%,与原YOLOv5s模型相比,Params为其23%,FLOPs为其21%,PCB瑕疵检测系统运行速度达到7 fps,满足自动检测要求。
Abstract
Aiming at the problem of PCB defect detection,a lightweight PCB defect detection algorithm based on YOLOv5s is proposed and builds an automatic PCB defect detection system based on the Raspberry Pi platform.Firstly,a modified spatial pyramid pooling is used in the Backbone stage instead of the original C3 network.Secondly,a residual structure is introduced in Backbone and Neck,and a CBAM attention mechanism is added at the small target detection level.Finally,the proposed lightweight algorithm is deployed on Raspberry Pi with the NCS2 suite for auxiliary acceleration,and automatic detection is performed through the camera.Through testing,the proposed algorithm achieves 99.1% mAP for PCB defect detection,23% for Params and 21% for FLOPs compared to the original YOLOv5s model,and the PCB defect detection system runs at 7 fps,meeting the automatic detection requirements.
关键词
树莓派 /
YOLOv5s /
印制电路板瑕疵
Key words
Raspberry Pi /
YOLOv5s /
PCB defect detection
{{custom_sec.title}}
{{custom_sec.title}}
{{custom_sec.content}}
参考文献
[1] DAIWT,MUJEEB A,ERDT M,et al.Soldering defect detection in automatic optical inspection[J].Advanced Engineering Informatics,2020(43):101004.
[2] Lin Y L,Chiang Y M,Hsu H C.Capacitor Detection in PCB Using YOLO Algorithm[C]//2018 International Conference on System Science and Engineering (ICSSE),2018.
[3] 贾涛,周利莉,陈健,等.基于卷积神经网络的PCB CT 图像中的过孔和焊盘检测算法[J].计算机应用研究,2018,35(2):637-640.
[4] RAY S,MUKHERJEE J.A hybrid approach for detection and classification of the defects on printed circuit board[J].International Journal of Computer Applications,2015,121(12):42-48.
[5] MOGANTI MADHAV,ERCAL FIKRET,DAGLICIHANH,et al.Automatic PCB inspection algorithms:a survey[J].Computer Vision and Pattern Recognition,1996,63(2):287-313.
[6] REN S,HE K,GIRSHICKR,et al.Faster R-CNN:towards real time object detection with region proposal networks[J].IEEE Transactions on Pattern Analysis and Machine Intelligence,2017,39(6):1137-1149.
[7] REDMON J,DIVVALA SANTOSH,GIRSHICK R,et al.You only look once: unified,real-time object detection[C]//IEEE Conference on Computer Vision and Pattern Recognition,Las Vegas,Nevada,2016:779-788.
[8] REDMON J, FARHADI A.YOLO9000:better,faster,stronger[C]//IEEE Conference on Computer Vision and Pattern Re cognition, Honolulu,Hawaii,USA,2017:6517-6525.
[9] REDMON J,FARHADI A.YOLOv3:an incremental improvement[EB/OL].ar Xiv:1804.02767v1.2018.
[10] lenn Jocher.YOLOv5:The Leader in Realtime Object Detection[EB/OL].[2022-09].https://github.com/ultralytics/yolov5.
[11] Liu W,Anguelov D,Erhan D.SSD:Single Shot multibox detector[C]//Proc of the European conference on computer vision.Berlin,Germany:Springer,Cham,2016,31(10):21-37.
基金
*烟台市 2021年校地融合发展项目(1521001-WL21JY01);2022 年河南省科技攻关项目(222102220048)。