关键词:
attention mechanism
composite loss function
data augmentation
deep learning
defect detection
摘要:
Objective Defects such as cracks, porosity, pits, undercuts, and slag inclusions commonly occur in laser welding and gas-shielded welding processes. However, imaging these defects poses a challenge, which has led to a scarcity of samples and an imbalance in the frequencies of different types of defects. Recent deep learning algorithms often have high complexity, a large number of parameters, and high consumption of computational resources. To address these challenges, this study aims to solve problems such as the scarcity of defect images, any imbalance in the data that affects detection accuracy, high model complexity that hinders real-time detection, and difficulty with the recognition of small features. Data augmentation techniques were applied to the dataset to increase the amount of data and balance the sample defect types. Simultaneously, an improved YOLOv8 model, named YOLO-DEFW, was proposed to reduce the number of parameters needed, increase detection speed, and improve detection accuracy for small defects and those for which there were only a few samples, which enables the intelligent visual inspection system for welds to perform real-time detection tasks online. Methods In the experiment, the ROBOT_WELD weld defect dataset was compiled and used as the training set for the YOLO-DEFW model. First, images were captured by the MV-HS2000GC camera mounted on a robotic arm, and additional samples were sourced from public datasets. Subsequently, the dataset was increased in size from 460 to 11960 images using 25 techniques for image augmentation. The optimized YOLO-DEFW model was characterized by the following improvements: DSConv2D was used in place of the standard convolution layers (Conv) at layers 0, 1, 3, 5, 7, 17, and 21, and C2f_DSConv2D was used to replace C2f at layers 2, 4, 6, 8, 12, 15, 19, and 23, which reduced the number of model parameters;EMA module was introduced into layers 16, 20, and 24 to enhance the