| In recent years,with the increasing complexity and diversification of electronic product needs,the development direction of PCB design is also becoming more and more miniaturized,high-density,and as the key material connecting electronic devices,PCB surface defects may lead to functional failure of electronic devices,increased energy consumption and other problems,and even produce safety hazards,therefore,in today’s batch automated production of industrial environment,PCB surface defects must be detected to ensure product quality and reduce economic losses.YOLOv5 compared to the two-stage network for faster inference and YOLO series of algorithms have been iteratively optimized for many times,this paper improves on this model to ensure that the algorithm model to maintain lightweight while improving the accuracy of defect detection.YOLOv5 original model uses the COCO data set,which is more advantageous in detecting large targets,while the PCB defect targets are small and variety,more difficult to distinguish,and more interference factors in the actual industrial production environment,resulting in unsatisfactory PCB defect detection accuracy,in order to better achieve the detection of PCB defects on small targets,this paper has carried out the following work.(1)The RS-YOLOv5 algorithm is proposed,which has the following innovations compared to YOLOv5.a.Firstly,the Res2RepVNet model is constructed based on the Res2Net network,which incorporates the RepVGG network and reduces the number of model parameters by using the structural reparameterization technique to speed up the inference.Secondly,the Res2RepVNet model is introduced into the Backbone module and Neck module of the backbone network of YOLOv5 to enhance the model’s ability to characterize multi-scale features.b.The SPPSMALL module is constructed based on SPPF,which replaces the maximum pooling of three tandem 5×5 with the maximum pooling of 5×5,3×3 3×3,and 5×5.By improving the pooling space,the feature extraction of PCB small target defects is enhanced,and the scale of the feature maps output by the Backbone and Neck modules is The scale of the feature maps output from Backbone and Neck modules is adjusted to further obtain more feature information of small targets.c.The replacement attention mechanism(Shuffle Attention)is introduced in the Neck module to overcome the interference of redundant information in the target detection process and reduce the false detection rate and missed detection rate of the network.d.EIoU_Loss is chosen as the loss function of the bounding box,which is different from the CIOU loss function in the original YOLOv5 that calculates the width-to-height aspect ratio of the bounding box.EIoU_Loss directly minimizes the height and width differences between the real box and the predicted box respectively,which improves the regression accuracy of the model and accelerates the convergence speed.Experimentally,RS-YOLOv5 has improved mAP by 13.7%,reduced model size by 10.87 MB,and reduced the number of parameters by about 90.6%compared to YOLOv5;compared to YOLOv3 has improved mAP by 26.3%,reduced model size by 120.57 MB,and reduced the number of parameters by about 98.9%;compared to YOLOv7,the mAP improved by 3.2%,the model decreased by 68.37 MB,and the number of parameters decreased by about 98.2%based on YOLOv7.(2)Implemented PCB defect detection management systemIn order to enhance the application value of RS-YOLOv5 algorithm,this paper analysis,designs and implements a PCB defect detection management system with front and back-end separation based on React and NodeJS,and deploys RS-YOLOv5 algorithm using Flask.The system can be divided into four functional modules according to function:defect detection,defect record management,report management,and user rights management.After testing,the system can better meet the needs of users in daily industrial production environment. |