Welding radiograph defect detection method and system

By improving the YOLOv11 neural network model and dual model training strategy, combined with the SlideLoss loss function and ODConv module, the problems of low efficiency and insufficient small defect recognition capabilities in welding ray negative film detection are solved, and efficient and accurate weld defect detection is achieved.

CN120495291APending Publication Date: 2025-08-15SPECIAL EQUIP SAFETY SUPERVISION INSPECTION INST OF JIANGSU PROVINCE +1

Patent Information

Application Number
CN202510977071.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-16
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

The prior art has low efficiency and large subjective errors in welding ray film detection, limited ability to identify small defects, especially when dealing with small-size defects and complex defect shapes, and the traditional methods have poor robustness to high-noise images.

Method used

The YOLOv11 neural network model is adopted and combined with the SlideLoss loss function and ODConv module, and the weld area detection and defect detection are optimized through the dual-model two-stage training strategy, and the detection report is generated by combining the defect segmentation algorithm.

Benefits of technology

The accuracy and stability of weld defect detection are improved, and efficient identification of small defects and complex shape defects are achieved. The average detection accuracy reaches 94.50%, greatly improving the detection efficiency and work efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120495291A_ABST
    Figure CN120495291A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a system for detecting defects of a welding radiograph, which are used in the technical field of nondestructive testing and comprise the following steps of: constructing a welding seam data set; a YOLOv11 neural network model is constructed, and the YOLOv11 neural network model is optimized by using a SlideLoss classification loss function; training the optimized YOLOv11 neural network model by adopting a double-model two-stage training strategy on the basis of the weld data set; and inputting a detection picture into the trained YOLOv11 neural network dual model, and combining a defect segmentation algorithm to obtain a defect detection report of the detection picture. According to the invention, by optimizing the feature extraction module, improving the loss function and constructing a targeted data processing strategy, the accuracy, stability and small target recognition capability of weld defect detection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of nondestructive testing, and in particular to a method and system for detecting defects in welding radiographic films. Background Art

[0002] As a key process in modern industrial manufacturing, welding is widely used in a variety of fields such as aerospace, petrochemicals, shipbuilding, and pressure pipelines. The quality of welding is directly related to the safety and service life of the structure. However, during the welding process, defects such as porosity, slag inclusions, lack of fusion, incomplete penetration, and cracks often occur due to the influence of factors such as material properties, process parameters, and operating environment. These defects may lead to a decrease in the mechanical properties of the weld joint and even cause serious engineering accidents. Therefore, the detection of internal defects in the weld is crucial. X-ray imaging technology, as a non-destructive testing (NDT) method, can effectively obtain internal structural information of the weld and is widely used in welding quality inspection. However, traditional X-ray film inspection mainly relies on manual visual inspection, with low detection efficiency, and the results are easily affected by the experience of the inspector. There are problems such as strong subjectivity, long time consumption, and high labor intensity.

[0003] In recent years, the rapid development of computer technology has driven advancements in intelligent inspection technology. Computer vision methods based on deep learning have achieved remarkable results in areas such as image recognition and object detection, and are gradually being applied to nondestructive testing (NDT). Compared to traditional manual visual inspection or image processing methods based on manual feature extraction, deep learning technology can autonomously learn and extract high-dimensional features of defects, demonstrating strong robustness and generalization capabilities. In the task of weld radiograph defect detection, convolutional neural networks (CNNs) and their derived deep learning models can effectively identify various welding defects, improving detection accuracy and efficiency.

[0004] For example, patent application number CN202411531946.0, titled "Deep Learning-Based Weld Localization and Defect Detection System and Method," proposes a deep learning-based weld localization and defect detection method comprised of three core technologies: an FPN (Feature Pyramid Network) architecture, a free-form rectangular box annotation method, and dual-correlation knowledge distillation. First, the FPN (Feature Pyramid Network) architecture is employed for weld detection, leveraging multi-level feature fusion to effectively improve detection accuracy for welds of varying scales. Second, free-form rectangular box annotation replaces traditional rectangular box annotation. This method accurately locates weld defects of varying shapes, avoiding the limitations of fixed rectangular boxes and improving localization accuracy. Finally, dual-correlation knowledge distillation is introduced to transfer relevant knowledge between the teacher and student models, optimizing the model structure and reducing the number of parameters while maintaining high detection accuracy. While this method demonstrates progress in weld localization and defect detection, there is still room for improvement. First, the FPN-based detection architecture can lack accuracy for small defects, especially when the defect sizes vary widely. Secondly, although free rectangular box annotation can improve positioning accuracy, the identification of defects with complex shapes or irregular boundaries (such as cracks) may still be inaccurate.

[0005] Therefore, it is necessary to further improve the existing deep learning weld detection technology, especially for the detection of small-size defects, the recognition of complex defect shapes, and the robustness of low-contrast and high-noise images, so as to improve the accuracy, stability and adaptability of weld defect detection.

[0006] Currently, no effective solutions have been proposed for the problems in related technologies. Summary of the Invention

[0007] In order to overcome the above problems, the present invention aims to propose a welding radiographic film defect detection method and system, aiming to solve the problems of low efficiency, large subjective error, and limited ability to identify small defects in radiographic detection of girth welds of pressure pipelines.

