Radiographic detection image defect identification method based on improved SwinT model

Through the improved SwinT model and multi-scale detection algorithm FPN, combined with Mask R-CNN and Cascade R-CNN models, the problems of background noise, model complexity and data processing requirements in ray detection technology are solved, and high-precision and low-complexity ray detection are achieved.

CN119887660APending Publication Date: 2025-04-25CHONGQING ZHENCE SCI & TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411931928.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-04-25

Smart Images

  • Figure CN119887660A_ABST
    Figure CN119887660A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of defect detection, in particular to a radiographic inspection image defect identification method based on an improved SwinT model, comprising the following steps: S1, acquiring to-be-detected image data of a detected workpiece, S2, preprocessing the to-be-detected image data; s3, building and optimizing a defect detection model, and inputting to-be-detected image data into the defect detection model for prediction; the defect detection model adopts an improved SwinT model, and S4, on the basis of a defect prediction result, feature-based identification is carried out, and a correct defect target is screened out. According to the invention, defect detection can be accurately carried out, and the operation difficulty is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of defect detection, and in particular to a method for identifying defects in a radiographic inspection image based on an improved SwinT model. Background Art

[0002] X-ray imaging technology has been widely used in industrial nondestructive testing, medical treatment, military and other fields. The industrial X-ray imaging system uses the penetration ability of X-rays on the workpiece to generate images of the inside of the workpiece through the attenuation changes caused by the density difference of the material and the structural characteristics. After the X-ray detection is completed, there are two main methods to evaluate the test results: one is to have experienced and qualified staff to conduct the evaluation; the other is to use computers for auxiliary evaluation. Manual evaluation is easily affected by equipment, working environment, film quality and subjective factors of the evaluator. In addition, environmental interference may lead to missed defects or misjudgment, and the requirements for film review personnel are high. Overall, manual evaluation is not only slow, but also cumbersome to record and modify, which greatly affects the efficiency of X-ray detection and is difficult to meet the needs of modern production development.

[0003] With the continuous advancement of science and technology, especially the breakthrough of deep learning technology, X-ray detection technology has made significant progress. In recent years, the development of deep learning has not only broken through many difficult visual problems and improved the level of image cognition, but also accelerated the progress of related technologies in the field of target detection. Applying the automatic learning method of image features in deep learning to defect detection in industrial CT images has become the mainstream research direction. However, the existing defect detection technology based on deep learning still has some major problems, including:

[0004] 1) The collected X-ray images are often accompanied by background noise, which brings certain challenges to the subsequent image processing and detection model training;

[0005] 2) There are many types of defect detection algorithms based on deep learning, and they need to be continuously optimized and adjusted, which makes the intelligent evaluation system complex and increases the difficulty of operation;

[0006] 3) The X-ray detection intelligent evaluation system involves multiple links such as X-ray image acquisition, annotation, processing, and detection model training and testing. Therefore, the system needs to have strong computing and data processing capabilities to ensure efficient processing of large amounts of image data and speed up detection.

[0007] 4) Due to the particularity of some artifacts, there is a lack of training samples required by the model. Summary of the invention

[0008] The purpose of the present invention is to provide a method for identifying defects in radiographic inspection images based on an improved SwinT model, which can solve the above-mentioned problems.

[0009] In order to achieve the above object, a method for identifying defects in radiographic inspection images based on an improved SwinT model is provided, comprising the following steps:

[0010] S1, obtaining image data to be detected of a workpiece, wherein the image data to be detected includes CT slice digital images or DR image data;

[0011] S2, preprocessing the image data to be detected;

[0012] S3. Build and optimize the defect detection model, and input the image data to be detected into the defect detection model for prediction;

[0013] The defect detection model is based on the improved SwinT model and specifically includes the following steps:

[0014] S301, obtaining a Cascade Mask R-CNN model that combines the Mask R-CNN model and the Cascade R-CNN model, and using the Cascade Mask R-CNN model as a backbone network;

[0015] S302. In each stage of the Cascade Mask R-CNN model, the Mask branch and the Bbox branch are changed from parallel to serial. The Bbox branch is executed first, and the regressed proposal box is sent to the Mask branch for mask prediction.

[0016] S303, by adding a connection between adjacent Mask branches, the Mask branches of the next stage are adjusted based on the Mask branches of the previous stage;

