PCB defects have problems such as diversified line designs,small defect areas,and similar characteristics between each defect,lead to defect detection precision is low.In this paper,the purpose of using YOLO-G algorithm for PCB defect detection is to improve defect detection precision.Firstly,based on the YOLOv7 basic model,the SPD Conv module is used to solve the problem of pixel information loss during the pooling process.Secondly,introducing the SimAM module to distinguish important feature information from a three-dimensional perspective,improving the model's perception of different degrees of feature representation.Finally,using BiFPN fusion structure to improve multi-path interactive fusion of low-level details and high-level semantic information,and improve efficient localization and classification of small target positions.The experimental data show that the mean Average Precision(mAP)and recall rates of this algorithm have increased by 8.2% and 5.8% respectively compared to the original algorithm,greatly improving the detection performance and rate of PCB small targets,proving the effectiveness of this algorithm.