摘要
焊接缺陷检测是确保焊接质量的重要环节,智能视觉检测技术已成为焊缝缺陷识别的主要发展方向。针对焊缝缺陷图像样本稀缺、数据不均衡,以及现有深度学习模型复杂度高、难以实现实时高精度检测,特别是对小特征识别困难等问题,本文提出了一种基于YOLOv8改进的YOLO-DEFW模型。三项改进措施为:用分布移位卷积(DSConv)替代YOLOv8中的传统卷积,以减少参数量和复杂度,提高效率;引入高效多尺度注意力(EMA)机制,增强模型对不同尺度焊缝缺陷,尤其是对小特征的识别能力;采用Focal Loss和加权交叉熵构成的FWCE Loss组合损失函数,通过调整Focal Loss与加权交叉熵的权重来提升模型对不均衡样本的检测精度。在实验中,通过25种数据增强技术扩展ROBOT_(W)ELD数据集,以提高模型的泛化性能。实验结果显示:与YOLOv8相比,改进的YOLO-DEFW模型在ROBOT_(W)ELD测试集上的精确率、召回率和平均精度分别提升了13.4%、17%和24.8%,模型参数量减少了13.5%,GFLOPs降低了10%,对小特征的识别精度提高了12%;后者处理单张图像的时间为3.9 ms。上述改进使模型实现了对焊缝缺陷的实时、精确检测,适用于智能视觉在线检测系统。
Objective Defects such as cracks,porosity,pits,undercuts,and slag inclusions commonly occur in laser welding and gasshielded 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 realtime 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 YOLODEFW,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 realtime detection tasks online.Methods In the experiment,the ROBOT_WELD weld defect dataset was compiled and used as the training set for the YOLODEFW model.First,images were captured by the MVHS2000GC 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 YOLODEFW 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 model's ability to recognize weld defects in features of varying sizes;and the composite loss function FWCE Loss was added to the loss.py file,where the weight parameters were adjusted for Focal Loss and Weighted Cross Entropy(WCE)Loss to improve accuracy in detecting smallsample weld defects.Results and Discussions The development of the ROBOT_WELD dataset and data augmentation effectively increased the size of the dataset to 11960 images,thereby enhancing the model’s generalizability.By running ablation experiments with common convolution modules,DSConv2D was identified to be the most effective module for reducing the parameter count,where the lowest parameter count was 32 and lowest GFLOPs was 0.0003(see Table 3).Different attention mechanisms were also introduced to improve the recognition of small features,and EMA module yielded the best overall performance(see Table 4).Additionally,introducing the customized FWCE Loss improved the detection accuracy for smallsample defects.The improvements to YOLOv8 resulted in a 13.4%increase in precision,a 17%increase in recall,and a 24.8%increase in mean average precision(mAP)on the ROBOT_WELD test set.Model complexity was also reduced:the number of parameters was reduced by 13.5%,GFLOPs were reduced by 10%,and the single image processing time was 3.9 ms,which resulted in a 12%increase in the accuracy of smallfeature recognition.The improved YOLODEFW model outperformed the YOLOv8 model on key performance metrics.Conclusions This study expanded the original dataset using 25 data augmentation techniques,which increased the size of the dataset by 25-fold and effectively enhanced the robustness and generalizability of the model.The proposed YOLODEFW model utilizes DSConv2D instead of Conv in YOLOv8,significantly reducing its parameter count and computational load.The introduction of an EMA module effectively captures features at varying scales within the images,thereby significantly improving the accuracy of the model in detecting small features.Furthermore,the model incorporates a composite loss function(FWCE Loss)and adjusts the weight parameters of Focal Loss and WCE to effectively improve its detection on minority categories and imbalanced samples.The YOLODEFW model achieves notable optimization in terms of parameter count,model complexity,and detection accuracy;in the present study,the primary evaluation metrics improved by more than 10%.This algorithm can be integrated into the vision sensors of intelligent welding robots and used for realtime defect detection online,in lowarcnoise welding processes,and in higharcnoise postweld inspections,which will pave the way for advances in intelligent welding inspection technology.
作者
岳剑峰
李伟明
宁黎华
高兴宇
李煜
王文龙
阳柏晴
刘亚尼
Yue Jianfeng;Li Weiming;Ning Lihua;Gao Xingyu;Li Yu;Wang Wenlong;Yang Baiqing;Liu Yani(School of Mechanical and Electrical Engineering,Guilin University of Electronic Technology,Guilin 541004,Guangxi,China;School of Mathematics and Computing Science,Guilin University of Electronic Technology,Guilin 541004,Guangxi,China;School of Artificial Intelligence,Guangxi University for Nationalities,Nanning 530006,Guangxi,China)
出处
《中国激光》
北大核心
2025年第8期56-68,共13页
Chinese Journal of Lasers
基金
广西创新驱动发展专项基金(桂科AA18118002-3)
南宁市科技重大专项(20231034)
桂林电子科技大学研究生教育创新项目(2023YCXB03)。
关键词
深度学习
数据增强
注意力机制
组合损失函数
缺陷检测
deep learning
data augmentation
attention mechanism
composite loss function
defect detection