[0017] S304, the Mask branch uses the fully convolutional neural network FCN to perform semantic segmentation in the prediction box according to the regional features obtained by the ROI Align in the next stage, and then combines the obtained semantic information with the Mask branch;

[0018] S4. Based on the defect prediction results, feature-based identification is performed to screen out the correct defect targets.

[0019] Furthermore, the training and optimization of the defect detection model includes the following steps:

[0020] S311, obtaining the image data to be detected and the corresponding annotation files, and dividing them into a training set, a validation set, and a test set in proportion;

[0021] S312, using the training set to train the defect detection model, and using the verification set to verify the weight file obtained in each round of training, to obtain the weight file with the best performance on the verification set;

[0022] S313: Use the test set to test the weight file that performs best on the validation set to evaluate the performance of the defect detection model.

[0023] Furthermore, the steps of obtaining the weight file with the best performance on the validation set in step S312 are as follows:

[0024] S3121. Use the multi-scale detection algorithm FPN to improve the RPN in the defect detection model and generate a proposed candidate box for the feature map;

[0025] S3122, mapping the proposed candidate boxes to the feature map to obtain a corresponding feature matrix, and uniformly adjusting the feature matrix to a specified size through ROI Align;

[0026] S3123, passing the proposed candidate box through a three-stage cascade detector consisting of a target classifier and a bounding box regressor to obtain defect categories and bounding box regression parameters corresponding to three set thresholds; finally, a high-probability target box is screened out through a non-maximum suppression algorithm to obtain a final detection result;

[0027] S3124. The parameters of the improved SwinT defect detection model are set as follows: the initial learning rate is set to 0.001, the momentum is set to 0.9, the weight decay is set to 1e-4, the batch_size value is set to 1, the total number of training rounds is 600, the weights trained using the ImageNet dataset are used as pre-trained weights of the defect detection model, the image is uniformly resized to 1024×1024 before entering the defect detection model, and the Nadam algorithm is used to update the parameters of the defect detection model;

[0028] S3125. Use the training set to train the defect detection model through the above steps, and use the verification set to verify the weight file obtained in each round of training to obtain the weight file with the best performance on the verification set.

[0029] 5. Further, the bounding box regressor in the three-stage cascade detector is defined as follows:

[0030]

[0031] In the above formula: x represents the word image patch, b represents the sample distribution, f represents the bounding box regressor, and f 1, 、f 2, The thresholds set for f1 and f3 are 0.4, 0.5, and 0.6 respectively. The output of f1 is used as the input of f2, and the output of f2 is used as the input of f3. 1, 、f 2,, f3} optimizes the resampling distribution at different stages, and acts on the training and testing stages at the same time; the total loss function L of the training model is defined to include two parts: bounding box regression loss and target classification loss. The total loss function calculation formula is as follows:

[0032] L(x t ,g)=L cls (h t (x t ),X t )+μ[X t ≥1]L loc (f t (x t ,b t ),g)

[0033] In the above formula: L cls represents the loss function of target classification, L loc represents the loss function of bounding box regression, {bt} represents the sample distribution at different training stages t and has b t =f t-1 (x t-1 ,b t-1 ), h t represents the target classifier, f t represents the bounding box regressor, and g represents the corresponding x t The true target box parameters, μ represents the compromise coefficient, X t Represents x t The corresponding label,[·] indicates an exponential function.

[0034] Furthermore, the image preprocessing includes grayscale stretching, HDR image enhancement and image denoising, the grayscale stretching adopts piecewise linear grayscale stretching, the HDR image enhancement adopts CLAHE algorithm, and the image denoising adopts Gaussian denoising.

[0035] Furthermore, the calculation formula for the image enhancement is as follows:

[0036] y(n,m)=x(n,m)+λ·z(n,m)

[0037] Where x(n,m) is the original image, z(n,m) is the high-frequency image, and y(n,m) is the output image.

[0038] Further, the step S4 specifically includes the following steps:

[0039] S401, obtaining defect prediction results of a defect detection model;

[0040] S402, performing feature calculation of the defect area according to the defect prediction result, wherein the feature calculation indicators include defect grayscale level, signal-to-noise ratio, regional contrast and pixel area;