[0008] To this end, the specific technical solutions adopted in the present invention are as follows: According to one aspect of the present invention, a method for detecting defects in welding radiographic films is provided, the method comprising the following steps: S1. Obtain digital radiographic images of welds, annotate them, and construct weld datasets. S2. Build a YOLOv11 neural network model and use the SlideLoss classification loss function to optimize the YOLOv11 neural network model to obtain the optimized YOLOv11 neural network model; S3. Based on the weld dataset, a dual-model two-stage training strategy is adopted to train the optimized YOLOv11 neural network model to obtain the YOLOv11 weld detection model and the YOLOv11 defect detection model. S4. Input the inspection image into the YOLOv11 weld inspection model and the YOLOv11 defect detection model, and combine it with the defect segmentation algorithm to obtain a defect detection report for the inspection image.

[0009] Optionally, obtaining a digital radiographic image of the weld and annotating it, and constructing a weld dataset includes the following steps: S11. Obtaining a digital radiographic image of the weld using a digital radiographic imaging system; S12. Annotating the digital radiographic image of the weld using detection and annotation software, wherein the annotation content includes: weld area and weld defects; S13. Construct a weld dataset based on the annotation content.

[0010] Optionally, constructing a YOLOv11 neural network model and optimizing the YOLOv11 neural network model using a SlideLoss classification loss function to obtain the optimized YOLOv11 neural network model includes the following steps: S21. Build the YOLOv11 neural network model based on the ODConv module; S22. Use the SlideLoss classification loss function to dynamically adjust the weights of positive and negative samples and optimize the YOLOv11 neural network model.

[0011] Optionally, building a YOLOv11 neural network model based on the ODConv module includes: The ODConv module is used to replace the C3K2-ODConv module in the YOLOv11 neural network model. The C3K2-ODConv module consists of the Conv module, the Split module, the C3K-ODConv module, the Bottleneck-ODConv module, and the Concat module. The C3K-ODConv module consists of the initial convolution, the two-branch convolution, the Concat, and the final convolution. The Bottleneck-ODConv module consists of the ODConv convolution layer and the Shortcut.

[0012] Optionally, based on the weld dataset, a dual-model two-stage training strategy is adopted to train the optimized YOLOv11 neural network model to obtain a YOLOv11 weld detection model and a YOLOv11 defect detection model, including the following steps: S31, dividing the weld dataset into a weld training set and a weld verification set, and training an optimized YOLOv11 neural network model based on the weld training set and the weld verification set to obtain a YOLOv11 weld detection model; S32. Use the YOLOv11 weld detection model to obtain weld area detection results. Based on the weld area detection results and combined with the defect annotation algorithm, a weld reconstruction dataset is constructed. S33. Based on the weld reconstruction dataset, the optimized YOLOv11 neural network model is trained to obtain the YOLOv11 defect detection model.

[0013] Optionally, a YOLOv11 weld detection model is used to obtain weld area detection results. Based on the weld area detection results and in combination with a defect annotation algorithm, a weld reconstruction dataset is constructed, including the following steps: S321. Using the YOLOv11 weld detection model, obtain weld area detection results; S322. Reconstruct the weld image based on the weld area detection result and the defect annotation reconstruction algorithm to obtain an initial weld reconstructed image dataset; S323, using a non-local means denoising algorithm, denoising the initial weld reconstructed image dataset to obtain a denoised weld reconstructed image dataset; S324. Based on an adaptive histogram equalization algorithm, the denoised weld reconstructed image dataset is processed to obtain a weld reconstructed image dataset.

[0014] Optionally, training an optimized YOLOv11 neural network model based on the weld reconstruction dataset to obtain a YOLOv11 defect detection model includes the following steps: S331, dividing the weld reconstruction dataset into a weld reconstruction training set and a weld reconstruction verification set; S332. Based on the weld reconstruction training set and the weld reconstruction verification set, train the optimized YOLOv11 neural network model to obtain a YOLOv11 defect detection model; S333. Evaluate the performance of the YOLOv11 defect detection model based on precision and recall.

[0015] Optionally, inputting the inspection image into the YOLOv11 weld inspection model and the YOLOv11 defect detection model, and combining the defect segmentation process to obtain a defect inspection report for the inspection image includes the following steps: S41. Input the detection image into the YOLOv11 weld detection model and the YOLOv11 defect detection model, perform weld recognition and defect recognition on the detection image, and obtain weld recognition results and defect recognition results; S42, using a defect segmentation algorithm to process the inspection image to obtain defect size and location information; S43. Integrate the weld identification results, defect identification results, defect size and location information to obtain a defect detection report for the detection image.

[0016] Optionally, processing the inspection image using a defect segmentation algorithm to obtain defect size and location information includes the following steps: S421, performing enhancement and denoising processing on the detection image to obtain an enhanced image; S422, using a gradient filter to extract edges from the enhanced image to obtain an edge intensity map; S423, based on the edge intensity map, binarization is performed according to the Otsu method adaptive threshold segmentation method to obtain a mask map of the defect edge; S424. Based on the mask image of the defect edge, perform connected region analysis, calculate the minimum circumscribed rectangle of each region, and obtain the size and location information of the defect.

[0017] According to another aspect of the present invention, a welding radiograph defect detection system is provided, the system comprising: a data set construction module, a YOLOv11 neural network model optimization module, a dual-model two-stage training module, and a defect detection report generation module; A data set construction module is used to obtain digital radiographic images of welds, annotate them, and construct weld data sets; YOLOv11 neural network model optimization module, which is used to build the YOLOv11 neural network model and optimize the YOLOv11 neural network model using the SlideLoss classification loss function to obtain the optimized YOLOv11 neural network model; The dual-model two-stage training module is used to train the optimized YOLOv11 neural network model based on the weld dataset using a dual-model two-stage training strategy to obtain the YOLOv11 weld detection model and the YOLOv11 defect detection model; The defect detection report generation module is used to input the inspection image into the YOLOv11 weld detection model and the YOLOv11 defect detection model, and combine it with the defect segmentation algorithm to obtain a defect detection report for the inspection image.

