Abstract:Aiming at the problems of low detection efficiency and high false detection rate in the current process of crimping defects of wire harness terminals,a wire harness defect detection method based on improved YOLOv7 is proposed.To improve the detection accuracy of the algorithm,the NAM attention mechanism is added to the YOLOv7 backbone network to strengthen the localization and recognition of detection targets.A multi-scale concentrated feature pyramid(CFP)network was constructed at the neck to capture the target information at different scales and deepen the extraction of deep features of the image.Use SIoU Loss to replace CloU Loss to optimize the training model,which improves the regression accuracy of the prediction box while accelerating the model convergence.The experimental results show that the improved YOLOv7 network model has an accuracy rate of 95.8%,a recall rate of 94.5%,and an average accuracy of 97.6%,which is 5.0%,4.8%and 3.3%higher than the original model,respectively,with a model size of 90.5 MB and a detection time of 48 ms,which effectively improves the detection accuracy of the model.Finally, the wire harness terminal crimping defect detection system is designed using the PyQt5 open-source framework,which realizes the automation and visualization of terminal crimping defect detection,improves the defect detection efficiency, and can meet the needs of production enterprises.