[0041] Read the feature analysis result parameters from the defect data set, perform feature analysis on the feature calculation results and the feature analysis result parameters, perform quantitative identification based on the feature analysis, identify and screen out the real defects, and output the identification and judgment results.

[0042] Further, the step S402 specifically includes the following steps:

[0043] S4021. Using the regional contrast as a screening index, calculate the average grayscale value in the defective region S1 and the non-defective region S2, and then calculate the contrast of the grayscales of the two regions; determine whether the defect is a real defect by using the contrast threshold, and obtain defect determination result 1; the calculation formula is as follows:

[0044]

[0045] Among them, M and N are the number of pixels in the length and width of the image respectively, g(i, j) and f(i, j) are the sample images of the image to be detected and the labeled data respectively, Mean1 is the average grayscale value of area 1, Mean2 is the average grayscale value of area 2, and C is the regional contrast of the defect; C and the threshold are used to determine whether the defect is a real defect.

[0046] Further, the step S402 specifically includes the following steps:

[0047] S4022. Calculate the pixel area S of the defect area S1 by using the pixel area as a screening index; determine whether the defect is a real defect by using the pixel area threshold, and obtain defect determination result 2.

[0048] Further, the step S402 specifically includes the following steps:

[0049] S4023. Using the signal-to-noise ratio as a screening index, respectively calculate the signal-to-noise ratios SNR1 and SNR2 of the defective area S1 and the non-defective area S2; and calculate the signal-to-noise ratios SNRY1 and SNRY2 of the defective area S1 and the non-defective area S2 of the manually labeled sample. The calculation formula is as follows:

[0050]

[0051] Wherein, M and N are the number of pixels in the length and width of the image respectively, g(i, j) and f(i, j) are the sample images of the image to be detected and the labeled data respectively; the signal-to-noise ratio of the sample defect area S1 and the non-defect area S2 are calculated respectively, and the signal-to-noise ratios SNRY1 and SNRY2 of the manually labeled sample defect area S1 and the non-defect area S2 are counted; T is the judgment index 3, the closer its value is to 1, the higher the probability of being a real defect, thus obtaining the defect judgment result 3;

[0052] S4024. Determine the authenticity of the defect according to defect determination result 1, defect determination result 2 or defect determination result 3.

[0053] Principles and advantages:

[0054] 1. The present invention improves the low accuracy of the target detection model based on a single threshold and the overfitting problem caused by increasing the threshold by introducing a three-stage cascade structure; improves RPN by using the multi-scale detection algorithm FPN, integrating low-level feature information with high resolution and high-level feature information with high semantics; introduces an efficient attention module into the cascade Mask R-CNN model, maintains similar accuracy results on the basis of simplifying the calculation amount of the Non-Local attention mechanism, and strengthens the original features by aggregating the same features at each position of the feature map. Compared with the existing two-stage target detection model and the original cascade Mask R-CNN model, the present invention significantly improves the detection accuracy of images. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 A flowchart of a method for identifying defects in a radiographic inspection image based on an improved SwinT model according to an embodiment of the present invention;

[0056] Figure 2 This is the structure diagram of the Cascade Mask R-CNN model;

[0057] Figure 3 The structure diagram of the Cascade Mask R-CNN model to improve the SwinT model;

[0058] Figure 4 is a schematic diagram of a cascaded mask prediction module;

[0059] Figure 5 Schematic diagram of the semantic segmentation structure;

[0060] Figure 6 A flowchart for screening out real defects. DETAILED DESCRIPTION

[0061] The following is further described in detail through specific implementation methods:

[0062] Example

[0063] A method for defect recognition in radiographic inspection images based on an improved SwinT model is basically as follows: Figure 1 As shown, the following steps are included:

[0064] S1, obtaining image data to be detected of a workpiece, wherein the image data to be detected includes CT slice digital images or DR image data;

[0065] S2. Preprocess the image data to be detected; the image preprocessing includes grayscale stretching, HDR image enhancement and image denoising. The grayscale stretching adopts piecewise linear grayscale stretching, the HDR image enhancement adopts CLAHE algorithm, and the image denoising adopts Gaussian denoising. The calculation formula of the image enhancement is as follows:

[0066] y(n,m)=x(n,m)+λ·z(n,m)

[0067] Where x(n,m) is the original image, z(n,m) is the high-frequency image, and y(n,m) is the output image.

