Research on PCB defect detection algorithm based on YOLOv5-TGs
A PCB defect detection algorithm YOLOv5-TGs based on improved YOLOv5s is proposed to address the low detection accuracy of current PCB defect detection algorithms in practical applications.This algorithm is based on the YOLOv5s algorithm model.Firstly,the Swin Transformer structure is introduced into the backbone network,replacing the bottleneck module in the C3 module.The Ghost Conv module is used to replace the Conv module,reducing the computational complexity of the model and achieving lightweight.At the same time,the receiver domain is increased to enhance the feature expression ability of small targets with PCB defects.Secondly,a global attention mechanism is added after the C3 structure of the Neck network to preserve channel and spatial information to a greater extent,amplifying global cross latitude interactive features while reducing feature information dispersion and improving detection efficiency.Finally,the SIoU loss function is used to replace the original CIoU loss function.By introducing directionality into the cost of the loss function,the convergence speed of the model is accelerated and the regression accuracy is improved.The experiment in this article used a PCB defect dataset publicly released by the Peking University laboratory,and the results showed that the improved algorithm achieved an average accuracy mean(mAP)of 98.2% and an accuracy rate of 95.5% .Compared to YOLOv5s,mAP has improved by 7.3% and accuracy by 7.5% .
PCB defect detectionYOLOv5s algorithmGhost convSwin Transformer structureglobal attention mechanismSIoU loss