[0018] Compared with the existing technology, this application has the following beneficial effects: 1) The present invention adopts a two-stage training strategy, firstly detecting the weld area and removing irrelevant background, and then combining intelligent image processing technology (NLM denoising and CLAHE enhancement) to optimize image quality and improve the model's adaptability to weld defects.

[0019] 2) This paper introduces ODConv to replace the Conv in the C3k2 module of the traditional YOLOv11 and uses the SlideLoss loss function to enhance the model's learning ability for difficult-to-classify samples, improving model recognition accuracy. Combining model improvements with a two-stage training strategy, the model significantly improves the average detection accuracy for seven typical weld defect types (cracks, lack of fusion, incomplete penetration, strip defects, circular defects, root concavity, and root bite), achieving an average detection precision of 94.50% and an average detection accuracy of 93.73%.

[0020] 3) The present invention realizes efficient and intelligent detection of weld defects through a series of automated operations such as batch importing images, weld area identification, image reconstruction and preprocessing, defect detection, and film grading, greatly improving work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The above characteristics, features and advantages of the present invention and their implementation methods and methods will become more clearly understood in conjunction with the following description of the embodiments, which will be described in detail in conjunction with the accompanying drawings. Here, a schematic diagram is shown: Figure 1 is a flow chart of a method for detecting defects in welding radiographic films according to an embodiment of the present invention; Figure 2 This is a principle block diagram of a welding radiographic film defect detection system according to an embodiment of the present invention; Figure 3 is a schematic diagram of a welding radiographic film defect detection method according to an embodiment of the present invention; Figure 4 2. This is a structural diagram of an improved neural network model in a method for detecting defects in welding radiographic films according to an embodiment of the present invention; Figure 5 2 is a specific structural diagram of C3K2-ODConv in a method for detecting defects in welding radiographs according to an embodiment of the present invention; Figure 6 3. This is a diagram showing the recognition effect and image processing effect of the YOLOv11 weld detection model in a welding radiographic film defect detection method according to an embodiment of the present invention; Figure 7 This is a diagram showing the effect of a YOLOv11 defect detection model in detecting weld defects in a welding radiographic film defect detection method according to an embodiment of the present invention; Figure 8 This is an effect diagram of defect segmentation processing in a welding radiographic film defect detection method according to an embodiment of the present invention.

[0022] In the picture: 1. Dataset construction module; 2. YOLOv11 neural network model optimization module; 3. Dual-model two-stage training module; 4. Defect detection report generation module. DETAILED DESCRIPTION

[0023] In order to help those skilled in the art better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0024] According to an embodiment of the present invention, a method and system for detecting defects in welding radiographic films are provided.

[0025] The present invention will now be further described with reference to the accompanying drawings and specific embodiments. Figure 1 As shown, a method for detecting defects in welding radiographic films according to an embodiment of the present invention includes the following steps: S1. Obtain digital radiographic images of welds, annotate them, and construct weld datasets.

[0026] In this optional embodiment, obtaining a digital radiographic image of a weld and annotating it, and constructing a weld dataset includes the following steps: S11. Obtaining a digital radiographic image of the weld using a digital radiographic imaging system; S12. Annotating the digital radiographic image of the weld using detection and annotation software, wherein the annotation content includes: weld area and weld defects; S13. Construct a weld dataset based on the annotation content.

[0027] It should be noted that high-resolution X-ray image data was acquired using a DR digital imaging system (digital radiography system). The data was derived from DR images (digital radiography images) of girth welds of pressure pipelines. Labelimg software (image annotation software) was used for manual annotation, and the annotations included the weld area and seven weld defect types (cracks, lack of fusion, lack of penetration, strip defects, circular defects, root concavity, and root bite).

[0028] From the 5,200 weld images, 6,122 weld regions were identified, including the following weld defects: 620 cracks, 364 lack of fusion, 566 lack of penetration, 1,064 stripe defects, 2,737 circular defects, 260 root concavities, and 290 root gullies. This dataset provides a high-quality foundation for training the proposed model, ensuring the accuracy of subsequent model training.

[0029] S2. Build a YOLOv11 neural network model and use the SlideLoss classification loss function to optimize the YOLOv11 neural network model to obtain the optimized YOLOv11 neural network model.

[0030] In this optional embodiment, constructing a YOLOv11 neural network model and optimizing the YOLOv11 neural network model using the SlideLoss classification loss function to obtain the optimized YOLOv11 neural network model includes the following steps: S21. Build the YOLOv11 neural network model based on the ODConv module; S22. Use the SlideLoss classification loss function to dynamically adjust the weights of positive and negative samples and optimize the YOLOv11 neural network model.

[0031] In this optional embodiment, building a YOLOv11 neural network model based on the ODConv module includes: The ODConv module is used to replace the C3K2-ODConv module in the YOLOv11 neural network model. The C3K2-ODConv module consists of the Conv module, the Split module, the C3K-ODConv module, the Bottleneck-ODConv module, and the Concat module. The C3K-ODConv module consists of the initial convolution, the two-branch convolution, the Concat, and the final convolution. The Bottleneck-ODConv module consists of the ODConv convolution layer and the Shortcut.

