基于树莓派和 YOLOv5 的 PCB 瑕疵检测*

贺鹏飞, 刘志航, 王菲菲, 徐康, 聂荣

集成电路与嵌入式系统 ›› 2023, Vol. 23 ›› Issue (2) : 45-48.

PDF(1340 KB)
PDF(1340 KB)
集成电路与嵌入式系统 ›› 2023, Vol. 23 ›› Issue (2) : 45-48.
技术纵横

基于树莓派和 YOLOv5 的 PCB 瑕疵检测*

  • 贺鹏飞1, 刘志航1, 王菲菲1, 徐康2, 聂荣3
作者信息 +

PCB Defect Detection Based on Raspberry Pi and YOLOv5

  • He Pengfei1, Liu Zhihang1, Wang Feifei1, Xu Kang2, Nie Rong3
Author information +
文章历史 +

摘要

针对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

引用本文

导出引用
贺鹏飞, 刘志航, 王菲菲, 徐康, 聂荣. 基于树莓派和 YOLOv5 的 PCB 瑕疵检测*[J]. 集成电路与嵌入式系统. 2023, 23(2): 45-48
He Pengfei, Liu Zhihang, Wang Feifei, Xu Kang, Nie Rong. PCB Defect Detection Based on Raspberry Pi and YOLOv5[J]. Integrated Circuits and Embedded Systems. 2023, 23(2): 45-48
中图分类号: TP391.4   

参考文献

[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)。

PDF(1340 KB)

Accesses

Citation

Detail

段落导航
相关文章

/