Defect detection and identification in welding images is key to industrial process control and quality control. To overcome the limitations of existing welding image defect detection methods, the single-stage object detection model YOLOv5 is used to detect defects. The experimental results show that by using the augmented data set to train the object detector, and optimizing the hyperparameters of the network, can significantly improve the accuracy and precision of the object detector. Its accuracy and recall can reach 97.92% and 96.91% respectively, and its F1-score and mAP can reach 97.41% and 97.11% respectively. The experimental results prove the feasibility and effectiveness of the method in this paper. The algorithm can detect and locate welding images and has high application value in improving the production efficiency of the industrial manufacturing industry.