Ultrasonic image defect segmentation method based on memory bank-patch denoising diffusion probability model
By employing an unsupervised learning method based on a memory-patch denoising diffusion probability model, the problem of ultrasonic image defect segmentation's dependence on labeled data was solved, achieving high-precision defect segmentation without the need for labeled data and improving the intelligence level of ultrasonic image detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-22
- Publication Date
- 2026-03-31
AI Technical Summary
Existing ultrasound image defect segmentation methods rely on a large amount of manually labeled data, which is costly, time-consuming, and prone to human interference. Furthermore, they are difficult to effectively eliminate noise and edge blurring interference in ultrasound images, resulting in insufficient segmentation accuracy.
An unsupervised learning method based on a memory-patch denoising diffusion probability model is adopted. By training with defect-free full-focus images and using the memory mechanism to enhance feature learning, automatic defect segmentation is achieved, reducing the dependence on label data.
Without the need for labeled data, it significantly improves the accuracy and precision of defect segmentation in ultrasound images, reduces human interference, and achieves more accurate defect segmentation, making it suitable for practical engineering applications.
Smart Images

Figure CN121767390A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for ultrasonic image defect segmentation based on a memory-patch denoising diffusion probability model, which belongs to the field of ultrasonic nondestructive testing. Background Technology
[0002] Ultrasonic imaging can visually display the shape, size, and other features of defects in an object being inspected, aiding in the quantitative evaluation of defects. However, achieving accurate segmentation of defects in ultrasonic images is extremely challenging. With the rapid development of deep learning technology, combining deep learning methods with ultrasonic imaging can improve the efficiency and accuracy of defect segmentation while reducing human interference. However, most existing image segmentation methods are based on supervised learning, requiring a large amount of manually labeled data during training. In practical engineering applications, large amounts of labeled data are often difficult to obtain. Manual annotation is not only costly and time-consuming but also prone to introducing human interference, leading to unstable segmentation efficiency and accuracy. Furthermore, the inherent noise and blurred edges of ultrasonic images make it difficult for existing methods to effectively eliminate interference from irrelevant regions, resulting in insufficient segmentation accuracy for defect areas. Summary of the Invention
[0003] The aim of this method is to provide an ultrasound image defect segmentation approach based on a memory-patch denoising diffusion probability model (MB-pDDPM). The memory-based patch denoising diffusion probability model is an unsupervised learning method. Model training relies solely on defect-free full-focus images; training on only normal images is sufficient to identify abnormal regions in full-focus images and achieve automatic defect segmentation. Compared to existing methods, this is an unsupervised anomaly detection method that does not require labeled data for training. By using a memory feature enhancement module, interference from other regions in the ultrasound image can be effectively eliminated, achieving accurate defect segmentation. This method significantly reduces the difficulty of acquiring and training labeled data for ultrasound imaging detection, minimizes human interference, and has significant implications for practical engineering applications.
[0004] The technical solution adopted in this invention is as follows: A method for defect segmentation of ultrasound images based on a memory-patch denoising diffusion probability model, comprising the following steps: S1. Based on the ultrasonic array imaging system, select an appropriate detection method and perform ultrasonic testing on both defect-free and defective test blocks; S2. Acquire the detection data of defect-free and defective test blocks, collect the A-scan data of each transmit-receive array element to obtain full matrix data, and image the data to obtain the corresponding fully focused detection image. S3. Train the memory bank-patch denoising diffusion probability model on the GPU. The model is based on the PyTorch architecture, uses Adam as the optimizer, and is trained using defect-free full-focus images. S4. Use a defective image for testing. Use the trained model to reconstruct the input image. Subtract the input image from the reconstructed image to obtain the defect segmentation result of the full-focus image.
[0005] Furthermore, in step S1, the ultrasonic array imaging system includes a phased array ultrasonic testing board, a linear array probe, and a probe wedge, and uses an oblique incidence detection method to detect the weld test block.
[0006] Furthermore, in step S2, a scanning method is used to detect different positions of the weld test block. The phased array ultrasonic testing board collects A-scan data of each transmitting-receiving array element, and performs time-delay superposition imaging on the collected data to display the detection results in image form.
[0007] Furthermore, step S3 specifically involves applying the diffusion process of the Denoising Diffusion Probabilistic Models (DDPM) in a block-by-block manner, sampling patches from a fixed grid during training. The patched Denoising Diffusion Probabilistic Models (pDDPM) anomaly detection only checks the patch location during forward diffusion. p k Noisy images x t Sampling was performed for M p ∈R C ,H,W It is a binary mask, which will p k Overlapping pixels are set to 1, and non-overlapping pixels are set to 0. A partially noisy image can be represented as follows: ; In the formula, This represents element-wise multiplication. During the reverse process, The input is fed into a denoising network to estimate a specified region and obtain a denoised image. To achieve block-by-block denoising, an objective function is used. To adapt ,get p k Noisy areas After all patch areas are reconstructed, they are stitched together according to the input position to achieve image reconstruction.
[0008] Furthermore, step S4 specifically involves: during the evaluation, respectively evaluating the first... k ∈[0, ..., KThe process involves performing a diffusion process on each patch. After all patches are reconstructed, the images are stitched together to achieve image reconstruction. Anomaly detection results are obtained by subtraction. The reconstructed image is obtained by averaging all stitched patches. Pixel-level errors are calculated between the input and reconstructed images. Morphological operations, contour closure, and multi-scale filling techniques are combined to obtain the image segmentation result.
[0009] The beneficial effects of this invention are as follows: Ultrasound full-focus images in this application are generally color images, which differ from medical black-and-white images. Therefore, the method extends the use of two-dimensional noise in black-and-white images to three-dimensional noise in color images. In full-focus images, the interference region usually does not coincide with the defect location. By introducing a memory bank mechanism, the accuracy of defect region identification and segmentation can be improved. Based on the characteristics of ultrasound full-focus images, this method can achieve accurate segmentation of defects in full-focus images without labels.
[0010] Traditional methods such as thresholding are prone to misjudgment and inaccurate segmentation when segmenting defects in fully focused images. Existing supervised learning-based image segmentation methods require a large number of training samples and corresponding labels, significantly raising the barrier to applying automatic segmentation algorithms to ultrasound image defect segmentation. This application presents a memory-based unsupervised anomaly detection method that can automatically segment ultrasound image defects without the need for labeled data, achieving superior segmentation performance. This method effectively alleviates the reliance on large amounts of manually labeled data, providing a more accurate solution for automatic ultrasound image defect segmentation and possessing practical significance for intelligent detection in ultrasound inspection. Attached Figure Description
[0011] Figure 1 This is a schematic diagram of ultrasonic testing of weld test block array.
[0012] Figure 2 This is a schematic diagram of the oblique incidence propagation path.
[0013] Figure 3 This is a schematic diagram of weld inspection.
[0014] Figure 4 This is a full-focus image of the weld.
[0015] Figure 5 Create a schematic diagram for the ground truth reference label of the full-focus image.
[0016] Figure 6 This is a workflow for ultrasonic image defect segmentation based on a memory-patch denoising diffusion probability model.
[0017] Figure 7 The image defect segmentation effect of different unsupervised anomaly detection methods in fully focused images.
[0018] Figure 8 A comparison of the segmentation performance of different unsupervised anomaly detection methods. Detailed Implementation
[0019] The present invention will be further described below with reference to the accompanying drawings, so that those skilled in the art can better understand and implement the present invention. The described embodiments are only some embodiments of the present invention, but the embodiments are not intended to limit the present invention.
[0020] This invention provides a method for defect segmentation of ultrasound images based on a memory-patch denoising diffusion probability model, comprising the following steps: (1) Based on the ultrasonic array imaging system, a suitable detection method was selected, and ultrasonic detection data of the test blocks with and without defects were obtained. In this embodiment, three butt welds of different thicknesses and made of 20# steel were prepared. The welds were welded using inert gas shielded welding, and the weld type was double V weld. Six test blocks of each type with thicknesses of 15 mm, 17 mm, and 20 mm were prepared. The dimensions of the weld test blocks were 250 mm × 80 mm × 15 mm, 250 mm × 80 mm × 17 mm, and 250 mm × 80 mm × 20 mm, respectively, for a total of 18 defect-free test blocks. In addition, 17 test blocks of the same size with three types of artificial damage, including inclined and vertical grooves with a length of 3-5 mm and circular side-drilled holes with a diameter of 2-3 mm, were prepared. The study included a total of 35 weld test blocks. The schematic diagram of the test blocks is shown in the figure. Figure 1 As shown.
[0021] (2) The ultrasonic array imaging system acquires detection data to obtain detection data for defect-free and defective test blocks. In this embodiment, when the sound wave is incident on the workpiece through the wedge, a wave mode conversion occurs. In order to more accurately identify defects in the weld, a transverse wave is used to detect the weld, thereby improving the detection sensitivity of defects. A pure transverse wave is generated in the test block, and the oblique incident propagation path is shown in the diagram. Figure 2 As shown.
[0022] (3) An oblique incidence scanning weld inspection method is adopted, and A-scan data of each transmitter-receiver array element is collected to obtain full matrix data. In the data processing stage, the delay is calculated and full-focus imaging is performed to achieve visual reconstruction of the weld inspection area; in order to quantitatively evaluate the segmentation accuracy of the model, reference labels (Ground Truth) for the defects are made for the full-focus images containing defects, such as... Figure 3 As shown.
[0023] (4) The diffusion process of the Denoising Diffusion Probabilistic Models (DDPM) is applied in a block-by-block manner, and patches are sampled from a fixed grid during training. The patched Denoising Diffusion Probabilistic Models (pDDPM) anomaly detection only samples the patch location during forward diffusion. p k Noisy images x t Sampling was performed for M p ∈R C,H,W It is a binary mask, which will p k Overlapping pixels are set to 1, and non-overlapping pixels are set to 0. A partially noisy image can be represented as follows:
[0024] In the formula, This represents element-wise multiplication. During the reverse process, The input is fed into a denoising network to estimate a specified region and obtain a denoised image. To achieve block-by-block denoising, an objective function is used. To adapt ,get p k Noisy areas After all patch areas are reconstructed, they are stitched together according to the input position to achieve image reconstruction.
[0025] In this application, unlike traditional black-and-white medical images, ultrasound full-focus images are presented in color. Therefore, the noise dimension is expanded from two-dimensional to three-dimensional to better adapt to the characteristics of full-focus images. Furthermore, to further improve the accuracy of defect region identification and segmentation, a memory mechanism is introduced. By strengthening the learning of features from defect-free images, the model's ability to identify defect regions is improved, thereby achieving accurate segmentation of defect regions.
[0026] During training, the MB-pDDPM model, based on the PyTorch architecture, was trained on an NVIDIA GeForce RTX 4090 GPU (24 GB) using 486 defect-free, full-focus images with a size of 256 × 256 pixels. Adam was used as the optimizer with a learning rate of 0.00001 and a batch size of 6. Simplex noise was used for uniform sampling t∈[1,T] during training, with T=1000 and a patch size of 64, for a total of 1000 epochs. During the testing phase, a fixed value was selected.t test =600 tests were performed on 102 full-focus images containing defects. The image size was 256 × 256 pixels. The model reconstructed the input images and obtained the defect segmentation results of the full-focus images.
[0027] To evaluate the segmentation performance differences among different unsupervised anomaly detection methods, five unsupervised anomaly detection methods were used to segment defective full-focus images, including a denoising autoencoder (DAE), a fast unsupervised anomaly detection with generative adversarial networks (f-AnoGAN), anomaly detection with denoising diffusion probabilistic models using simplex noise (AnoDDPM), a patched denoising diffusion probabilistic model (pDDPM), and the proposed MB-pDDPM. The segmentation results were then compared with the reference label Ground Truth.
[0028] Figure 7 The figure shows the defect segmentation performance of different unsupervised anomaly detection methods on fully focused images. As can be seen from the figure, compared with existing unsupervised anomaly detection methods, the proposed MB-pDDPM can accurately identify defect regions, and the segmentation results are closer to GroundTruth. To quantitatively evaluate the segmentation performance, the segmentation evaluation metrics of different unsupervised anomaly detection methods, namely Intersection over Union (IoU), Dice coefficient, and Precision, are calculated. The segmentation performance of different unsupervised anomaly detection methods is compared as follows: Figure 8As shown in the figure, the IoU, Dice, and Precision of the DAE method are 61.06%, 74.74%, and 73.74%, respectively; the IoU, Dice, and Precision of the f-AnoGAN method are 50.08%, 65.94%, and 53.13%, respectively, indicating poor segmentation performance; and the IoU, Dice, and Precision of AnoDDPM are 58.41%, 72.71%, and 64.11%, respectively, also failing to achieve accurate segmentation of defects. The IoU, Dice, and Precision of the pDDPM method are 75.82%, 86.11%, and 82.53%, respectively, showing a significant improvement in segmentation performance compared to the aforementioned methods. The MB-pDDPM method proposed in this paper achieves IoU, Dice, and Precision of 84.63%, 91.61%, and 90.73%, respectively, demonstrating a significant advantage over existing methods.
[0029] Based on the above steps, the proposed ultrasound image defect segmentation method based on a memory-patch denoising diffusion probability model significantly improves the accuracy of ultrasound image defect segmentation. It achieves accurate segmentation of defects in fully focused images under the premise of training with defect-free images. It can achieve automatic defect segmentation without labeled data and obtains superior segmentation performance. Traditional methods such as thresholding are prone to misjudgment and inaccurate segmentation when segmenting defects in fully focused images. Existing supervised learning-based image segmentation methods require a large number of training samples and corresponding labels, which significantly raises the barrier to applying automatic segmentation algorithms to ultrasound image defect segmentation. This method effectively alleviates the dependence on large amounts of manually labeled data, providing a more accurate solution for automatic ultrasound image defect segmentation and has certain value in improving the accuracy of ultrasound image segmentation.
[0030] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for defect segmentation in ultrasound images based on a memory-patch denoising diffusion probability model, characterized in that, Includes the following steps: S1. Based on the ultrasonic array imaging system, select the detection method and perform ultrasonic testing on both defect-free and defective test blocks; S2. Acquire the detection data of defect-free and defective test blocks, collect the A-scan data of each transmit-receive array element to obtain full matrix data, and image the data to obtain the corresponding fully focused detection image. S3. Train the memory-patch denoising diffusion probability model on the GPU. The model is based on the PyTorch architecture, uses Adam as the optimizer, and is trained using defect-free full-focus images; specifically: The diffusion process of the denoising diffusion probability model is applied in a block-by-block manner, sampling patches from a fixed grid during training; during forward diffusion, the anomaly detection of the patch denoising diffusion probability model only samples the patch location. p k Noisy images x t Sampling was performed for M p ∈R C,H,W It is a binary mask, which will p k Overlapping pixels are set to 1, and non-overlapping pixels are set to 0. This represents a partially noisy image as follows: ; In the formula, This represents element-wise multiplication; during the reverse process, The input is fed into a denoising network to estimate a specified region and obtain a denoised image. To achieve block-by-block denoising, an objective function is used. To adapt ,get p k Noisy areas After all patch areas are reconstructed, they are stitched together according to the input positions to achieve image reconstruction; S4. Test using images containing defects, reconstruct the input image using the trained model, subtract the reconstructed image from the input image, and combine morphological operations, contour closure and multi-scale filling techniques to obtain the defect segmentation result of the full-focus image.
2. The ultrasonic image defect segmentation method based on a memory-patch denoising diffusion probability model according to claim 1, characterized in that: In step S1, the ultrasonic array imaging system includes a phased array ultrasonic testing board, a linear array probe, and a probe wedge, and uses an oblique incidence scanning weld detection method to detect the sample.
3. The automatic ultrasound image segmentation method based on unsupervised learning according to claim 1, characterized in that: In step S2, a scanning method is used to detect different positions of the weld test block. The phased array ultrasonic testing board collects A-scan data of each transmitting-receiving array element, and performs time-delay superposition imaging on the collected data to display the detection results in image form.
4. The ultrasonic image defect segmentation method based on a memory-patch denoising diffusion probability model according to claim 1, characterized in that: Step S4 specifically involves: performing the following steps on the first... k ∈[0, ..., K The process involves performing a diffusion process on each patch, and after all patches are reconstructed, the images are stitched together to achieve image reconstruction. Anomaly detection results are obtained by subtraction. The reconstructed image is obtained by averaging all the patches. Pixel-level errors are calculated on the input and reconstructed images. Combined with morphological operations, contour closure, and multi-scale filling techniques, the image segmentation result is obtained.