Magnesium alloy materials have broad application prospects in the fields of aerospace, automobile manufacturing, electronic communication, and biomedical treatment. Laser welding is one of the important means of achieving reliable connections between various structural parts made from magnesium alloys. During the laser welding process, the weld surface of the magnesium alloy is prone to spatter, weld bead, undercut, and collapse defects. The defect forms are complex and diverse and have varied sizes. Manual and traditional visual inspections of weld surfaces of magnesium alloys have problems such as low detection efficiency and high rates of missed and false detection, which seriously affect the service performance and life of the structural parts. The application of machine learning for defect detection has proven effective in offering effective solutions to the above problems. Focusing on the problems of reliance on a large amount of labeled data, low-quality pseudo-labels, and class imbalance in fully supervised and semi-supervised learning, the method of active semi-supervised learning for identifying surface defects in the laser welding of magnesium alloy is proposed in this paper by combining semi-supervised learning with active learning. It is expected that this method can effectively identify defects on the premise that a certain level of accuracy can be ensured using limited labeled data, thereby improving the welding quality and reducing the production cost.
The proposed method of active semi-supervised learning incorporates an adaptive dynamic threshold adjustment module (ADTAM) and a sample selection mechanism (SSM). The confidence thresholds are adjusted dynamically, and the pseudo-label generation process based on the characteristics of different defect classes is optimized adaptively by ADTAM. The proposed method also incorporates regression loss from the region proposal network and the region of interest, as well as the intersection over union (IoU) thresholds, to address class imbalance and enhance pseudo-label quality. SSM analyzes the consistency between Teacher and Student model predictions, filtering high-quality pseudo-labels based on IoU and discarding low-confidence labels or incorporating them into the active sampling pipeline for annotation. Additionally, after semi-supervised training, entropy-based active sampling is employed to identify the most informative unlabeled samples for manual annotation. Subsequently, these samples are added to the training set to further enhance model generalization. To validate the effectiveness and universality of the proposed method, experiments are conducted on self-constructed magnesium alloy welding (MAW) and public NEU-DET datasets. The overall and class-specific detection accuracy and convergence of the loss function are included in the evaluations. The specific contributions of the modules are also analyzed by ablation studies.
The MAW and NEU-DET datasets contain 4418 and 1800 images, respectively. The respective numbers of images in the training and test sets were 3534 and 884 for the MAW and 1440 and 360 for the NEU-DET. Based on the ISO 5817—2014 standard, this study defined five defects: undercut, spatter, weld bead, collapse, and others. The average precision AP50 and mean average precision mAP50:95 were adopted as evaluation indicators for the recognition performance of the proposed method.
In the defect recognition experiments, (1) when the labeling ratio is 20%, the overall recognition accuracies of AP50 by the proposed method reach 86.32% and 78.11% for the MAW and NEU-DET datasets, respectively, which is a respective improvement of 11.19 and 10.07 percentage points compared to Faster R-CNN and 5.58 and 4.75 percentage points compared to Active Teacher. The corresponding accuracy values of mAP50:95 by the proposed method for the two datasets improve by 6.39 and 5.88 percentage points compared to Faster R-CNN and by 1.56 and 0.86 percentage points compared to Active Teacher. (2) The single-class recognition accuracies of mAP50:95 by the proposed method using the two datasets are superior to those of other methods. The accuracies for “Collapse” and “Patches” by the proposed method for the MAW and NEU-DET datasets are the highest, with a respective improvement of 7.31 and 11.61 percentage points compared to Faster R-CNN and 1.69 and 0.74 percentage points compared to Active Teacher. (3) The loss values of the proposed method converge to 0.51 and 0.09 for the MAW and NEU-DET datasets, respectively, which is a decrease of 0.12 and 0.09 compared to Unbiased Teacher/Active Teacher and 0.65 and 0.45 compared to Soft Teacher.
In the ablation experiments, (1) the key modules of ADTAM, SSM, and the active sampling strategy play a positive role in improving recognition accuracy. The respective contributions of the modules are 3.01, 2.92, and 2.08 percentage points (AP50) and 0.78, 1.24, and 0.31 percentage points (mAP50:95) for the MAW dataset, and 1.25, 3.46, and 1.73 percentage points (AP50) and 0.28, 0.91, and 0.45 percentage points (mAP50:95) for the NEU-DET dataset. (2) In terms of the hyperparameter settings, the values of AP50 and mAP50:95 first increase and then decrease as the threshold ε and adjustment coefficient η increase, and they reach their optimum values at ε=0.8 and η=0.010.
In the defect visualization experiments, the proposed method can accurately identify tiny defects compared to other methods. It can capture detailed information at different scales, avoid mislabeling in nondefective areas, and ensure a higher recognition accuracy and a lower false detection rate. It also shows potential in defect recognition of complex textures, tiny areas, and edges of the weld surface.
Experiments on defect recognition, ablation, and visualization were performed using the self-constructed MAW and public NEU-DET datasets to evaluate the performance of the proposed method against traditional fully supervised and semi-supervised methods. The experimental results show that for small-sample, multiscale, and complex morphological defects on the surface of magnesium alloy welds, the proposed active semi-supervised learning method significantly reduces the amount of data annotation and achieves varying degrees of improvement in recognition accuracy (AP50 and mAP50:95) compared with other methods. This shows that the proposed method has the ability of effective identification, lower rates of false and missed detection, and better robustness and versatility. The research has important theoretical and engineering application potential for realizing low-cost, high-efficiency, and high-quality welding of magnesium alloy structural parts and for improving their service performance and life.