A machine vision-based phased array ultrasonic area-type image defect detection method
By employing a machine vision-based phased array ultrasonic area image defect detection method, this paper utilizes image quality assessment, adaptive median filtering, and histogram equalization algorithms for noise reduction, combined with K-means and eight-domain connectivity detection algorithms to locate defects. An improved LeNet-5 network is constructed to address the subjectivity and accuracy issues of traditional detection methods, achieving efficient and accurate defect detection.
Patent Information
- Application Number
- CN202510282929.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2045-03-11
AI Technical Summary
In the existing technology, traditional image defect detection methods rely on manual visual inspection, which is subjective and has insufficient defect detection accuracy. Furthermore, phased array ultrasonic area image defect detection fails to effectively remove interference factors, resulting in insufficient practicality and reliability.
A machine vision-based phased array ultrasonic area image defect detection method is adopted. Denoising and image enhancement are performed through image quality evaluation, adaptive median filtering and histogram equalization algorithms. Defect region localization is performed by combining K-means algorithm and eight-domain connectivity detection algorithm. An improved LeNet-5 network is constructed for defect detection.
It effectively eliminates the influence of structural artifacts and material noise, improves image segmentation results and defect recognition accuracy, shortens network training time, and enhances detection speed and accuracy.
Smart Images

Figure CN120125564B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of defect detection, specifically to a machine vision-based phased array ultrasonic area image defect detection method. Background Technology
[0002] Chinese patent CN114359193B discloses a defect classification method and system based on ultrasonic phased array imaging. The method specifically includes: acquiring ultrasonic phased array images of a sample under test, generating ultrasonic full matrix data; focusing the ultrasonic full matrix data; color encoding based on signal amplitude to obtain an image of the sample under test; preprocessing the image of the sample under test; training a classification prediction model to obtain a trained classification prediction model; inputting the preprocessed image into the trained classification prediction model to obtain the defect classification result of the sample under test, thus completing the defect classification. This invention does not perform depth processing on the image, resulting in a relatively slow classification speed.
[0003] Traditional image defect detection methods typically rely on manual visual inspection and defect assessment based on years of experience, resulting in subjective results. Furthermore, traditional phased array ultrasonic area-based image defect detection methods fail to eliminate interference factors, leading to insufficient accuracy in defect detection and requiring improvement in practicality and reliability. Summary of the Invention
[0004] To address the problems in related technologies, this invention provides a machine vision-based method for detecting defects in phased array ultrasonic area images, thereby overcoming the aforementioned technical problems in existing related technologies.
[0005] To solve the above-mentioned technical problems, the present invention is achieved through the following technical solution:
[0006] This invention relates to a machine vision-based method for detecting defects in phased array ultrasonic area images, comprising the following steps:
[0007] S1. Acquire phased array ultrasonic area images to obtain an initial phased array ultrasonic area image set. Evaluate the image quality of the initial phased array ultrasonic area image set based on the peak signal-to-noise ratio of the images to obtain a filtered phased array ultrasonic area image set.
[0008] S2. Denoising and image enhancement are performed on the selected phased array ultrasonic area images in the selected phased array ultrasonic area image set to complete image preprocessing and obtain the processed phased array ultrasonic area image set.
[0009] S3. Based on the improved defect region localization method, the processed phased array ultrasonic area image set is clustered by introducing the K-means algorithm, and then the eight-domain connectivity detection algorithm is used to locate and extract the defect region to obtain the final phased array ultrasonic area image set.
[0010] S4. Construct a new LeNet-5 network to obtain an improved LeNet-5 network. After training, obtain a LeNet-5 network detection model. Perform defect detection on the final phased array ultrasonic area image set and output the final defect detection result to achieve defect detection.
[0011] This invention acquires an initial set of phased array ultrasonic area images, evaluates the image quality of this set, and filters out images with significant differences by comparing peak signal-to-noise ratios with reference images. This effectively eliminates the influence of structural artifacts and material noise, reducing the difficulty of image processing. Secondly, the filtered phased array ultrasonic area images undergo denoising and image enhancement processing. For denoising, an adaptive median filtering algorithm is used. By comparing the similarity of pixels within the filtering window, noise points are selected and then denoised. This algorithm employs different denoising methods according to different noise types, overcoming the shortcomings of traditional median filtering algorithms and preserving image details better. Finally, a histogram equalization algorithm is used for image enhancement. This method effectively enhances image contrast and is simple to use. Furthermore, based on an improved defect region localization method and an eight-domain connectivity detection algorithm, defect regions are located and extracted. Compared to traditional defect region localization methods, the improved method introduces the K-means algorithm for clustering, significantly improving image segmentation performance. The eight-domain connectivity detection algorithm enables defect labeling and extraction, avoiding over-segmentation and demonstrating broad applicability. Finally, a new LeNet-5 network is constructed, and after training, a LeNet-5 network detection model is obtained to achieve defect detection. This neural network accelerates convergence by changing the activation function and convolutional layer size, shortening network training time while maintaining fewer parameters and increasing defect recognition accuracy.
[0012] Preferably, step S1 includes the following steps:
[0013] S11. Scan the material to be tested using a phased array probe to acquire a phased array ultrasonic area image. Select sampling points on the phased array ultrasonic area image; these sampling points are pixels. Quantize the sampling points to obtain an initial set of phased array ultrasonic area images. Select any initial phased array ultrasonic area image from this set, and denote it as the phased array ultrasonic area image to be evaluated. Select a standard phased array ultrasonic area image as a reference image. Set the size of both the phased array ultrasonic area image to be evaluated and the standard phased array ultrasonic area image to be used as m×n. Simultaneously select pixel coordinates (a,b). The pixel grayscale values corresponding to these coordinates are denoted as A′(a,b) and A″(a,b), respectively. The image mean square error is calculated using the following formula:
[0014]
[0015] Where A represents the mean square error of the phased array ultrasound area image to be evaluated and the standard phased array ultrasound area image.
[0016] The maximum pixel grayscale value on the phased array ultrasound area image to be evaluated is set to... The formula for calculating the peak signal-to-noise ratio of an image is as follows:
[0017]
[0018] Where α represents the peak signal-to-noise ratio of the phased array ultrasound area image to be evaluated and the standard phased array ultrasound area image;
[0019] S12. Calculate the peak signal-to-noise ratio (PSNR) of all initial phased array ultrasonic area images in the initial phased array ultrasonic area image set sequentially to obtain a peak SNR set. Set the SNR threshold as ω. When the peak SNR in the peak SNR set is greater than or equal to the SNR threshold, the initial phased array ultrasonic area image and the reference image corresponding to the peak SNR have no quality difference. Otherwise, the initial phased array ultrasonic area image and the reference image corresponding to the peak SNR have a quality difference. Delete the initial phased array ultrasonic area images with quality differences to complete the image quality evaluation and obtain the filtered phased array ultrasonic area image set.
[0020] This invention acquires an initial phased array ultrasonic area image set, evaluates the image quality of the initial phased array ultrasonic area image set, and compares the peak signal-to-noise ratio of the images with a reference image. This can effectively eliminate the influence of structural artifacts and material noise, screen out images with large differences, and reduce the difficulty of image processing.
[0021] Preferably, step S2 includes the following steps:
[0022] S21. An adaptive median filtering algorithm is used to denoise the selected phased array ultrasound area images in the selected phased array ultrasound area image set to obtain a denoised phased array ultrasound area image set. The specific steps are as follows:
[0023] S211. Select any filtered phased array ultrasonic area image from the set of filtered phased array ultrasonic area images, and denoise it as the phased array ultrasonic area image to be denoised. Set a first filter window and a second filter window on the phased array ultrasonic area image to be denoised.
[0024] The grayscale values of the pixels in the first filtering window are sorted, and the median of the pixel grayscale values is selected. The maximum and minimum pixel grayscale values in the first filtering window are found, and any pixel is selected and recorded as the first pixel. When the grayscale value of the first pixel is greater than or equal to the minimum pixel grayscale value and less than or equal to the maximum pixel grayscale value, the next pixel in the first filtering window is selected; otherwise, similarity is calculated using the following formula:
[0025]
[0026] Where β1 represents the similarity of the first pixel, and a′ represents the grayscale value of the first pixel. χ1 represents the median gray value of a pixel, and χ1 represents a small constant.
[0027] Set a similarity threshold. When the similarity of the first pixel is less than the similarity threshold, the first pixel is a noise point, and S213 is executed. Otherwise, the first pixel is not a noise point.
[0028] S212. Calculate the mean gray value of the pixels in the second filtering window, and denot it as the mean gray value of the pixels. Select any pixel in the second filtering window and denot it as the second pixel. Then, perform similarity calculation. The calculation formula is as follows:
[0029]
[0030] Where β2 represents the similarity of the second pixel, and a″ represents the grayscale value of the second pixel. χ² represents the mean gray value of a pixel, and χ² represents a small constant.
[0031] When the similarity of the second pixel is less than the similarity threshold, the second pixel is a noise point, and S213 is executed; otherwise, the second pixel is not a noise point.
[0032] S213. For the first pixel and the second pixel, sort the gray values of the pixels in the first filtering window and the second filtering window respectively to obtain the median gray value of the first filtering window and the median gray value of the second filtering window. Replace the gray value of the first pixel with the median gray value of the first filtering window and replace the gray value of the second pixel with the median gray value of the second filtering window to complete the denoising process. Continue until all the filtered phased array ultrasonic area images in the filtered phased array ultrasonic area image set have been denoised to obtain the denoised phased array ultrasonic area image set.
[0033] S22. Select any denoised phased array ultrasonic area image from the set of denoised phased array ultrasonic area images, and denote it as the phased array ultrasonic area image to be enhanced; set the gray level random variable of the phased array ultrasonic area image to be enhanced as b′, and b′∈[0,1], set the probability density function of the gray level random variable b′, establish the cumulative distribution function of the gray level random variable b′, integrate both sides of the cumulative distribution function of the gray level random variable b′, and then combine it with the probability density function of the gray level random variable b′ to obtain the probability of the pixel gray value of the phased array ultrasonic area image to be enhanced at different gray levels, draw the gray level histogram of the phased array ultrasonic area image to be enhanced, transform the gray level histogram of the phased array ultrasonic area image to be enhanced, complete the image enhancement, obtain the processed phased array ultrasonic area image, and generate the set of processed phased array ultrasonic area images.
[0034] This invention uses an adaptive median filtering algorithm to denoise the filtered phased array ultrasound area images. By comparing the similarity of pixels within the filtering window, noise points are selected and then denoised. This algorithm uses different denoising methods according to different noise types, overcoming the shortcomings of traditional median filtering algorithms and preserving image details better. It also uses a histogram equalization algorithm for image enhancement, effectively enhancing image contrast, and is simple to use.
[0035] Preferably, step S3 includes the following steps:
[0036] S31. The processed phased array ultrasonic area image set is clustered using the K-means algorithm to segment the defect region, resulting in a binary phased array ultrasonic area image set. The specific steps are as follows:
[0037] S311. The processed phased array ultrasonic area image set is filtered to extract texture features to obtain the texture features corresponding to each processed phased array ultrasonic area image. The texture features of similar pixels are connected to obtain feature vectors. Any k feature vectors are selected as the center of the cluster. The Euclidean distance from each feature vector to the center of the cluster is calculated. The feature vector corresponding to the minimum Euclidean distance from each feature vector to the center of the cluster is added to the cluster to obtain several clusters.
[0038] S312. Set the number of clusters to 3, and denote them as defect region cluster, defect-free region cluster and transition region cluster respectively. Calculate the Euclidean distance from each feature vector to the center of the cluster in several clusters. Continuously update the clusters until the center of the cluster no longer changes, and obtain the final defect region cluster, the final defect-free region cluster and the final transition region cluster.
[0039] S313. Traverse the final defect region cluster, find the minimum pixel gray value, and use the minimum pixel gray value as a global threshold. Use the global threshold to segment the processed phased array ultrasonic area image in the processed phased array ultrasonic area image set, and perform binarization processing to obtain a binarized phased array ultrasonic area image set.
[0040] S32. Morphological processing is performed on the binary phased array ultrasonic area images in the set of binary phased array ultrasonic area images to obtain a set of morphologically processed binary phased array ultrasonic area images; any morphologically processed binary phased array ultrasonic area image is selected from the set of morphologically processed binary phased array ultrasonic area images and denoted as a defect extraction phased array ultrasonic area image; a pixel is selected on the defect extraction phased array ultrasonic area image and denoted as the current pixel; the defect extraction phased array ultrasonic area image is scanned to obtain the eight neighboring pixels of the current pixel; a distance threshold is set to ψ; when the distance between the eight neighboring pixels and the current pixel is less than or equal to the distance threshold, the corresponding eight neighboring pixels are marked; otherwise, the corresponding eight neighboring pixels are not marked, and the marked eight neighboring pixels and the current pixel are connected to form an initial connected region;
[0041] S33. Determine the maximum and minimum values of pixel coordinates in the initial connected region to obtain the maximum and minimum pixel coordinates. The maximum and minimum pixel coordinates are the boundaries of the initial connected region. Treat the pixels at the maximum and minimum pixel coordinates as the current pixels. Repeat S32 to continuously update the initial connected region until the current pixel crosses the boundary to obtain the final connected region. Complete the defect region localization and extract the final connected region to obtain the final phased array ultrasonic area image, forming the final phased array ultrasonic area image set.
[0042] This invention locates and extracts defect regions based on an improved defect region localization method and an eight-domain connectivity detection algorithm. It introduces the K-means algorithm for clustering to improve the traditional defect region localization method, which can greatly improve the image segmentation effect compared with the traditional defect region localization method. The eight-domain connectivity detection algorithm realizes defect labeling and extraction, avoids the problem of over-segmentation, and has universal applicability.
[0043] Preferably, step S4 includes the following steps:
[0044] S41. Construct a new LeNet-5 network. Input the image to be detected from the input layer, pass through the first convolutional layer with a kernel size of φ1×φ1 and a stride of 1, then pass through the first pooling layer with a kernel size of φ2×φ2 and a stride of 1, reach the second convolutional layer with a kernel size of φ1×φ1, and then pass through the second pooling layer, the third convolutional layer, and the third pooling layer respectively. The third pooling layer is connected to the fully connected layer. The fully connected layer obtains the defect detection result, and the output layer outputs the defect detection result. The defect detection result includes cracks, lack of fusion, incomplete penetration, porosity, and slag inclusions, thus obtaining an improved LeNet-5 network.
[0045] S42. Reacquire phased array ultrasonic area images to obtain a new set of phased array ultrasonic area images. After filtering, denoising, image enhancement, and defect region localization and extraction of the new phased array ultrasonic area images in the new set, a set of phased array ultrasonic area image samples is obtained. Then, the phased array ultrasonic area image sample set is flipped to obtain an expanded set of phased array ultrasonic area image samples. After labeling the expanded set of phased array ultrasonic area image samples according to the defect detection results, an improved LeNet-5 network is trained to obtain the LeNet-5 network detection model. The specific steps are as follows:
[0046] S421. The improved LeNet-5 network is set to use the Leaky-ReLU function as the activation function, the squared loss function as the loss function, and the initial learning rate as γ. The extended phased array ultrasound area image sample set is randomly divided into a sample training set and a sample test set. The sample training set is then input into the improved LeNet-5 network and iterated continuously until the improved LeNet-5 network converges, thus obtaining the trained LeNet-5 network.
[0047] S422. Input the sample test set into the trained LeNet-5 network, set the accuracy threshold to ξ, and when the accuracy of the output result is greater than the accuracy threshold, the LeNet-5 network detection model is obtained; otherwise, adjust the network parameters and weights until the accuracy of the output result is greater than the accuracy threshold.
[0048] S43. Label the final phased array ultrasonic area image in the final phased array ultrasonic area image set, input the final phased array ultrasonic area image set into the LeNet-5 network detection model, and output the final defect detection results; the output label 0 indicates that the phased array ultrasonic area image has no defects, the output label 1 indicates that the phased array ultrasonic area image has crack defects, the output label 2 indicates that the phased array ultrasonic area image has incomplete fusion defects, the output label 3 indicates that the phased array ultrasonic area image has incomplete penetration defects, the output label 4 indicates that the phased array ultrasonic area image has porosity defects, and the output label 5 indicates that the phased array ultrasonic area image has slag inclusion defects, thereby realizing defect detection.
[0049] This invention accelerates network convergence by constructing a new LeNet-5 network and changing the activation function and convolutional layer size. After training, a LeNet-5 network detection model is obtained to achieve defect detection. This can shorten network training time and increase defect recognition accuracy while maintaining fewer parameters.
[0050] This invention also discloses a system for a phased array ultrasonic area image defect detection method based on machine vision, specifically including: an image quality evaluation module, an image preprocessing module, a defect region localization and extraction module, and a neural network defect detection module;
[0051] The image quality evaluation module is used to evaluate the image quality of the initial phased array ultrasound area image based on the peak signal-to-noise ratio.
[0052] The image preprocessing module is used to perform noise reduction and image enhancement processing on the screened phased array ultrasonic area images.
[0053] The defect region localization and extraction are performed using an improved defect region localization method and an eight-domain connectivity detection algorithm.
[0054] The neural network defect detection module is used to perform defect detection on the final phased array ultrasonic area image using the LeNet-5 network detection model.
[0055] The present invention has the following beneficial effects:
[0056] 1. This invention evaluates the image quality of an initial phased array ultrasonic area image set and compares the peak signal-to-noise ratio of the images with a reference image. This effectively eliminates the influence of structural artifacts and material noise, filters out images with significant differences, and reduces the difficulty of image processing.
[0057] 2. This invention uses an adaptive median filtering algorithm to denoise the filtered phased array ultrasound area images. This algorithm uses different denoising methods according to different noise types, overcoming the shortcomings of traditional median filtering algorithms and preserving image details better. It also uses a histogram equalization algorithm for image enhancement, which effectively enhances image contrast and is simple to use.
[0058] 3. This invention locates and extracts defect regions based on an improved defect region localization method and an eight-domain connectivity detection algorithm. Compared with traditional defect region localization methods, it can greatly improve the image segmentation effect. The eight-domain connectivity detection algorithm realizes defect marking and extraction, avoids the problem of over-segmentation, and has universal applicability.
[0059] 4. This invention accelerates network convergence by constructing a new LeNet-5 network, changing the activation function and convolutional layer size, and then training the LeNet-5 network detection model to achieve defect detection. This can shorten network training time and increase defect recognition accuracy while maintaining fewer parameters.
[0060] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description
[0061] To more clearly illustrate the technical solutions of the embodiments of the invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the invention. For those skilled in the art, the drawings can be obtained from these drawings without creative effort.
[0062] Figure 1 This invention provides a schematic diagram of the process for detecting defects in phased array ultrasonic area images using a machine vision-based phased array ultrasonic area image defect detection system. Detailed Implementation
[0063] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0064] In the description of this invention, it should be understood that the terms "opening", "upper", "lower", "top", "middle", "inner", etc., which indicate orientation or positional relationship, are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the components or elements referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on the invention.
[0065] Example 1
[0066] Please refer to Figure 1 This invention relates to a machine vision-based method for detecting defects in phased array ultrasonic area images, comprising the following steps:
[0067] S1. Acquire phased array ultrasonic area images to obtain an initial phased array ultrasonic area image set. Evaluate the image quality of the initial phased array ultrasonic area image set based on the peak signal-to-noise ratio of the images to obtain a filtered phased array ultrasonic area image set.
[0068] S1 includes the following steps:
[0069] S11. Scan the material to be tested using a phased array probe to acquire a phased array ultrasonic area image. Select sampling points on the phased array ultrasonic area image; these sampling points are pixels. Quantize the sampling points to obtain an initial set of phased array ultrasonic area images. Select any initial phased array ultrasonic area image from this set, and denote it as the phased array ultrasonic area image to be evaluated. Select a standard phased array ultrasonic area image as a reference image. Set the size of both the phased array ultrasonic area image to be evaluated and the standard phased array ultrasonic area image to be used as m×n. Simultaneously select pixel coordinates (a,b). The pixel grayscale values corresponding to these coordinates are denoted as A′(a,b) and A″(a,b), respectively. The image mean square error is calculated using the following formula:
[0070]
[0071] Where A represents the mean square error of the phased array ultrasound area image to be evaluated and the standard phased array ultrasound area image.
[0072] The maximum pixel grayscale value on the phased array ultrasound area image to be evaluated is set to... The formula for calculating the peak signal-to-noise ratio of an image is as follows:
[0073]
[0074] Where α represents the peak signal-to-noise ratio of the phased array ultrasound area image to be evaluated and the standard phased array ultrasound area image;
[0075] S12. Calculate the peak signal-to-noise ratio (PSNR) of all initial phased array ultrasonic area images in the initial phased array ultrasonic area image set sequentially to obtain a peak SNR set. Set the SNR threshold as ω. When the peak SNR in the peak SNR set is greater than or equal to the SNR threshold, there is no quality difference between the initial phased array ultrasonic area image and the reference image corresponding to the peak SNR. Otherwise, there is a quality difference between the initial phased array ultrasonic area image and the reference image corresponding to the peak SNR. Delete the initial phased array ultrasonic area images with quality differences to complete the image quality evaluation and obtain the filtered phased array ultrasonic area image set.
[0076] S2. Denoising and image enhancement are performed on the selected phased array ultrasonic area images in the selected phased array ultrasonic area image set to complete image preprocessing and obtain the processed phased array ultrasonic area image set.
[0077] S2 includes the following steps:
[0078] S21. An adaptive median filtering algorithm is used to denoise the selected phased array ultrasound area images in the selected phased array ultrasound area image set to obtain a denoised phased array ultrasound area image set. The specific steps are as follows:
[0079] S211. Select any filtered phased array ultrasonic area image from the set of filtered phased array ultrasonic area images, and denoise it as the phased array ultrasonic area image to be denoised. Set a first filter window and a second filter window on the phased array ultrasonic area image to be denoised.
[0080] The grayscale values of the pixels in the first filtering window are sorted, and the median of the pixel grayscale values is selected. The maximum and minimum pixel grayscale values in the first filtering window are found, and any pixel is selected and recorded as the first pixel. When the grayscale value of the first pixel is greater than or equal to the minimum pixel grayscale value and less than or equal to the maximum pixel grayscale value, the next pixel in the first filtering window is selected; otherwise, similarity is calculated using the following formula:
[0081]
[0082] Where β1 represents the similarity of the first pixel, and a′ represents the grayscale value of the first pixel. χ1 represents the median gray value of a pixel, and χ1 represents a small constant.
[0083] Set a similarity threshold. When the similarity of the first pixel is less than the similarity threshold, the first pixel is a noise point, and S213 is executed. Otherwise, the first pixel is not a noise point.
[0084] S212. Calculate the mean gray value of the pixels in the second filtering window, and denot it as the mean gray value of the pixels. Select any pixel in the second filtering window and denot it as the second pixel. Then, perform similarity calculation. The calculation formula is as follows:
[0085]
[0086] Where β2 represents the similarity of the second pixel, and a″ represents the grayscale value of the second pixel. χ² represents the mean gray value of a pixel, and χ² represents a small constant.
[0087] When the similarity of the second pixel is less than the similarity threshold, the second pixel is a noise point, and S213 is executed; otherwise, the second pixel is not a noise point.
[0088] S213. For the first pixel and the second pixel, sort the gray values of the pixels in the first filtering window and the second filtering window respectively to obtain the median gray value of the first filtering window and the median gray value of the second filtering window. Replace the gray value of the first pixel with the median gray value of the first filtering window and replace the gray value of the second pixel with the median gray value of the second filtering window to complete the denoising process. Continue until all the filtered phased array ultrasonic area images in the filtered phased array ultrasonic area image set have been denoised to obtain the denoised phased array ultrasonic area image set.
[0089] S22. Select any denoised phased array ultrasonic area image from the set of denoised phased array ultrasonic area images, and denote it as the phased array ultrasonic area image to be enhanced; set the gray level random variable of the phased array ultrasonic area image to be enhanced as b′, and b′∈[0,1], set the probability density function of the gray level random variable b′, establish the cumulative distribution function of the gray level random variable b′, integrate both sides of the cumulative distribution function of the gray level random variable b′, and then combine it with the probability density function of the gray level random variable b′ to obtain the probability of the pixel gray value of the phased array ultrasonic area image to be enhanced at different gray levels, draw the gray level histogram of the phased array ultrasonic area image to be enhanced, transform the gray level histogram of the phased array ultrasonic area image to be enhanced, complete the image enhancement, obtain the processed phased array ultrasonic area image, and generate the set of processed phased array ultrasonic area images.
[0090] S3. Based on the improved defect region localization method, the processed phased array ultrasonic area image set is clustered by introducing the K-means algorithm, and then the eight-domain connectivity detection algorithm is used to locate and extract the defect region to obtain the final phased array ultrasonic area image set.
[0091] S3 includes the following steps:
[0092] S31. The processed phased array ultrasonic area image set is clustered using the K-means algorithm to segment the defect region, resulting in a binary phased array ultrasonic area image set. The specific steps are as follows:
[0093] S311. The processed phased array ultrasonic area image set is filtered to extract texture features to obtain the texture features corresponding to each processed phased array ultrasonic area image. The texture features of similar pixels are connected to obtain feature vectors. Any k feature vectors are selected as the center of the cluster. The Euclidean distance from each feature vector to the center of the cluster is calculated. The feature vector corresponding to the minimum Euclidean distance from each feature vector to the center of the cluster is added to the cluster to obtain several clusters.
[0094] S312. Set the number of clusters to 3, and denote them as defect region cluster, defect-free region cluster and transition region cluster respectively. Calculate the Euclidean distance from each feature vector to the center of the cluster in several clusters. Continuously update the clusters until the center of the cluster no longer changes, and obtain the final defect region cluster, the final defect-free region cluster and the final transition region cluster.
[0095] S313. Traverse the final defect region cluster, find the minimum pixel gray value, and use the minimum pixel gray value as a global threshold. Use the global threshold to segment the processed phased array ultrasonic area image in the processed phased array ultrasonic area image set, and perform binarization processing to obtain a binarized phased array ultrasonic area image set.
[0096] S32. Morphological processing is performed on the binary phased array ultrasonic area images in the set of binary phased array ultrasonic area images to obtain a set of morphologically processed binary phased array ultrasonic area images; any morphologically processed binary phased array ultrasonic area image is selected from the set of morphologically processed binary phased array ultrasonic area images and denoted as a defect extraction phased array ultrasonic area image; a pixel is selected on the defect extraction phased array ultrasonic area image and denoted as the current pixel; the defect extraction phased array ultrasonic area image is scanned to obtain the eight neighboring pixels of the current pixel; a distance threshold is set to ψ; when the distance between the eight neighboring pixels and the current pixel is less than or equal to the distance threshold, the corresponding eight neighboring pixels are marked; otherwise, the corresponding eight neighboring pixels are not marked, and the marked eight neighboring pixels and the current pixel are connected to form an initial connected region;
[0097] S33. Determine the maximum and minimum values of pixel coordinates in the initial connected region to obtain the maximum and minimum pixel coordinates. The maximum and minimum pixel coordinates are the boundaries of the initial connected region. Treat the pixels at the maximum and minimum pixel coordinates as the current pixels. Repeat S32 to continuously update the initial connected region until the current pixel crosses the boundary to obtain the final connected region. Complete the defect region location and extract the final connected region to obtain the final phased array ultrasonic area image, forming the final phased array ultrasonic area image set.
[0098] S4. Construct a new LeNet-5 network to obtain an improved LeNet-5 network. After training, obtain a LeNet-5 network detection model. Perform defect detection on the final phased array ultrasonic area image set and output the final defect detection result to achieve defect detection.
[0099] S4 includes the following steps:
[0100] S41. Construct a new LeNet-5 network. Input the image to be detected from the input layer, pass through the first convolutional layer with a kernel size of φ1×φ1 and a stride of 1, then pass through the first pooling layer with a kernel size of φ2×φ2 and a stride of 1, reach the second convolutional layer with a kernel size of φ1×φ1, and then pass through the second pooling layer, the third convolutional layer, and the third pooling layer respectively. The third pooling layer is connected to the fully connected layer. The fully connected layer obtains the defect detection result, and the output layer outputs the defect detection result. The defect detection result includes cracks, lack of fusion, incomplete penetration, porosity, and slag inclusions, thus obtaining an improved LeNet-5 network.
[0101] S42. Reacquire phased array ultrasonic area images to obtain a new set of phased array ultrasonic area images. After filtering, denoising, image enhancement, and defect region localization and extraction of the new phased array ultrasonic area images in the new set, a set of phased array ultrasonic area image samples is obtained. Then, the phased array ultrasonic area image sample set is flipped to obtain an expanded set of phased array ultrasonic area image samples. After labeling the expanded set of phased array ultrasonic area image samples according to the defect detection results, an improved LeNet-5 network is trained to obtain the LeNet-5 network detection model. The specific steps are as follows:
[0102] S421. The improved LeNet-5 network is set to use the Leaky-ReLU function as the activation function, the squared loss function as the loss function, and the initial learning rate as γ. The extended phased array ultrasound area image sample set is randomly divided into a sample training set and a sample test set. The sample training set is then input into the improved LeNet-5 network and iterated continuously until the improved LeNet-5 network converges, thus obtaining the trained LeNet-5 network.
[0103] S422. Input the sample test set into the trained LeNet-5 network, set the accuracy threshold to ξ, and when the accuracy of the output result is greater than the accuracy threshold, the LeNet-5 network detection model is obtained; otherwise, adjust the network parameters and weights until the accuracy of the output result is greater than the accuracy threshold.
[0104] S43. Label the final phased array ultrasonic area image in the final phased array ultrasonic area image set, input the final phased array ultrasonic area image set into the LeNet-5 network detection model, and output the final defect detection results; the output label 0 indicates that the phased array ultrasonic area image has no defects, the output label 1 indicates that the phased array ultrasonic area image has crack defects, the output label 2 indicates that the phased array ultrasonic area image has incomplete fusion defects, the output label 3 indicates that the phased array ultrasonic area image has incomplete penetration defects, the output label 4 indicates that the phased array ultrasonic area image has porosity defects, and the output label 5 indicates that the phased array ultrasonic area image has slag inclusion defects, thereby realizing defect detection.
[0105] Example 2
[0106] This invention also discloses a system for a phased array ultrasonic area image defect detection method based on machine vision, specifically including: an image quality evaluation module, an image preprocessing module, a defect region localization and extraction module, and a neural network defect detection module;
[0107] The image quality evaluation module is used to evaluate the image quality of the initial phased array ultrasound area image based on the peak signal-to-noise ratio.
[0108] The image preprocessing module is used to perform noise reduction and image enhancement processing on the screened phased array ultrasonic area images.
[0109] The defect region localization and extraction are performed using an improved defect region localization method and an eight-domain connectivity detection algorithm.
[0110] The neural network defect detection module is used to perform defect detection on the final phased array ultrasonic area image using the LeNet-5 network detection model.
[0111] In the description of this specification, references to terms such as "an embodiment," "example," "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0112] The preferred embodiments of the invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention.
Claims
1. A method for defect detection using phased array ultrasonic area images based on machine vision, characterized in that, Includes the following steps: S1. Acquire phased array ultrasonic area images to obtain an initial phased array ultrasonic area image set. Evaluate the image quality of the initial phased array ultrasonic area image set based on the peak signal-to-noise ratio of the images to obtain a filtered phased array ultrasonic area image set. S2. Denoising and image enhancement are performed on the selected phased array ultrasonic area images in the selected phased array ultrasonic area image set to complete image preprocessing and obtain the processed phased array ultrasonic area image set. S3. Based on the improved defect region localization method, the processed phased array ultrasonic area image set is clustered by introducing the K-means algorithm, and then the eight-domain connectivity detection algorithm is used to locate and extract the defect region to obtain the final phased array ultrasonic area image set. S3 includes the following steps: S31. The processed phased array ultrasonic area image set is clustered using the K-means algorithm to segment the defect region and obtain a binary phased array ultrasonic area image set. S32. Morphological processing is performed on the binarized phased array ultrasonic area image set to obtain a morphologically processed binarized phased array ultrasonic area image set; a defect extraction phased array ultrasonic area image is selected from the morphologically processed binarized phased array ultrasonic area image set, and a pixel point is selected on the defect extraction phased array ultrasonic area image and recorded as the current pixel point; the defect extraction phased array ultrasonic area image is scanned to obtain the eight neighboring pixels of the current pixel point; an initial connected region is formed by setting a distance threshold; S33. Determine the boundary of the initial connected region, continuously update the initial connected region until the current pixel point crosses the boundary, obtain the final connected region, complete the defect region localization, extract the final connected region, obtain the final phased array ultrasonic area image, and form the final phased array ultrasonic area image set. S4. Construct a new LeNet-5 network to obtain an improved LeNet-5 network. After training, obtain a LeNet-5 network detection model. Perform defect detection on the final phased array ultrasonic area image set and output the final defect detection result to achieve defect detection. S4 includes the following steps: S41. Construct a new LeNet-5 network. Input the image to be detected from the input layer, pass it through the first convolutional layer, and set the convolutional kernel size to be... The step size is 1, and then it goes through the first pooling layer. The pooling layer size is set to... With a stride of 1, the second convolutional layer is reached, and the kernel size is [missing value]. Then, the results are passed to the second pooling layer, the third convolutional layer, and the third pooling layer, respectively. The third pooling layer is connected to the fully connected layer. The fully connected layer obtains the defect detection results, and the output layer outputs the defect detection results. The defect detection results include cracks, lack of fusion, incomplete penetration, porosity, and slag inclusions, resulting in an improved LeNet-5 network. S42. Reacquire phased array ultrasonic area images to obtain a new set of phased array ultrasonic area images. After screening, denoising, image enhancement, defect region localization and extraction of the new phased array ultrasonic area images in the new set of phased array ultrasonic area images, obtain a set of phased array ultrasonic area image samples. Then, after flipping the set of phased array ultrasonic area image samples, obtain an expanded set of phased array ultrasonic area image samples. After labeling the expanded set of phased array ultrasonic area image samples according to the defect detection results, train the improved LeNet-5 network to obtain the LeNet-5 network detection model. S43. Label the final phased array ultrasonic area image in the final phased array ultrasonic area image set, input the final phased array ultrasonic area image set into the LeNet-5 network detection model, output the final defect detection result, and realize defect detection.
2. The method for detecting defects in phased array ultrasonic area images based on machine vision according to claim 1, characterized in that, S1 includes the following steps: S11. Acquire phased array ultrasonic area images to obtain an initial set of phased array ultrasonic area images, select the phased array ultrasonic area images to be evaluated; set the standard phased array ultrasonic area images as reference images, and calculate the peak signal-to-noise ratio of the phased array ultrasonic area images to be evaluated and the standard phased array ultrasonic area images. S12. Set a signal-to-noise ratio threshold, compare the peak signal-to-noise ratio with the signal-to-noise ratio threshold, determine whether there is a quality difference between the initial phased array ultrasound area image and the reference image, delete the initial phased array ultrasound area image with quality difference, and obtain the filtered set of phased array ultrasound area images.
3. The method for detecting defects in phased array ultrasonic area images based on machine vision according to claim 2, characterized in that, S2 includes the following steps: S21. Use an adaptive median filtering algorithm to denoise the selected phased array ultrasonic area images in the selected phased array ultrasonic area image set to obtain a denoised phased array ultrasonic area image set. S22. For the denoised phased array ultrasonic area images in the denoised phased array ultrasonic area image set, the histogram equalization algorithm is used to perform image enhancement processing to obtain the processed phased array ultrasonic area image set.
4. The method for detecting defects in phased array ultrasonic area images based on machine vision according to claim 3, characterized in that, S21 includes the following steps: S211. In the filtered phased array ultrasound area image set, a first filtering window and a second filtering window are set. A first pixel is selected in the first filtering window and a second pixel is selected in the second filtering window. A similarity threshold is set. After selecting the median gray value of the pixel in the first filtering window, the similarity of the first pixel is calculated. When the similarity of the first pixel is less than the similarity threshold, the first pixel is recorded as a noise point. S212. After calculating the mean of the gray values of the pixels in the second filtering window, calculate the similarity of the second pixel. When the similarity of the second pixel is less than the similarity threshold, the second pixel is recorded as a noise point. S213. Replace the gray value of the first pixel with the median gray value of the first filter window, and replace the gray value of the second pixel with the median gray value of the second filter window, until all pixels are replaced, to obtain the denoised phased array ultrasonic area image set.
5. The method for detecting defects in phased array ultrasonic area images based on machine vision according to claim 4, characterized in that, S31 includes the following steps: S311. Extract the texture features of the processed phased array ultrasound area image set to obtain feature vectors; use the K-means algorithm to cluster the feature vectors to obtain several clusters. S312. Set up several clusters including defect region cluster, defect-free region cluster and transition region cluster, and continuously update the clusters until the center of the cluster no longer changes, to obtain the final defect region cluster, the final defect-free region cluster and the final transition region cluster. S313. Traverse the final defect region cluster, find the minimum pixel gray value, and use the minimum pixel gray value as a global threshold. Use the global threshold to segment the processed phased array ultrasonic area image in the processed phased array ultrasonic area image set, and perform binarization processing to obtain a binarized phased array ultrasonic area image set.
6. The method for detecting defects in phased array ultrasonic area images based on machine vision according to claim 5, characterized in that, The training of the improved LeNet-5 network to obtain the LeNet-5 network detection model includes the following steps: The improved LeNet-5 network is configured with the Leaky-ReLU function as the activation function and the squared loss function as the loss function, with an initial learning rate of 100%. The extended phased array ultrasound area image sample set is randomly divided into a sample training set and a sample test set. The sample training set is then input into the improved LeNet-5 network and iterated continuously until the improved LeNet-5 network converges, thus obtaining the trained LeNet-5 network. The sample test set is input into the trained LeNet-5 network, and the accuracy threshold is set to... When the accuracy of the output result is greater than the accuracy threshold, the LeNet-5 network detection model is obtained; otherwise, the network parameters and weights are adjusted until the accuracy of the output result is greater than the accuracy threshold.
7. A system for implementing the machine vision-based phased array ultrasonic area image defect detection method as described in any one of claims 1-6, characterized in that, Specifically, this includes: images Quality assessment module, image preprocessing module, defect region localization and extraction, and neural network defect detection module; The image quality evaluation module is used to evaluate the image quality of the initial phased array ultrasound area image based on the peak signal-to-noise ratio. The image preprocessing module is used to perform noise reduction and image enhancement processing on the screened phased array ultrasonic area images. The defect region localization and extraction are performed using an improved defect region localization method and an eight-domain connectivity detection algorithm. The neural network defect detection module is used to perform defect detection on the final phased array ultrasonic area image using the LeNet-5 network detection model.
Citation Information
Patent Citations
A Defect Classification Method and System Based on Ultrasonic Phased Array Imaging
CN114359193B
Ultrasonic phased array defect imaging method based on F-DMAS and pseudo color
CN114187291A
Defect classification method and system based on ultrasonic phased array imaging
CN114359193A