[0068] S3. Build and optimize the defect detection model, and input the image data to be detected into the defect detection model for prediction;

[0069] The defect detection model is based on the improved SwinT model and specifically includes the following steps:

[0070] S301, obtaining a Cascade Mask R-CNN model that combines the Mask R-CNN model and the Cascade R-CNN model, and using the Cascade Mask R-CNN model as a backbone network;

[0071] Directly combine the Mask R-CNN model with the Cascade R-CNN model, add a mask prediction branch to the cascade detector, and the resulting Cascade Mask R-CNN model is as follows: Figure 2 The Cascade Mask R-CNN model continuously improves the quality of the input pre-selected box and improves the detection accuracy by connecting detectors in series.

[0072] S302, such as Figure 3 As shown in the figure, in each stage of the Cascade Mask R-CNN model, the Mask branch (mask prediction branch) and the Bbox branch (bounding box regression branch) are changed from parallel to serial. The Bbox branch is executed first, and the regressed proposal box is sent to the Mask branch for mask prediction, providing more accurate location information for the Mask branch.

[0073] S303, by adding a connection between adjacent Mask branches, the Mask branches of the next stage are adjusted based on the previous stage; Figure 4 As shown in the figure, the features of the previous stage are input into the next stage through convolution, so that both the regional features currently obtained through ROI Align and the features predicted in the previous stage can be obtained.

[0074] S304, Mask branch uses the fully convolutional neural network FCN to perform semantic segmentation in the prediction box according to the regional features obtained by ROI Align in the next stage, and then combines the obtained semantic information with the Mask branch; since each prediction box corresponds to only one object, it is equivalent to instance segmentation. In order to better distinguish the foreground from the background, a semantic segmentation head is added to the network, such as Figure 5 shown.

[0075] The semantic segmentation structure integrates global information, performs fine pixel-level classification on the entire image, and then combines the obtained semantic information with the mask prediction branch to better distinguish the foreground from the background. In order to reduce additional parameters, semantic segmentation uses feature maps of different levels output by the feature extraction network, adjusts them to the same scale and adds them together, and then predicts semantic segmentation features and semantic segmentation prediction results through a series of convolutions. The semantic segmentation features are fused with the features of the Bbox and Mask branches after ROI Align. The results of the semantic segmentation prediction are used to calculate the semantic segmentation error. The overall network structure is as follows: Figure 3 shown.

[0076] The training and optimization of the defect detection model includes the following steps:

[0077] S311. Obtain the image data to be detected and the corresponding annotation files, and divide them into a training set, a validation set, and a test set in proportion; obtain a CT slice digital image or a DR image and its corresponding annotation file, the pixel size of the slice digital image or the DR image is about 1000×1000, and the defect type is classified and graded as needed, and the image and the corresponding annotation file are randomly divided into a training set and a test set in a ratio of 8:2, and then 10% of the data is randomly divided from the training set as a validation set.

[0078] S312, using the training set to train the defect detection model, and using the verification set to verify the weight file obtained in each round of training, to obtain the weight file with the best performance on the verification set; the steps of obtaining the weight file with the best performance on the verification set in step S312 are as follows:

[0079] S3121. Using the multi-scale detection algorithm FPN to improve the RPN in the defect detection model, a proposed candidate box is generated for the feature map; the lateral connection in the FPN fuses the underlying feature information with high resolution and the high-level feature information with high semantics; generating a proposed candidate box for the feature map specifically includes the following steps:

[0080] First, a part of ResNeXt-101 is fed forward during the forward propagation of the network. The output of the last residual block of each level of ResNeXt-101 is recorded as {C1, C2, C3, C4, C5}. First, it is a bottom-up process. Each level uses a set step size for downsampling, and the layers that do not change the size of the feature map are grouped as one stage to form a feature pyramid. In order to strengthen the original features, the attention mechanism is introduced into the model. In {C3, C4, C5} of ResNeXt-1-1, 1×1 convolution and softmax are first used to obtain the attention weight, and the global context features are obtained through attention pooling. Secondly, after a 1×1 convolution and normalization, the ReLU activation function is used for nonlinear processing. After a 1×1 convolution, the importance of each channel is obtained. Finally, the global context features are aggregated to the features of each position by addition to form a long-distance dependency relationship;