[0032] It should be explained that the improvements made to the YOLOv11 neural network model mainly include two aspects: introducing the ODConv module to replace the C3k2 module in the traditional YOLOv11 neural network model, and designing the SlideLoss loss function to enhance the classification ability of the model. Figure 4 As shown in the figure, the improved network structure is shown, in which the C3k2 module has been replaced by C3k2-ODConv (SPPF in the figure represents spatial pyramid pooling; C2PSA represents the attention mechanism module).

[0033] 1) Introducing ODConv (full-dimensional dynamic convolution module) to replace the Conv (convolution layer) in the Bottleneck (neck) of the C3k2 module (convolution block): To improve the network's detection accuracy for small target defects (such as cracks and root concavity), the C3k2 module of the YOLOv11 network is improved to C3K2-ODConv with a multi-dimensional attention mechanism. ODConv (full-dimensional dynamic convolution module Omni-dimensional Convolution) can adaptively adjust the weights of the convolution kernel in multiple dimensions, thereby optimizing the convolution operation, allowing the network to more accurately detect small defects in welds, such as Figure 5 As shown in the figure, the specific structure of C3K2-ODConv is shown (in the figure, C3K-ODConv=No means that only Bottleneck-ODConv is enabled for convolution operations; C3K-ODConv=Yes means that the C3K-ODConv structure is enabled to perform convolution operations; N means multiple).

[0034] The C3K2-ODConv (C3K2-full-dimensional dynamic convolution) module consists of a Conv (convolutional layer) module, a Split (split) module, a C3K-ODConv (full-dimensional dynamic convolution) module, a Bottleneck-ODConv (bottleneck-full-dimensional dynamic convolution) module, and a Concat (connection) module, and performs the following steps: Initial convolution: preliminary adjustment of the input feature map, through convolution, BN layer (batch normalization layer) and activation function processing; Split operation: the feature map is divided into the main branch (retaining the original information) and the sub-branch (entering the C3K-ODConv module or Bottleneck-ODConv module); Concat operation: the main branch and sub-branch outputs are spliced in the channel dimension; Final convolution: further convolution of the spliced features, information fusion and optimization combined with the BN layer and activation function.

[0035] The C3K-ODConv module consists of an initial convolution, a two-branch convolution, a concatenation operation, and a final convolution. First, the initial convolution preprocesses the input features, while the main branch directly transmits basic information. Sub-branches then extract deep features using multiple Bottleneck-ODConv modules, employing a "dimensionality reduction-feature extraction-dimensionality increase" strategy combined with residual connections to capture deep semantic features. Finally, the concatenation operation fuses the features of the main and sub-branches, and the final convolution optimizes the feature representation.

[0036] The Bottleneck-ODConv module is the core feature processing unit in the improved YOLOv11 model. Its core consists of the ODConv convolutional layer and a shortcut (residual connection). The shortcut directly adds the input features to the convolution output, preserving the original information while alleviating the vanishing gradient problem in deep network training and enabling feature reuse. The dynamic convolution of ODConv is expressed as: ; Where αwi, αci, αfi, and αsi represent the attention scalars of the convolution kernel as a whole, the input channel dimension, the output channel dimension, and the spatial attention dimension, respectively; Wi represents the i-th convolution kernel; ⊙ represents the multiplication of the dimensions of the kernel space; * represents the convolution operation; x represents the input feature; and z represents the output feature.

[0037] In this way, ODConv can dynamically adjust the convolution kernel during the convolution process and automatically adapt to the different characteristics of the input data.

[0038] 2) Design of SlideLoss loss function: In the traditional YOLOv11 network, the cross-entropy loss function (Cross-EntropyLoss) is used to perform classification tasks. However, in weld defect detection, especially for small defects that are difficult to classify, the traditional loss function may cause the model to ignore these difficult-to-identify defects. Therefore, the present invention uses the SlideLoss loss function to dynamically adjust the weights of positive and negative samples to enhance the model's learning ability for difficult-to-classify and easily misclassified samples. Specifically, the SlideLoss loss function can smoothly adjust the sample weights, avoiding the over-adjustment problem in the traditional FocalLoss (focal loss function), thereby improving the classification accuracy of the model on small defects. The mathematical form of the SlideLoss loss function is as follows: ; Where y represents the true label of the sample; p represents the probability value predicted by the model, that is, the probability of predicting the positive class; w(p) represents the dynamic weight function, which is defined as: ; Where p represents the probability value predicted by the model; α represents the amplitude of the control weight adjustment; γ represents the growth rate of the weight of low-confidence samples.

[0039] S3. Based on the weld dataset, a dual-model two-stage training strategy is adopted to train the optimized YOLOv11 neural network model to obtain the YOLOv11 weld detection model and the YOLOv11 defect detection model.

[0040] In this optional embodiment, based on the weld dataset, a dual-model two-stage training strategy is adopted to train the optimized YOLOv11 neural network model to obtain the YOLOv11 weld detection model and the YOLOv11 defect detection model, including the following steps: S31, dividing the weld dataset into a weld training set and a weld verification set, and training an optimized YOLOv11 neural network model based on the weld training set and the weld verification set to obtain a YOLOv11 weld detection model; S32. Use the YOLOv11 weld detection model to obtain weld area detection results. Based on the weld area detection results and combined with the defect annotation algorithm, a weld reconstruction dataset is constructed. S33. Based on the weld reconstruction dataset, the optimized YOLOv11 neural network model is trained to obtain the YOLOv11 defect detection model.

