Abstract:Aiming at the problems of small, diverse and inconspicuous features of existing printed circuit board defects, a defect detection algorithm based on ARS-YOLOv9s is proposed, which is optimised on the basis of YOLOv9s network architecture. To address the problem of information loss in multi-scale feature fusion in the original algorithm, AFPN is integrated into the image feature fusion so as to enrich the semantic information; by introducing the iRMB attention mechanism in the backbone network, the attention to the tiny defects in the shallow features is improved; to address the problem of the small target defects, the large target detection layer is deleted and a new tiny target detection layer is added, which lightens the model and improves the detection accuracy; the original model loss function is replaced by the loss function, and the original model loss function is replaced by the loss function, and the original model loss function is replaced by the loss function. The original model loss function is replaced by Shape-IoU to improve the impact of positive and negative sample imbalance on the model and accelerate model convergence. The experimental results show that the mAP of this paper′s algorithm is 98%, and that of mAP@0.5:0.95 is 68.2%, which is 2.8% and 9.3% higher than that of the original YOLOv9s, respectively, and the mAP of defects of each category is significantly improved, which proves the effectiveness of this paper′s algorithm.