[0081] Then, upsampling is used from top to bottom to enlarge the small feature map at the top layer to the same size as the feature map at the previous stage. Figure 1 The lateral connection fuses the up-sampling result with the feature map of the same size generated from the bottom up, and convolves each fusion result with a 3×3 convolution kernel to obtain the final feature layer P = {P2, P3, P4, P5}. After feature fusion, the feature layer P uses the K-means clustering algorithm to count the area and aspect ratio of the rectangular annotation box in the annotation file, and sets five areas {32 2 ,64 2 ,128 2 ,256 2 ,512 2 The anchors of each area correspond to the five feature layers {P2, P3, P4, P5} respectively. The P6 feature layer is obtained by downsampling the P5 feature layer. Seven aspect ratios {1:10, 1:5, 1:2, 1:1, 2:1, 5:1, 10:1} are set for the anchors of each area. The generated anchors slide and traverse on the feature layer to generate the proposed candidate box.

[0082] S3122, mapping the proposed candidate boxes to the feature map to obtain a corresponding feature matrix, and uniformly adjusting the feature matrix to a specified size through ROI Align;

[0083] S3123, the proposed candidate box is passed through a three-stage cascade detector consisting of a target classifier and a bounding box regressor to obtain the defect category and bounding box regression parameters corresponding to three set thresholds; finally, a high-probability target box is screened out through a non-maximum suppression algorithm to obtain the final detection result; the bounding box regressor in the three-stage cascade detector is defined as follows:

[0084]

[0085] In the above formula: x represents the word image patch, b represents the sample distribution, f represents the bounding box regressor, and f 1, 、f 2, The thresholds set for f1 and f3 are 0.4, 0.5, and 0.6 respectively. The output of f1 is used as the input of f2, and the output of f2 is used as the input of f3. 1, 、f 2, , f3} optimizes the resampling distribution at different stages, and acts on the training and testing stages at the same time; the total loss function L of the training model is defined to include two parts: bounding box regression loss and target classification loss. The total loss function calculation formula is as follows:

[0086] L(x t ,g)=L cls (h t (x t ),X t )+μ[X t ≥1]L loc (f t (x t ,b t ),g)

[0087] In the above formula: L cls represents the loss function of target classification, L loc represents the loss function of bounding box regression, {bt} represents the sample distribution at different training stages t and has b t =f t-1 (x t-1 ,b t-1 ), h t represents the target classifier, f t represents the bounding box regressor, and g represents the corresponding x t The true target box parameters, μ represents the compromise coefficient, X t Represents x t The corresponding label,[·] indicates an exponential function.

[0088] S3124. The parameters of the improved SwinT defect detection model are set as follows: the initial learning rate is set to 0.001, the momentum is set to 0.9, the weight decay is set to 1e-4, the batch_size value is set to 1, the total number of training rounds is 600, the weights trained using the ImageNet dataset are used as pre-trained weights of the defect detection model, the image is uniformly resized to 1024×1024 before entering the defect detection model, and the Nadam algorithm is used to update the parameters of the defect detection model;

[0089] S3125. Use the training set to train the defect detection model through the above steps, and use the verification set to verify the weight file obtained in each round of training to obtain the weight file with the best performance on the verification set.

[0090] S313, using the test set to test the weight file that performs best on the validation set, to evaluate the performance of the defect detection model. In this embodiment, the model and other target detection algorithms are trained and tested using the training set and the test set, respectively, and the accuracy AP and recall AR are used as evaluation indicators to compare the experimental results. As shown in Table 1:

[0091] Table 1 Comparative analysis of methods AP and RP

[0092]

[0093] According to the above table, it can be concluded that compared with the traditional two-stage target detection model, the defect detection model described in this embodiment has significantly improved the AP of buffer layer ablation defect detection, and the RP is also higher than other models.

[0094] In order to improve the detection capability of small defects in this patent, the impact of improving the SwinT model structure and parameters is analyzed and targeted improvements are made. First, the composition of the network model in Backbone and the feature extraction capability of each network layer are analyzed. The network structure of ResNeXt-101 is shown in Table 2 below:

[0095] Table 2 Network structure of ResNeXt-101

[0096]