[0041] In this optional embodiment, the YOLOv11 weld detection model is used to obtain weld area detection results. Based on the weld area detection results and in combination with the defect annotation algorithm, a weld reconstruction dataset is constructed, including the following steps: S321. Using the YOLOv11 weld detection model, obtain weld area detection results; S322. Reconstruct the weld image based on the weld area detection result and the defect annotation reconstruction algorithm to obtain an initial weld reconstructed image dataset; S323, using a non-local means denoising algorithm, denoising the initial weld reconstructed image dataset to obtain a denoised weld reconstructed image dataset; S324. Based on an adaptive histogram equalization algorithm, the denoised weld reconstructed image dataset is processed to obtain a weld reconstructed image dataset.

[0042] In this optional embodiment, training an optimized YOLOv11 neural network model based on the weld reconstruction dataset to obtain a YOLOv11 defect detection model includes the following steps: S331, dividing the weld reconstruction dataset into a weld reconstruction training set and a weld reconstruction verification set; S332. Based on the weld reconstruction training set and the weld reconstruction verification set, train the optimized YOLOv11 neural network model to obtain a YOLOv11 defect detection model; S333. Evaluate the performance of the YOLOv11 defect detection model based on precision and recall.

[0043] It should be explained that the present invention adopts a dual-model two-stage training strategy, which is trained for weld area detection and weld defect detection respectively to improve detection accuracy and efficiency.

[0044] 1. Phase 1: Weld Detection Model Training and Dataset Reconstruction 1) Weld area detection training The goal of this stage is to train the YOLOv11 model to accurately locate the weld area, eliminate background interference, and increase the proportion of small defects, thereby optimizing subsequent defect detection. The specific steps are as follows: The weld dataset was split into a weld training set and a weld validation set in a 7:3 ratio, focusing only on the category labeled "weld region." Weld region detection was trained based on an improved YOLOv11 network with a batch size of 16 and a learning rate of 0.001. The AdamW optimizer was used with a learning rate of 1e-4, β = (0.9, 0.999), and a weight decay of 0.01. A cosine annealing learning rate scheduling strategy was employed with Tmax = 100 and a minimum learning rate of 1e-6. The learning rate was updated after each epoch.

[0045] 2) Dataset reconstruction and enhancement After the weld area detection is completed, the weld area is cropped on the original DR image, retaining only the weld part and removing irrelevant areas to increase the defect ratio. Based on the coordinates of the reconstructed image, a defect annotation reconstruction algorithm is designed to ensure data consistency. The reconstructed dataset is then subjected to non-local mean denoising (NLM) and adaptive histogram equalization (CLAHE) to further improve the recognition of defects and obtain a weld reconstruction dataset. Figure 4 As shown in the figure, the recognition effect and image processing effect diagram of the YOLOv11 weld detection model are shown.

[0046] The defect annotation reconstruction algorithm ensures that the defect position and size in the weld area remain correct after cropping. The algorithm is expressed as follows: ; Where (xi,yi) represents the coordinates of the upper left corner of the defect annotation box in the original image; (wi,hi) represents the width and height of the defect annotation box in the original image; (xw,yw) represents the coordinates of the upper left corner of the weld area in the original image; (ww,hw) represents the width and height of the weld area; The new upper left corner coordinate of the defect in the cropped image; Represents the width and height of the defect annotation box after cropping. If the defect is completely outside the cropped area, the annotation is not retained. This formula ensures that the defect annotation information is correctly transformed after the weld area is cropped, maintaining data consistency.

[0047] Defect feature enhancement: Non-local mean denoising (NLM) is used to calculate the similarity of different image regions, effectively removing noise while maintaining image details. The NLM algorithm is expressed as: ; Where, represents the pixel value after denoising; I(q) represents the reference pixel in the image; Ω represents the search window; Np and Nq represent the local neighborhood blocks of pixels p and q respectively; h represents the parameter controlling the filter strength; Z(p) represents the normalization factor so that the sum of all weights is 1.

[0048] At the same time, adaptive histogram equalization (CLAHE) is used to enhance the contrast of the defect area and improve the detection visibility. The mathematical form of the CLAHE algorithm is as follows: ; Where CDF(v) represents the cumulative distribution function of the input pixel value v; CDFmin represents the minimum non-zero cumulative distribution value; M×N represents the number of pixels in the local window; and L represents the grayscale level.

[0049] 2. Second stage: weld defect detection model training and verification In this stage, the improved YOLOv11 model is trained to accurately detect and classify seven types of weld defects, and an ablation experiment is performed on the improved YOLOv11 model for comparison.

[0050] 1) The weld reconstruction dataset was divided into a training set and a validation set in a 7:3 ratio. The model was trained to detect seven types of defects: cracks, lack of fusion, lack of penetration, strip defects, circular defects, root concavity, and root bite. The learning rate was set to 0.001, the batch size was 16, and training was performed for 300 epochs.

[0051] 2) Model validation and performance evaluation Comparative experiments: Comparative experiments are conducted with the original YOLOv11 to verify the effectiveness of the improved ODConv and SlideLoss.

[0052] Evaluation indicators: Precision and Recall are used to evaluate model performance.

[0053] Accuracy refers to the proportion of correctly classified samples to the total number of samples in the prediction, reflecting the overall prediction performance of the model. The larger the value, the more accurate the overall prediction of the model. The calculation formula is as follows: ; Recall refers to the proportion of samples predicted to be positive among all samples that are actually positive, reflecting the model's ability to identify positive samples. The larger the value, the stronger the model's ability to identify positive samples. The calculation formula is as follows: ; Where TP (True Positive) represents the number of positive predictions when the object is positive; TN (True Negative) represents the number of negative predictions when the object is negative. FP (False Positive) represents the number of positive predictions when the object is negative; FN (False Negative) represents the number of negative predictions when the object is positive.

