Lightweight PCB Defect Detection Based on Improved YOLOv5
A lightweight PCB defect detection improvement algorithm based on EfficientFormerV2-YOLOv5 is proposed to address the issues of low accuracy and large model size in existing PCB defect de-tection methods.The algorithm first uses the EfficientFormerV2 algorithm to replace the backbone net-work in YOLOv5 to achieve the lightweight of the YOLOv5 algorithm.Secondly,while introducing a four head detection mechanism in the Neak network,the Kmeans++algorithm is used to adaptively calculate suitable anchor boxes to improve the detection accuracy of small targets.Then,the EMA attention mecha-nism is introduced into the backbone network and the CoordConv network is introduced to replace the Conv network in the Neak networ to further improve the detection accuracy of the network for small targets.Fi-nally,the SIoU loss function is used to accelerate the convergence speed of the network model.The experi-mental results show that the improved YOLOv5 algorithm model reduces the computational complexity to 8.9 GFLOPs,achieves an average precision value(mAP)of 96.1%,reduces the model size is reduced by 3.006 M,and reduces the computational complexity by 6.9 G.It meets the real-time requirements for PCB defect detection in industry.