[0097] In the table, the output of the last residual block of each level of ResNeXt-101 is recorded as {C1, C2, C3, C4, C5}. First, it is a bottom-up process. Each level is downsampled with a set step size, and the layers that do not change the size of the feature map are grouped as one stage to form a feature pyramid. In order to strengthen the original features, the attention mechanism is introduced into the model. In {C3, C4, C5} of ResNeXt-1-1, 1×1 convolution and softmax are first used to obtain the attention weight, and the global context features are obtained through attention pooling. Secondly, after a 1×1 convolution and normalization, the ReLU activation function is used for nonlinear processing. After a 1×1 convolution, the importance of each channel is obtained. Finally, the global context features are aggregated to the features of each position by addition to form a long-distance dependency relationship.

[0098] Then, upsampling is used from top to bottom to enlarge the small feature map at the top layer to the same size as the feature map at the previous stage. Figure 1 The lateral connection fuses the up-sampling result with the feature map of the same size generated from the bottom up, and convolves each fusion result with a 3×3 convolution kernel to obtain the final feature layer P = {P2, P3, P4, P5}. After feature fusion, the feature layer P uses the K-means clustering algorithm to count the area and aspect ratio of the rectangular annotation box in the annotation file, and sets five areas {32 2 ,64 2 ,128 2 ,256 2 ,512 2 The anchors of each area correspond to the five feature layers {P2, P3, P4, P5} respectively. The P6 feature layer is obtained by downsampling the P5 feature layer. Seven aspect ratios {1:10, 1:5, 1:2, 1:1, 2:1, 5:1, 10:1} are set for the anchors of each area. The generated anchors slide and traverse on the feature layer to generate the proposed candidate box.

[0099] S4: Based on the defect prediction results, feature-based identification is performed to screen out the correct defect targets. The step S4 specifically includes the following steps:

[0100] S401, obtaining defect prediction results of a defect detection model;

[0101] S402, performing feature calculation of the defect area according to the defect prediction result, wherein the feature calculation indicators include defect grayscale level, signal-to-noise ratio, regional contrast and pixel area;

[0102] Read the feature analysis result parameters from the defect data set, perform feature analysis on the feature calculation results and the feature analysis result parameters, perform quantitative identification based on the feature analysis, identify and screen out the real defects, and output the identification and judgment results.

[0103] The step S402 specifically includes the following steps:

[0104] S4021. Using the regional contrast as a screening index, calculate the average grayscale value in the defective region S1 and the non-defective region S2, and then calculate the contrast of the grayscales of the two regions; determine whether the defect is a real defect by using the contrast threshold, and obtain defect determination result 1; the calculation formula is as follows:

[0105]

[0106] Among them, M and N are the number of pixels in the length and width of the image respectively, g(i, j) and f(i, j) are the sample images of the image to be detected and the labeled data respectively, Mean1 is the average grayscale value of area 1, Mean2 is the average grayscale value of area 2, and C is the regional contrast of the defect; C and the threshold are used to determine whether the defect is a real defect.

[0107] S4022. Calculate the pixel area S of the defect area S1 by using the pixel area as a screening index; determine whether the defect is a real defect by using the pixel area threshold, and obtain defect determination result 2.

[0108]

[0109] S4023. Using the signal-to-noise ratio as a screening index, respectively calculate the signal-to-noise ratios SNR1 and SNR2 of the defective area S1 and the non-defective area S2; and calculate the signal-to-noise ratios SNRY1 and SNRY2 of the defective area S1 and the non-defective area S2 of the manually labeled sample. The calculation formula is as follows:

[0110]

[0111] Wherein, M and N are the number of pixels in the length and width of the image respectively, g(i, j) and f(i, j) are the sample images of the image to be detected and the labeled data respectively; the signal-to-noise ratio of the sample defect area S1 and the non-defect area S2 are calculated respectively, and the signal-to-noise ratios SNRY1 and SNRY2 of the manually labeled sample defect area S1 and the non-defect area S2 are counted; T is the judgment index 3, the closer its value is to 1, the higher the probability of being a real defect, thus obtaining the defect judgment result 3;

[0112] S4024. Determine the authenticity of the defect according to defect determination result 1, defect determination result 2 or defect determination result 3.

[0113] The above is only an embodiment of the present invention. The common sense such as the known specific structure and characteristics in the scheme is not described in detail here. The ordinary technicians in the relevant field know all the common technical knowledge in the technical field of the invention before the application date or priority date, can obtain all the existing technologies in the field, and have the ability to apply the conventional experimental means before that date. The ordinary technicians in the relevant field can improve and implement this scheme in combination with their own abilities under the enlightenment given by this application. Some typical known structures or known methods should not become obstacles for ordinary technicians in the relevant field to implement this application. It should be pointed out that for those skilled in the art, without departing from the structure of the present invention, several deformations and improvements can be made, which should also be regarded as the protection scope of the present invention, which will not affect the effect of the implementation of the present invention and the practicality of the patent. The protection scope required by this application shall be based on the content of its claims, and the specific implementation methods and other records in the specification can be used to interpret the content of the claims.

Claims

1. A method for identifying defects in radiographic inspection images based on an improved SwinT model, characterized in that: The following steps are involved: S1, obtaining image data to be detected of a workpiece, wherein the image data to be detected includes CT slice digital images or DR image data; S2, preprocessing the image data to be detected; S3. Build and optimize the defect detection model, and input the image data to be detected into the defect detection model for prediction; The defect detection model is based on the improved SwinT model and specifically includes the following steps: S301, obtaining a Cascade Mask R-CNN model that combines the Mask R-CNN model and the Cascade R-CNN model, and using the Cascade Mask R-CNN model as a backbone network; S302. In each stage of the Cascade Mask R-CNN model, the Mask branch and the Bbox branch are changed from parallel to serial. The Bbox branch is executed first, and the regressed proposal box is sent to the Mask branch for mask prediction. S303, by adding a connection between adjacent Mask branches, the Mask branches of the next stage are adjusted based on the Mask branches of the previous stage; S304, the Mask branch uses the fully convolutional neural network FCN to perform semantic segmentation in the prediction box according to the regional features obtained by ROIAlign in the next stage, and then combines the obtained semantic information with the Mask branch; S4. Based on the defect prediction results, feature-based identification is performed to screen out the correct defect targets.

2. According to claim 1, a method for identifying defects in radiographic inspection images based on an improved SwinT model is characterized by: The training and optimization of the defect detection model includes the following steps: S311, obtaining the image data to be detected and the corresponding annotation files, and dividing them into a training set, a validation set, and a test set in proportion; S312, using the training set to train the defect detection model, and using the verification set to verify the weight file obtained in each round of training, to obtain the weight file with the best performance on the verification set; S313: Use the test set to test the weight file that performs best on the validation set to evaluate the performance of the defect detection model.

3. The method for identifying defects in radiographic inspection images based on the improved SwinT model according to claim 2 is characterized in that: The steps of obtaining the weight file with the best performance on the validation set in step S312 are as follows: S3121. Use the multi-scale detection algorithm FPN to improve the RPN in the defect detection model and generate a proposed candidate box for the feature map; S3122, mapping the proposed candidate box to the feature map to obtain a corresponding feature matrix, and uniformly adjusting the feature matrix to a specified size through ROI Align; S3123, passing the proposed candidate box through a three-stage cascade detector consisting of a target classifier and a bounding box regressor to obtain defect categories and bounding box regression parameters corresponding to three set thresholds; finally, a high-probability target box is screened out through a non-maximum suppression algorithm to obtain a final detection result; S3124. The parameters of the improved SwinT defect detection model are set as follows: the initial learning rate is set to 0.001, the momentum is set to 0.9, the weight decay is set to 1e-4, the batch_size value is set to 1, the total number of training rounds is 600, the weights trained using the ImageNet dataset are used as pre-trained weights of the defect detection model, the image is uniformly resized to 1024×1024 before entering the defect detection model, and the Nadam algorithm is used to update the parameters of the defect detection model; S3125. Use the training set to train the defect detection model through the above steps, and use the verification set to verify the weight file obtained in each round of training to obtain the weight file with the best performance on the verification set.

4. The method for identifying defects in radiographic inspection images based on the improved SwinT model according to claim 3 is characterized in that: The bounding box regressor in the three-stage cascade detector is defined as follows: In the above formula: x represents the word image patch, b represents the sample distribution, f represents the bounding box regressor, and f 1, 、f 2, The thresholds set for f1 and f3 are 0.4, 0.5, and 0.6 respectively. The output of f1 is used as the input of f2, and the output of f2 is used as the input of f3. 1, 、f 2, , f3} optimizes the resampling distribution at different stages, and acts on the training and testing stages at the same time; the total loss function L of the training model is defined to include two parts: bounding box regression loss and target classification loss. The total loss function calculation formula is as follows: In the above formula: L cls represents the loss function of target classification, L loc represents the loss function of bounding box regression, {bt} represents the sample distribution at different training stages t and has b t =f t-1 (x t-1 ,b t-1 ), h t represents the target classifier, f t represents the bounding box regressor, g represents the corresponding x t The true target box parameters, μ represents the compromise coefficient, X t Represents x t The corresponding label,[·] indicates an exponential function.