[0054] Experimental results: Ablation experiments were performed using the unmodified YOLOv11 model, the improved ODConv model, the improved SlideLoss model, and the model with both ODConv and SlideLoss improved. Table 1 shows the ablation experiment comparison results: Table 1. Comparison of ablation experiments The average detection accuracy of the YOLOv11 model with improved ODConv and SlideLoss reached 94.50%. Compared with the original YOLOv11 model, it has significantly improved in the weld area and various weld defects (cracks, lack of fusion, lack of penetration, strip defects, circular defects, root concave, root bite), effectively reducing false detections and missed detections. Figure 7 As shown in the figure, the effect of the YOLOv11 defect detection model in detecting weld defects is demonstrated.

[0055] S4. Input the inspection image into the YOLOv11 weld inspection model and the YOLOv11 defect detection model, and combine it with the defect segmentation algorithm to obtain a defect detection report for the inspection image.

[0056] In this optional embodiment, the inspection image is input into the YOLOv11 weld detection model and the YOLOv11 defect detection model, and combined with the defect segmentation process, a defect detection report for the inspection image is obtained, including the following steps: S41. Input the detection image into the YOLOv11 weld detection model and the YOLOv11 defect detection model, perform weld recognition and defect recognition on the detection image, and obtain weld recognition results and defect recognition results; S42, using a defect segmentation algorithm to process the inspection image to obtain defect size and location information; S43. Integrate the weld identification results, defect identification results, defect size and location information to obtain a defect detection report for the detection image.

[0057] In this optional embodiment, processing the inspection image using a defect segmentation algorithm to obtain defect size and location information includes the following steps: S421, performing enhancement and denoising processing on the detection image to obtain an enhanced image; S422, using a gradient filter to extract edges from the enhanced image to obtain an edge intensity map; S423, based on the edge intensity map, binarization is performed according to the Otsu method adaptive threshold segmentation method to obtain a mask map of the defect edge; S424. Based on the mask image of the defect edge, perform connected region analysis, calculate the minimum circumscribed rectangle of each region, and obtain the size and location information of the defect.

[0058] It should be noted that this paper develops an intelligent weld defect recognition system based on PyQt5. It implements a complete process from film import, weld recognition, image reconstruction and enhancement, defect identification, defect statistics, to film rating. The system uses an improved YOLOv11 model to detect weld areas and crop irrelevant background. Non-local means denoising (NLM) and adaptive histogram equalization (CLAHE) are used to enhance defect features and improve detection accuracy. The optimized YOLOv11 model can accurately identify seven types of defects: cracks, lack of fusion, lack of penetration, strip defects, circular defects, root concavity, and root bite. It also automatically calculates defect size, number, and distribution. Finally, a rating algorithm designed according to the "NB / T47013-2015 Nondestructive Testing of Pressure Equipment" standard assesses film quality, provides a visual analysis interface, and provides automatic inspection reports, thus enhancing the intelligent level of pressure pipeline weld inspection.

[0059] In order to accurately extract the size information of the defect, it is necessary to separate the identified defect from the background. To this end, the present invention designs a set of defect segmentation algorithms that automatically perform image enhancement and denoising, edge extraction and segmentation, contour analysis and rectangle extraction, such as Figure 8 As shown in the figure, the effect of defect segmentation processing is shown. The specific steps of the defect segmentation algorithm are as follows: 1) Image enhancement and denoising Grayscale normalization and translation: Since different DR images are affected by factors such as equipment parameters and exposure conditions during acquisition, their overall brightness varies significantly. To ensure the uniformity and robustness of subsequent image processing, the image grayscale values are normalized and the minimum grayscale value Gmin is translated to a unified reference value T (such as 25) to achieve brightness normalization across images. The expression formula for this operation is: ; Where I represents the original image; I′ represents the image after grayscale shift; T represents the set grayscale reference value (such as 25); Gmin=min(I) represents the minimum grayscale value in the image.

[0060] Contrast enhancement and brightness adjustment: To further enhance the grayscale difference between the defect and the background in the image, the contrast is adaptively enhanced according to the maximum grayscale value Gmax of the image, and a negative offset is introduced to compress the brightness to make the feature more prominent. This enhancement process can be modeled as a linear grayscale transformation, and its expression formula is: ; Where I′′ represents the enhanced image; α represents the contrast enhancement factor (K represents a set constant, such as 305); β represents the brightness adjustment coefficient (usually a negative value, used to compress highlight areas); Gmax=max(I′) represents the maximum grayscale value in the image.

[0061] Then, non-local mean filtering is applied to the detection image to denoise and suppress background interference to obtain an enhanced image.

[0062] 2) Edge Detection After image enhancement and denoising, the Scharr operator is used to perform edge detection on the image to further extract the boundary contours of weld defects. The Scharr operator is an enhanced gradient filter that retains edge direction information while exhibiting stronger rotational invariance and edge sharpening capabilities. The specific operation includes: calculating the image's gradient response in the horizontal (x-axis) and vertical (y-axis) directions; and combining the gradient magnitudes in these two directions into an overall edge intensity map. The process is expressed as follows: ; Where Gx and Gy represent the gradients of the image in the horizontal and vertical directions respectively; G represents the overall edge intensity map.

