X-ray weld defect detection method based on improved YOLOv8
By improving the backbone and neck structure of the YOLOv8 model and optimizing it with the WIoU loss function, the problems of large number of parameters and slow detection speed of the YOLOv8 model were solved, and real-time and high-precision weld defect detection was achieved.
Patent Information
- Application Number
- CN202411050957.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2024-11-22
AI Technical Summary
The existing YOLOv8 model has problems in weld defect detection, such as large number of parameters, high computational resource consumption, slow detection speed, inability to meet real-time requirements, and poor detection effect for small or irregular defects.
An improved EMA_Mul attention module was introduced into the backbone of the YOLOv8 model, the original SPPF module was replaced with the SimSPPF_Avg module, the DualConv module was introduced into the neck, and the CIoU loss function was replaced with the WIoU loss function to construct a lightweight C2f_DualConv module for model training and optimization.
The model improves its ability to detect weld defects of different sizes, reduces background information interference, lowers the number of parameters and computational load, improves detection accuracy, meets real-time requirements, and is suitable for deployment on industrial equipment with limited resources.
Smart Images

Figure CN119006393A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to target detection technology in deep learning, and in particular to an X-ray weld defect detection method based on improved YOLOv8. Background Art
[0002] Welding technology is widely used in modern industry, is very important for modern industrial production, and occupies an important strategic position in the domestic manufacturing industry. During the welding process, defects such as cracks, slag inclusions, lack of fusion, lack of penetration, and pores may occur. These defects will affect industrial production and may even cause safety accidents. Therefore, defect detection must be performed after welding is completed. Defect detection can identify various defects caused by welding, and by accurately detecting these defects, repair measures can be taken. Timely defect detection and repair not only helps to reduce production costs and provide protection for the industrial production process, but also reduces accidents and failures caused by welding defects.
[0003] At present, X-ray detection is usually used for internal defects of welds because its imaging is simple and does not damage the workpiece. Operators judge whether the product has defects by observing X-ray images. In order to ensure the zero-defect quality of the product, X-ray images of all welds and heat-affected zones need to be evaluated. With the application of new welding technology and the improvement of welding process and welding equipment, the internal defect rate of welds has gradually decreased. However, in the manual evaluation process, most of the time is spent on viewing defect-free images, resulting in high labor intensity and low efficiency for operators.
[0004] Therefore, there is an urgent need for computer-aided technology to intelligently detect X-ray images of large quantities of welds and assist manual re-evaluation and re-inspection to improve detection efficiency, reduce workload, and achieve standardization and consistency of defect assessment results. With the rise of artificial intelligence, deep learning has been widely used in the field of industrial weld defect detection. At present, the defect detection algorithms based on deep learning can be generally divided into two categories in terms of structure: two-stage algorithms include Faster R-CNN, etc., and one-stage algorithms include SSD, YOLO series, RetinaNet, etc. The two-stage algorithm has higher requirements for hardware resources, which may become a bottleneck when resources are limited, and the two-stage algorithm usually cannot meet the real-time requirements, especially in application scenarios that require efficient processing. As a single-stage target detector, the YOLO (You Only Look Once) series model has gradually become a research hotspot in the field of weld defect detection due to its efficient detection speed and high accuracy. As the latest version of the YOLO series, YOLOv8 further improves the detection performance.
[0005] Although YOLOv8 has improved the performance of the algorithm to a certain extent, there are still two problems: (1) The algorithm has a large number of parameters and occupies a large amount of computing resources, so the detection speed is slow and cannot meet the real-time requirements of defect detection tasks, which makes it difficult to run efficiently on industrial equipment with limited resources and cannot meet industrial deployment. (2) Weld defects usually have large differences in morphology (such as cracks, slag inclusions, pores, etc.), especially some small or irregular defects. Therefore, X-ray weld defect detection currently has problems such as missed detection and wrong detection.
[0006] Therefore, this technical solution selects YOLOv8n with the smallest number of parameters as the improvement object, and proposes an improved YOLOv8 weld defect detection method to improve the above-mentioned problems. Summary of the invention
[0007] The invention discloses an X-ray weld defect detection method based on improved YOLOv8, which specifically comprises the following steps:
[0008] S1, obtaining original x-ray weld defect image data;
[0009] S2, image preprocessing and data enhancement;
[0010] S3. Build an X-ray weld defect detection model based on improved YOLOv8;
[0011] S4, train the improved YOLOv8 model;
[0012] S5. Evaluate the improved YOLOv8 model.
[0013] Furthermore, the specific steps of step S1 are as follows:
[0014] The X-ray weld defect images provided by Kaifeng Deer Air Branch were used. The collected images included five types of defects that appeared during the welding process: porosity, slag inclusion, incomplete fusion, incomplete penetration, and cracks. Among them, the image features of incomplete fusion and incomplete penetration are similar and difficult to distinguish, so these two types of defects are combined into one type for identification.
[0015] Furthermore, the specific steps of step S2 are as follows:
[0016] Preprocess the image using weighted logarithmic transformation;
[0017] The X-ray weld images are processed by rotating and adding noise to the preprocessed images, and the data set is expanded to improve the generalization ability of the model training.
[0018] Furthermore, the specific steps of step S3 are as follows:
[0019] S31. Introduce EMA attention to the backbone of the YOLOv8 model, improve EMA attention, and add the improved EMA_Mul to the C2f module of the backbone network;
[0020] S32. Use SimSPPF module to replace the original SPPF module of yolov8, and make further improvements on the SimSPPF model, and name the improved model SimSPPF_Avg;
[0021] S33. DualConv is introduced into the neck of the YOLOv8 model to improve C2f. A lightweight C2f is proposed to form the C2f_DualConv module, and all C2f in the neck of YOLOv8n is replaced by C2f_Dual.
[0022] S34. Use the WIoU loss function to replace the original CIoU loss function of the YOLOv8 model. The formula of the WIoU loss function is as follows:
[0023] L WIoU =R WIoU L IoU ;
[0024]
[0025] Where L WIoU represents the WIoU loss function, R WIoU represents the adjustment factor of WIoU, L IoU represents the IoU loss function, x2 and y2 are the center coordinates of the predicted box, x gt and gt is the center coordinate of the real box, W gt and H gt are the width and height of the ground-truth box respectively.
[0026] Furthermore, the specific steps of step S4 are as follows:
[0027] S41. Generate training set, validation set and test set according to the ratio of 7:1.5:1.5. The images of training set, validation set and test set are 1610, 345 and 345 respectively. The experimental platform is based on 64-bit Windows 11 operating system, with 24GB memory, hardware configuration: CPU is 18Vcpu, AMD EPYC 9754; GPU is NVIDIA RTX 4090, and the compilation environment is Python 3.10+PyTorch 2.1.0+CUDA 12.1.
[0028] S42. The experimental related parameters are set as follows: the initial learning rate is set to 0.0001, the batch size is set to 16, the optimizer is Adamw, the number of experimental training rounds is set to 300, and the input image size is 640×640.
[0029] Beneficial Effects
[0030] The X-ray weld defect detection method based on improved YOLOv8 proposed in the present invention has the following advantages compared with the prior art:
[0031] On the basis of YOLOv8, the present invention introduces the improved EMA_Mul attention into the backbone network to help the network better capture the characteristics of weld defects of different sizes; the SimSPPF_Avg module proposed in the present invention is applied to reduce the interference of background information on weld defect detection; at the same time, in order to improve the high parameter amount and calculation amount brought by ordinary convolution, the Dual convolution is introduced and C2f is improved to propose C2f_Dual, which realizes the lightweight of the model; WIOU is used to optimize the loss function to improve the generalization ability of the model. Compared with the original YOLOv8 model, the improved model has improved the accuracy and reduced the number of parameters of the model, which can meet the real-time requirements of X-ray weld defect detection in actual industry. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The accompanying drawings are only used to more fully illustrate the process of the present invention and do not constitute a limitation on the scope of the present invention.
[0033] Figure 1 It is a schematic diagram of the overall process of the present invention;
[0034] Figure 2 This is the improved YOLOv8 network structure diagram of the present invention;
[0035] Figure 3 It is the structural diagram of the EMA_Mul module in the present invention;
[0036] Figure 4 It is a structural diagram of the multi-scale pooling module in the present invention;
[0037] Figure 5 It is the structural diagram of the SimSPPF_Avg module in the present invention;
[0038] Figure 6 It is the DualConv structure diagram in the present invention;
[0039] Figure 7 It is the structure diagram of C2f_Dual module in the present invention;
[0040] Figure 8 It is a comparison diagram of the detection effect of the present invention. Specific implementation plan
[0041] like Figure 1 As shown, the present invention specifically comprises the following steps:
[0042] S1. Obtaining original X-ray weld defect image data
[0043] S2. Image preprocessing and data enhancement
[0044] S3. Build an X-ray weld defect detection model based on improved YOLOv8
[0045] S4. Train the improved YOLOv8 model
[0046] S5. Evaluate the improved YOLOv8 model
[0047] Step S1 specifically includes the following steps:
[0048] The original data set is the X-ray weld defect image provided by Kaifeng Deer Air Branch. The collected defect images include five types of defects that appear in the welding process, namely, porosity, slag inclusion, incomplete fusion, incomplete penetration, and cracks. Slag inclusions appear as dots or dense dots on the image, with a brightness higher than the background; cracks appear as white lines at the arc starting point of the weld; porosity appears as spots with a brightness lower than the background; incomplete fusion appears as continuous or intermittent white straight lines, with an irregular contour on the side close to the center of the weld; incomplete penetration appears as neat white straight lines, and sometimes the contour may be irregular; due to the similar characteristics of incomplete fusion and incomplete penetration, it is difficult to distinguish and they are usually combined into one type of defect identification.
[0049] Step S2 specifically includes the following steps:
[0050] (1) Image preprocessing
[0051] The weighted logarithmic transformation is used to preprocess the data, mainly to enhance the contrast of the image. The formula is as follows:
[0052] g(x1,y1)=c·log(1+w(x1,y1)·f(x1,y1));
[0053] Where (x1, y1) represents the coordinates of the image pixel, g(x1, y1) is the transformed pixel value, f(x1, y1) is the original pixel value, w(x1, y1) is the pixel weight, and c is a constant used to control the contrast gain. By adjusting the weight, the enhancement effect on different brightness areas can be accurately controlled, so that the contrast of the image is further improved.
[0054] (2) Data enhancement
[0055] The image after image preprocessing is rotated, noise is added, etc. to expand the data. Adding noise can enhance the robustness of the model to noise interference. The expanded image is put together with the original X-ray weld defect image as an X-ray weld defect data set, and the image annotation tool Labelimg is used to annotate the defects of each image in the defect data set. The Labelimg tool is used to manually annotate the location and category of the defects in each image to ensure that each defect has accurate annotation information. This step is crucial for training deep learning models, because accurate annotation can help the model better learn and identify different types of defects, thereby improving the accuracy and reliability of detection. Therefore, the annotation of the present invention is carried out under the guidance of professionals, and the annotated data set will contain detailed defect location information, providing a high-quality data foundation for subsequent model training.
[0056] Step S3 specifically includes the following steps:
[0057] S31. EMA attention is introduced into the backbone part of the YOLOv8 model, and EMA attention is improved. After the improved EMA_Mul is added to the C2f module of the backbone network, the model's detection ability for weld defects of different sizes is improved;
[0058] EMA_Mul structure is as follows Figure 3 As shown in the figure, the improvements made by the EMA_Mul module compared to the EMA attention are divided into two parts: (1) the 3×3 convolution kernel is replaced by a 5×5 convolution kernel to expand the receptive field and capture features in a larger spatial range; (2) the average pooling operation after the 3×3 convolution is changed to a pooling operation using pooling kernels of different sizes (2x2, 4x4, 6x6, 8x8) to perform a pooling operation on the input feature map. This can further enrich the multi-scale information of the feature map through multi-scale pooling and improve the model's ability to detect defects of different sizes. Through these improvements, the EMA_Mul module can more effectively combine multi-scale features and improve the performance of the model in the task of X-ray weld defect detection.
[0059] Multi-scale pooling modules such as Figure 4 As shown, assuming that the input feature map Where B is the batch size, C is the number of channels, and H and W are the height and width of the feature map, respectively.
[0060] Four pooling operations of different sizes are performed on the input feature map:
[0061] X 2×2 =MaxPool2d 2×2 (X);
[0062] X 4×4 =MaxPool2d 4×4(X);
[0063] X 6×6 =MaxPool2d 6×6 (X);
[0064] X 8×8 =MaxPool2d 8×8 (X);
[0065] The pooled feature map is upsampled back to the original size H×W, and the original feature map and the upsampled feature map are concatenated in the channel dimension. Finally, a 1x1 convolution is used to reduce the number of channels:
[0066] X conv =Conv1×1(X concat );
[0067] The feature map after 1×1 convolution is fused with the original input feature map, and the size of the final output feature map is consistent with the size of the input feature map;
[0068] S32. Use SimSPPF module to replace the original SPPF module of yolov8, and make further improvements on the SimSPPF model. The improved model is named SimSPPF_Avg, which reduces the interference of background information on weld defect detection.
[0069] The structure of SimSPPF_Avg is as follows Figure 5 As shown in the figure, SimSPPF_Avg divides the input into four parts. One part is connected in series with three 5x5 maximum pooling layers (MaxPool2d). The input feature map is processed by connecting three maximum pooling layers in series; the second and third parts are processed by adaptive maximum pooling layer and adaptive average pooling layer (AdaptiveAvgpool2d) respectively; the fourth part is processed by SimConv; these four parts are connected and fused through the Concat layer to generate fixed-size features.
[0070] S33, DualConv is introduced into the neck of the YOLOv8 model to improve C2f, and a lightweight C2f is proposed to form the C2f_DualConv module. All C2f in the neck of YOLOv8n is replaced with C2f_Dual, reducing the number of model parameters.
[0071] The structure diagram of DualConv is as follows Figure 6As shown in Figure 2. DualConv divides N convolution kernels into G groups, and each group of convolution kernels processes all input feature map channels. Among them, the input feature map channels of M / G are processed in parallel by 3×3 convolution kernels and 1×1 convolution kernels, while the remaining input feature map channels are only processed by 1×1 convolution. In DualConv, the output results of the parallel 3×3 convolution kernels and 1×1 convolution kernels are added.
[0072] S34. Use the WIoU loss function to replace the original CIoU loss function of the YOLOv8 model. The WIoU loss function introduces a dynamic non-monotonic focusing mechanism, which enables the model to more effectively adjust the training process when processing high-quality data and low-quality data. The formula is as follows:
[0073] L WIoU =R WIoU L IoU ;
[0074]
[0075] Where L WIoU represents the WIoU loss function, R WIoU represents the adjustment factor of WIoU, L IoU represents the IoU loss function, x2 and y2 are the center coordinates of the predicted box, x gt and gt is the center coordinate of the real box, W gt and H gt are the width and height of the ground-truth box respectively.
[0076] Step S4 specifically includes the following steps:
[0077] S41. Generate training set, validation set and test set according to the ratio of 7:1.5:1.5. The images of training set, validation set and test set are 1610, 345 and 345 respectively. The experimental platform is based on 64-bit Windows 11 operating system, with 24GB memory, hardware configuration: CPU is 18Vcpu, AMD EPYC 9754; GPU is NVIDI A RTX 4090, and the compilation environment is Python 3.10+PyTorch 2.1.0+CUDA 12.1.
[0078] S42. The experimental related parameters are set as follows: the initial learning rate is set to 0.0001, the batch size is set to 16, the optimizer is Adamw, the number of experimental training rounds is set to 300, and the input image size is 640×640.
[0079] Step S5 specifically includes the following steps:
[0080] S51. In order to effectively and intuitively demonstrate the improvement effect, precision (P), recall (R), mean average precision (mAP), model parameter quantity (Params), total floating point operations (FLOPs) and frame per second (FPS) are used as evaluation indicators of model performance; Params refers to the number of parameters in the model, FLOPs is used to measure the complexity of the model, and FPS refers to the number of images processed by the model per second; the formulas for precision, recall and mAP are as follows:
[0081]
[0082] Among them, TP means that both the prediction and the actual are true, FP means that the prediction is true but the actual is false, FN means that the prediction is false but the actual is true, n is the total number of categories, P(R) is a function of Precision with Recall as a parameter, mAP50 is the average precision of the total category when the IoU value is 0.5, and mAP50:95 is the average precision of different IoU values (0.5 to 0.95, step size 0.05);
[0083] S52,The ablation experiment of the improved model is shown in Table 1;
[0084] Table 1 Ablation experiment
[0085]
[0086] Note: √ indicates that this solution is used
[0087] From the analysis of Table 1, it can be seen that compared with the original YOLOv8n model, the method of the present invention has shown significant improvements in many aspects. Specifically, the accuracy rate has increased by 5.3%, the recall rate has increased by 2.1%, the precision rate has increased by 5.9%, the number of parameters has decreased by 4.02%, the total floating point operation volume has decreased by 0.2G, and the number of detection frames per second has reached 170.9. The experimental results show that the various indicators of the improved algorithm are better than YOLOv8n, indicating that this experimental method not only improves the detection accuracy of the model, but also realizes the lightweight of the model, which can meet the real-time and accuracy requirements of weld defect detection.
[0088] S53, the mAP% of various defects before and after improvement are shown in Table 2;
[0089] Table 2 Comparison results of mAP% of various defects before and after improvement
[0090]
[0091] Table 2 shows the experimental results of four defects: cracks, incomplete fusion / insufficient penetration, pores, and slag inclusions. The detection improvement effect is different for different defects. It can be observed that the improved model has significantly improved the detection accuracy of the four defects compared with the original YOLOv8n model. Among them, the mAP value of cracks has increased the most, by 10.5%. This result shows that the improved algorithm is the best in detecting small and irregular cracks. The mAP value of incomplete fusion / insufficient penetration has increased by 3.4%, the mAP value of pores has increased by 8%, and the mAP value of slag inclusions has increased by 1.4%. It is proved that the improved algorithm in this paper is not only effective for a certain specific defect, but also has universal applicability and significant improvement effect on the detection of different types of weld defects. Especially in the two defects of irregular cracks and small and dense pores, the improvement effect is obvious, and the improved algorithms have higher detection accuracy.
[0092] S54. In order to further verify the effectiveness of the improved model of the present invention for x-ray weld defect detection and whether it is suitable for deployment on edge devices, the improved algorithm is compared with YOLOv3-Tiny, YOLOv5n, YOLOv6n, YOLOv7-tiny and YOLOv8n algorithms.
[0093] The comparative experimental results are shown in Table 3;
[0094] Table 3 Comparative test
[0095]
[0096] As shown in Table 3, the improved model has a 1.2% higher recall rate and a 4.1% higher precision rate than YOLOv3-Tiny, and the number of parameters of the improved model is only 2.4% of that of YOLOv3-Tiny; compared with YOLOv5n, the improved model has a 4.3% higher accuracy rate, a 1.7% higher recall rate, and a 4.3% higher precision rate; compared with YOLOv6n, the improved model has lower parameters and total floating point calculations, making it more suitable for deployment on edge devices; compared with YOLOv7-tiny and YOLOv8n algorithms, the improved model has an accuracy rate of 2.8% and 5.3% higher, a recall rate of 1.2% and 2.1% higher, and a precision rate of 1.6% and 5.9% higher. In addition, the number of parameters of the improved model is lower than that of other models except that it is slightly higher than that of YOLOv5n, and the number of parameters is only 2.4% of that of YOLOv3-Tiny. The detection speed of the improved model reached 135.4FPS, which still meets the real-time detection requirements.
[0097] In summary, the improved model is superior to other models in all aspects. This significant advantage in parameter volume and computational complexity makes the improved model more suitable for deployment on edge devices. While improving detection accuracy, it significantly reduces the number of model parameters, achieves model lightweight, and meets real-time detection requirements.
[0098] Figure 8 It is a comparison chart of the detection effects of the model before and after improvement. In order to more intuitively verify the detection effect of the improved model in this experiment, several representative pictures were selected from the test set for analysis. These pictures show the detection effect of weld defects, including the original picture of weld defects, the detection result picture of the original YOLOv8n model, and the detection result picture of the model of the present invention. By comparing the test results, it can be clearly seen that the original YOLOv8n has certain shortcomings in detecting weld defects, especially the missed detection situation is more serious. Using the improved model, the missed detection phenomenon has been significantly improved, and the accuracy and comprehensiveness of the detection have also been improved. This further verifies the effectiveness and superiority of the improved model in practical applications.
Claims
1. A method for detecting X-ray weld defects based on improved YOLOv8, the method comprising the following steps: S1, obtaining original x-ray weld defect image data; S2, image preprocessing and data enhancement; S3. Build an X-ray weld defect detection model based on improved YOLOv8; S4, train the improved YOLOv8 model; S5. Evaluate the improved YOLOv8 model.
2. The X-ray weld defect detection method based on improved YOLOv8 according to claim 1 is characterized in that: The specific steps of step S1 to construct an X-ray weld defect image dataset are as follows: The original data set is the X-ray weld defect image provided by Kaifeng Deer Air Branch. The collected defect images include five types of defects that appear in the welding process, namely, porosity, slag inclusion, incomplete fusion, incomplete penetration, and cracks. Slag inclusions appear as dots or dense dots on the image, with a brightness higher than the background; cracks appear as white lines at the arc starting point of the weld; porosity appears as spots with a brightness lower than the background; incomplete fusion appears as continuous or intermittent white straight lines, with an irregular contour on the side close to the center of the weld; incomplete penetration appears as neat white straight lines, and sometimes the contour may be irregular; due to the similar characteristics of incomplete fusion and incomplete penetration, it is difficult to distinguish and they are usually combined into one type of defect identification.
3. The X-ray weld defect detection method based on improved YOLOv8 according to claim 1, characterized in that: The steps for image preprocessing and data enhancement in step S2 are: (1) Image preprocessing The weighted logarithmic transformation is used to preprocess the data, mainly to enhance the contrast of the image. The formula is as follows: g(x1,y1)=c·log(1+w(x1,y1)·f(x1,y1)); Where (x1, y1) represents the coordinates of the image pixel, g(x1, y1) is the transformed pixel value, f(x1, y1) is the original pixel value, w(x1, y1) is the pixel weight, and c is a constant used to control the contrast gain. By adjusting the weight, the enhancement effect on different brightness areas can be accurately controlled, so that the contrast of the image is further improved. (2) Data enhancement The image after image preprocessing is rotated, noise is added, etc. to expand the data. Adding noise can enhance the robustness of the model to noise interference. The expanded image is put together with the original X-ray weld defect image as an X-ray weld defect data set, and the image annotation tool Labelimg is used to annotate the defects of each image in the defect data set. The Labelimg tool is used to manually annotate the location and category of the defects in each image to ensure that each defect has accurate annotation information. This step is crucial for training deep learning models, because accurate annotation can help the model better learn and identify different types of defects, thereby improving the accuracy and reliability of detection. Therefore, the annotation of the present invention is carried out under the guidance of professionals, and the annotated data set will contain detailed defect location information, providing a high-quality data foundation for subsequent model training.
4. The X-ray weld defect detection method based on improved YOLOv8 according to claim 1 is characterized in that: Step S3: Constructing an X-ray weld defect detection model based on improved YOLOv8. The specific steps are as follows: S31. Introduce EMA attention to the backbone of the YOLOv8 model, improve EMA attention, and add the improved EMA_Mul to the C2f module of the backbone network; S32. Use SimSPPF module to replace the original SPPF module of yolov8, and make further improvements on the SimSPPF model, and name the improved model SimSPPF_Avg; S33. DualConv is introduced into the neck of the YOLOv8 model to improve C2f. A lightweight C2f is proposed to form the C2f_DualConv module, and all C2f in the neck of YOLOv8 is replaced by C2f_Dual. S34. Use the WIoU loss function to replace the original CIoU loss function of the YOLOv8 model. The WIoU loss function introduces a dynamic non-monotonic focusing mechanism, which enables the model to more effectively adjust the training process when processing high-quality data and low-quality data.
5. The X-ray weld defect detection model based on improved YOLOv8 according to claim 4, characterized in that: In step S31, the improvements made by the EMA_Mul module are divided into two aspects: (1) replacing the 3×3 convolution kernel with a 5×5 convolution kernel to expand the receptive field, thereby capturing features in a larger spatial range; (2) The average pooling operation after the 3×3 convolution is replaced by using pooling kernels of different sizes (2x2, 4x4, 6x6, 8x8) to perform pooling operations on the input feature map; this can further enrich the multi-scale information of the feature map through multi-scale pooling and improve the model's ability to detect defects of different sizes. Through these improvements, the EMA_Mul module can more effectively combine multi-scale features and improve the performance of the model in the task of X-ray weld defect detection.
6. The X-ray weld defect detection model based on improved YOLOv8 according to claim 4, characterized in that: In step S32, the SimSPPF_Avg model structure is as follows: the input is divided into four parts, one part is connected in series with three maximum pooling layers (MaxPool2d) of size 5x5; the input feature map is processed by connecting three maximum pooling layers in series; the second part and the third part process the input feature map through the adaptive maximum pooling layer and the adaptive average pooling layer (AdaptiveAvgpool2d) respectively; the fourth part is processed by SimConv; These four parts are connected and fused through the Concat layer to generate features of fixed size.
7. The X-ray weld defect detection model based on improved YOLOv8 according to claim 4, characterized in that: In step S34, the WIoU loss function is used, and the formula of the WIoU loss function is as follows: L WIoU =R WIoU L IoU ; Where L WIoU represents the WIoU loss function, R WIoU represents the adjustment factor of WIoU, L IoU represents the IoU loss function, x2 and y2 are the center coordinates of the predicted box, x gt and gt is the center coordinate of the real box, W gt and H gt are the width and height of the ground-truth box respectively.
8. The X-ray weld defect detection method based on improved YOLOv8 according to claim 1, characterized in that: The improved YOLOv8 model is trained as described in step S4, and the specific steps are as follows: S41: The data set is divided into training set, validation set and test set according to the ratio of 7:1.5:1.
5. The images of training set, validation set and test set are 1610, 345 and 345 respectively. The experimental platform is based on 64-bit Windows 11 operating system, with 24GB memory, hardware configuration: CPU is 18Vcpu, AMD EPYC 9754; GPU is NVIDIARTX 4090, and the compilation environment is Python3.10+PyTorch 2.1.0+CUDA 12.
1. S42: The experimental related parameters are set as follows: the initial learning rate is set to 0.0001, the batch size is set to 16, the optimizer is Adamw, the number of experimental training rounds is set to 300, and the input image size is 640×640.
Citation Information
Cited By
Cast-in-place box girder image cross-key parameter identification method based on target detection and key information extraction
CN119851303A
Construction method and application of small sample chip surface defect detection model based on improved YOLOv8
CN120070343A
X-ray weld defect detection method and device based on improved YOLOv8-P2
CN122550614A
X-ray weld defect detection method and device based on improved YOLOv8-P2
CN122550614B