5. The method for identifying defects in radiographic inspection images based on the improved SwinT model according to claim 1 is characterized in that: The image preprocessing includes grayscale stretching, HDR image enhancement and image denoising. The grayscale stretching adopts piecewise linear grayscale stretching, the HDR image enhancement adopts CLAHE algorithm, and the image denoising adopts Gaussian denoising.

6. The method for identifying defects in radiographic inspection images based on the improved SwinT model according to claim 5 is characterized in that: The calculation formula of the image enhancement is as follows: y(n,m)=x(n,m)+λ·z(n,m) Where x(n,m) is the original image, z(n,m) is the high-frequency image, and y(n,m) is the output image.

7. The method for identifying defects in radiographic inspection images based on the improved SwinT model according to claim 1, characterized in that: The step S4 specifically comprises the following steps: S401, obtaining defect prediction results of a defect detection model; S402, performing feature calculation of the defect area according to the defect prediction result, wherein the feature calculation indicators include defect grayscale level, signal-to-noise ratio, regional contrast and pixel area; Read the feature analysis result parameters from the defect data set, perform feature analysis on the feature calculation results and the feature analysis result parameters, perform quantitative identification based on the feature analysis, identify and screen out the real defects, and output the identification and judgment results.

8. The method for identifying defects in radiographic inspection images based on the improved SwinT model according to claim 7 is characterized in that: The step S402 specifically includes the following steps: S4021. Using the regional contrast as a screening index, calculate the average grayscale value in the defective region S1 and the non-defective region S2, and then calculate the contrast of the grayscales of the two regions; determine whether the defect is a real defect by using the contrast threshold, and obtain defect determination result 1; the calculation formula is as follows: Defect judgment results Among them, M and N are the number of pixels in the length and width of the image respectively, g(i, j) and f(i, j) are the sample images of the image to be detected and the labeled data respectively, Mean1 is the average grayscale value of area 1, Mean2 is the average grayscale value of area 2, and C is the regional contrast of the defect; C and the threshold are used to determine whether the defect is a real defect.