[0063] Otsu adaptive threshold segmentation (Otsu method adaptive threshold segmentation): To accurately separate the significant edge regions from the background, we use Otsu's adaptive thresholding method to binarize the edge map. This method automatically calculates the optimal threshold for segmenting the foreground and background in an image based on the principle of maximizing inter-class variance. The process can be expressed as follows: Let the image grayscale be L, the total number of pixels be N, and the grayscale threshold t divide the image into: Category C0: pixels with grayscale value ≤ t (foreground); Category C1: pixels with grayscale value > t (background).

[0064] The expression formula of between-class variance is: ; Where ω0(t) represents the pixel ratio (weight) of category C0; ω1(t)=1-ω0(t) represents the pixel ratio of category C1; μ0(t) and μ1(t) represent the average grayscale of category C0 and category C1, respectively.

[0065] The optimal threshold Totsu is expressed by traversing all possible t: ; The final binary image expression formula is: ; Where G(x,y) represents the edge intensity image; B(x,y) represents the edge mask image, indicating whether the edge exists or not.

[0066] 3) Minimum bounding rectangle extraction and visualization After completing the edge binary segmentation, the present invention further performs structured processing on the defect target. First, a connected component analysis is performed on the binary mask image B(x, y) to extract each independent defect edge region.

[0067] For each connected region, calculate its minimum bounding rectangle (MBR), that is, find a rotated rectangle with the smallest area that can contain the entire region. The specific calculation method includes: Extract edge contour points of connected areas; Calculate the convex hull of the contour; In all possible boundary directions, search for the rotation angle that minimizes the area of the circumscribed rectangle; Determine the final minimum rectangle corner coordinates.

[0068] This rectangle accurately describes the spatial location and shape of the defect, providing information about its size and location. To enhance the visualization of the segmentation results, the present invention overlays the extracted minimum bounding rectangle with a green outline on the processed image, while retaining the red edge line to indicate the defect boundary. The resulting image features clear boundaries and accurate contours, facilitating direct use and application in subsequent intelligent defect assessment systems.

[0069] like Figure 2 As shown, according to another embodiment of the present invention, a welding radiographic film defect detection system is provided, the system comprising: a data set construction module 1, a YOLOv11 neural network model optimization module 2, a dual-model two-stage training module 3, and a defect detection report generation module 4; Dataset construction module 1 is used to obtain digital radiographic images of welds, annotate them, and construct weld datasets; YOLOv11 neural network model optimization module 2 is used to build a YOLOv11 neural network model and optimize the YOLOv11 neural network model using the SlideLoss classification loss function to obtain the optimized YOLOv11 neural network model; Dual-model two-stage training module 3 is used to train the optimized YOLOv11 neural network model based on the weld dataset using a dual-model two-stage training strategy to obtain a YOLOv11 weld detection model and a YOLOv11 defect detection model; The defect detection report generation module 4 is used to input the detection image into the YOLOv11 weld detection model and the YOLOv11 defect detection model, and combine it with the defect segmentation algorithm to obtain a defect detection report for the detection image.

[0070] In summary, leveraging the above-mentioned technical solutions, the present invention adopts a two-stage training strategy: first, weld region detection and irrelevant background removal are performed. Subsequently, intelligent image processing techniques (NLM denoising and CLAHE enhancement) are combined to optimize image quality and improve the model's adaptability to weld defects. The present invention introduces ODConv to replace the Conv in the C3k2 module of the traditional YOLOv11, and uses the SlideLoss loss function to enhance the model's learning ability for difficult-to-classify samples, thereby improving model recognition accuracy. Combining model improvements with the two-stage training strategy, the model achieves significant improvements in average detection accuracy for seven typical weld defect types (cracks, lack of fusion, incomplete penetration, strip defects, circular defects, root concavity, and root bite), with an average detection precision of 94.50% and an average detection accuracy of 93.73%. Through a series of automated operations, including batch image import, weld region identification, image reconstruction and preprocessing, defect detection, and film grading, the present invention achieves efficient and intelligent weld defect detection, significantly improving work efficiency.

[0071] Although the present invention has been disclosed above with reference to preferred embodiments, the embodiments are merely examples for the purpose of illustration and are not intended to limit the present invention. Those skilled in the art may make various modifications and alterations without departing from the spirit and scope of the present invention. The scope of protection claimed by the present invention shall be subject to the claims.

Claims

1. A method for detecting defects in welding radiographic films, characterized in that: The method comprises the following steps: S1. Obtain digital radiographic images of welds, annotate them, and construct weld datasets. S2. Build a YOLOv11 neural network model and use the SlideLoss classification loss function to optimize the YOLOv11 neural network model to obtain the optimized YOLOv11 neural network model; S3. Based on the weld dataset, a dual-model two-stage training strategy is adopted to train the optimized YOLOv11 neural network model to obtain the YOLOv11 weld detection model and the YOLOv11 defect detection model. S4. Input the inspection image into the YOLOv11 weld inspection model and the YOLOv11 defect detection model, and combine it with the defect segmentation algorithm to obtain a defect detection report for the inspection image.

2. A welding radiographic film defect detection method according to claim 1, characterized in that: The steps of obtaining a digital radiographic image of a weld, annotating it, and constructing a weld dataset include the following steps: S11. Obtaining a digital radiographic image of the weld using a digital radiographic imaging system; S12. Annotating the digital radiographic image of the weld using detection and annotation software, wherein the annotation content includes: weld area and weld defects; S13. Construct a weld dataset based on the annotation content.

3. A welding radiographic film defect detection method according to claim 1, characterized in that: The YOLOv11 neural network model is constructed and optimized using the SlideLoss classification loss function to obtain the optimized YOLOv11 neural network model, which includes the following steps: S21. Build the YOLOv11 neural network model based on the ODConv module; S22. Use the SlideLoss classification loss function to dynamically adjust the weights of positive and negative samples and optimize the YOLOv11 neural network model.