9. The method for identifying defects in radiographic inspection images based on the improved SwinT model according to claim 7, characterized in that: The step S402 specifically includes the following steps: S4022. Calculate the pixel area S of the defect area S1 by using the pixel area as a screening index; determine whether the defect is a real defect by using the pixel area threshold, and obtain defect determination result 2.

10. The method for identifying defects in radiographic inspection images based on the improved SwinT model according to claim 7, characterized in that: The step S402 specifically includes the following steps: S4023. Using the signal-to-noise ratio as a screening index, respectively calculate the signal-to-noise ratios SNR1 and SNR2 of the defective area S1 and the non-defective area S2; and calculate the signal-to-noise ratios SNRY1 and SNRY2 of the defective area S1 and the non-defective area S2 of the manually labeled sample. The calculation formula is as follows: Wherein, M and N are the number of pixels in the length and width of the image respectively, g(i, j) and f(i, j) are the sample images of the image to be detected and the labeled data respectively; the signal-to-noise ratio of the sample defect area S1 and the non-defect area S2 are calculated respectively, and the signal-to-noise ratios SNRY1 and SNRY2 of the manually labeled sample defect area S1 and the non-defect area S2 are counted; T is the judgment index 3, the closer its value is to 1, the higher the probability of being a real defect, thus obtaining the defect judgment result 3; S4024. Determine the authenticity of the defect according to defect determination result 1, defect determination result 2 or defect determination result 3.

Citation Information

Cited By

  • Pump body internal defect automatic identification method based on X-ray imaging

    CN120726060A

  • A pump body internal defect automatic identification method based on X-ray imaging

    CN120726060B