4. A welding radiographic film defect detection method according to claim 3, characterized in that: The YOLOv11 neural network model is constructed based on the ODConv module, including: Use the ODConv module to replace the C3K2-ODConv module in the YOLOv11 neural network model. The C3K2-ODConv module consists of a Conv module, a Split module, a C3K-ODConv module, a Bottleneck-ODConv module, and a Concat module. The C3K-ODConv module consists of initial convolution, two-branch convolution, Concat and final convolution; the Bottleneck-ODConv module consists of ODConv convolution layer and Shortcut.

5. The method for detecting defects in welding radiographic films according to claim 1, wherein: The method adopts a dual-model two-stage training strategy based on the weld dataset to train the optimized YOLOv11 neural network model to obtain the YOLOv11 weld detection model and the YOLOv11 defect detection model, including the following steps: S31, dividing the weld dataset into a weld training set and a weld verification set, and training an optimized YOLOv11 neural network model based on the weld training set and the weld verification set to obtain a YOLOv11 weld detection model; S32. Use the YOLOv11 weld detection model to obtain weld area detection results. Based on the weld area detection results and combined with the defect annotation algorithm, a weld reconstruction dataset is constructed. S33. Based on the weld reconstruction dataset, the optimized YOLOv11 neural network model is trained to obtain the YOLOv11 defect detection model.

6. A welding radiographic film defect detection method according to claim 5, characterized in that: The method of using the YOLOv11 weld detection model to obtain weld area detection results and constructing a weld reconstruction dataset based on the weld area detection results and in combination with a defect annotation algorithm includes the following steps: S321. Using the YOLOv11 weld detection model, obtain weld area detection results; S322. Reconstruct the weld image based on the weld area detection result and the defect annotation reconstruction algorithm to obtain an initial weld reconstructed image dataset; S323, using a non-local means denoising algorithm, denoising the initial weld reconstructed image dataset to obtain a denoised weld reconstructed image dataset; S324. Based on an adaptive histogram equalization algorithm, the denoised weld reconstructed image dataset is processed to obtain a weld reconstructed image dataset.

7. The method for detecting defects in welding radiographic films according to claim 5, wherein: The method of training the optimized YOLOv11 neural network model based on the weld reconstruction dataset to obtain the YOLOv11 defect detection model includes the following steps: S331, dividing the weld reconstruction dataset into a weld reconstruction training set and a weld reconstruction verification set; S332. Based on the weld reconstruction training set and the weld reconstruction verification set, train the optimized YOLOv11 neural network model to obtain a YOLOv11 defect detection model; S333. Evaluate the performance of the YOLOv11 defect detection model based on precision and recall.

8. The method for detecting defects in welding radiographic films according to claim 1, wherein: The step of inputting the inspection image into the YOLOv11 weld inspection model and the YOLOv11 defect detection model, and combining the defect segmentation process to obtain a defect inspection report for the inspection image includes the following steps: S41. Input the detection image into the YOLOv11 weld detection model and the YOLOv11 defect detection model, perform weld recognition and defect recognition on the detection image, and obtain weld recognition results and defect recognition results; S42, using a defect segmentation algorithm to process the inspection image to obtain defect size and location information; S43. Integrate the weld identification results, defect identification results, defect size and location information to obtain a defect detection report for the detection image.

9. A welding radiographic film defect detection method according to claim 8, characterized in that: The process of processing the detection image using the defect segmentation algorithm to obtain the size and location information of the defect includes the following steps: S421, performing enhancement and denoising processing on the detection image to obtain an enhanced image; S422, using a gradient filter to extract edges from the enhanced image to obtain an edge intensity map; S423, based on the edge intensity map, binarization is performed according to the Otsu method adaptive threshold segmentation method to obtain a mask map of the defect edge; S424. Based on the mask image of the defect edge, perform connected region analysis, calculate the minimum circumscribed rectangle of each region, and obtain the size and location information of the defect.

10. A welding radiographic film defect detection system, used to implement a welding radiographic film defect detection method according to any one of claims 1 to 9, characterized in that: The system includes: a dataset construction module, a YOLOv11 neural network model optimization module, a dual-model two-stage training module, and a defect detection report generation module; A data set construction module is used to obtain digital radiographic images of welds, annotate them, and construct weld data sets; YOLOv11 neural network model optimization module, which is used to build the YOLOv11 neural network model and optimize the YOLOv11 neural network model using the SlideLoss classification loss function to obtain the optimized YOLOv11 neural network model; The dual-model two-stage training module is used to train the optimized YOLOv11 neural network model based on the weld dataset using a dual-model two-stage training strategy to obtain the YOLOv11 weld detection model and the YOLOv11 defect detection model; The defect detection report generation module is used to input the inspection image into the YOLOv11 weld detection model and the YOLOv11 defect detection model, and combine it with the defect segmentation algorithm to obtain a defect detection report for the inspection image.

Citation Information

Patent Citations

  • Weld joint positioning and defect detection system and method based on deep learning

    CN119417800A

  • Pipeline weld joint automatic identification and defect detection method and device

    CN111091538A

Cited By

  • Intraocular pressure measuring device and measuring method

    CN120477694A

  • Weld defect intelligent identification and distribution visualization method and system

    CN120912617A

  • Ampoule bottle head defect detection method and system based on multi-scale feature fusion

    CN121505344A