Phased array ultrasonic area type image defect detection method based on machine vision

Through the phased array ultrasonic area-type image defect detection method based on machine vision, combined with image quality evaluation, denoising processing and improved defect area positioning methods, the problem of insufficient subjectivity and accuracy of defect detection in the prior art is solved, and more efficient and accurate defect detection is achieved.

CN120125564AActive Publication Date: 2025-06-10SPECIAL EQUIP SAFETY SUPERVISION INSPECTION INST OF JIANGSU PROVINCE
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510282929.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-11
Publication Date
2025-06-10
Estimated Expiration
2045-03-11

AI Technical Summary

Technical Problem

The existing phased array ultrasonic area image defect detection methods have problems such as subjectivity, insufficient detection accuracy, and not effectively removing interference factors.

Method used

The phased array ultrasonic area image defect detection method based on machine vision is adopted, and defect detection is carried out through image quality evaluation, denoising processing, image enhancement, improved defect area positioning methods and eight-domain connection detection algorithms, as well as a new LeNet-5 network to be constructed for defect detection.

Benefits of technology

Effectively eliminate structural artifacts and material noise, improve image segmentation effect, enhance image contrast, shorten network training time, and improve defect recognition accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120125564A_ABST
    Figure CN120125564A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of defect detection, and discloses a phased array ultrasonic area type image defect detection method based on machine vision. The method comprises the following steps: firstly, carrying out image quality evaluation on an initial phased array ultrasonic area type image set to obtain a screened phased array ultrasonic area type image set; secondly, de-noising processing and image enhancement processing are carried out on the screened phased array ultrasonic area type image; defect region positioning and extraction are carried out based on an improved defect region positioning method and an eight-domain communication detection algorithm, and a final phased array ultrasonic area type image set is obtained; and finally, constructing a new LeNet-5 network to obtain an improved LeNet-5 network, obtaining a LeNet-5 network detection model through training, and outputting a final defect detection result to realize defect detection. According to the method, the phased array ultrasonic area type image is processed and analyzed, the purpose of phased array ultrasonic area type image defect detection is achieved, and the method is objective and accurate.
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 specifically provides a phased array ultrasonic area image defect detection method based on machine vision. Background Art

[0002] Chinese Patent CN114359193B discloses a defect classification method and system based on ultrasonic phased array imaging. The method specifically includes collecting ultrasonic phased array imaging of a sample to be tested, generating ultrasonic full matrix data, performing focusing processing on the ultrasonic full matrix data, and performing color coding according to signal amplitude to obtain an image of the sample to be tested; after preprocessing the image of the sample to be tested, training a classification prediction model to obtain a trained classification prediction model, and inputting the preprocessed image into the trained classification prediction model to obtain a defect classification result of the sample to be tested, thus completing defect classification. This invention does not perform in-depth processing on the image and has a relatively slow classification speed.

[0003] Traditional image defect detection methods usually use the method of manual visual inspection to detect images and perform defect evaluation based on years of work experience. The detection results are subjective; at the same time, traditional phased array ultrasonic area image defect detection methods do not remove interference factors, resulting in deficiencies in defect detection accuracy and room for improvement in terms of practicality and reliability. Summary of the Invention

[0004] In view of the problems in the related art, the present invention provides a phased array ultrasonic area image defect detection method based on machine vision to overcome the above-mentioned technical problems existing in the existing related technologies.

[0005] To solve the above technical problems, the present invention is realized through the following technical solutions:

[0006] The present invention is a phased array ultrasonic area image defect detection method based on machine vision, including the following steps:

[0007] S1. Collect phased array ultrasonic area images to obtain an initial phased array ultrasonic area image set, and perform image quality evaluation on the initial phased array ultrasonic area image set based on the image peak signal-to-noise ratio to obtain a filtered phased array ultrasonic area image set;

[0008] S2. Perform denoising processing and image enhancement processing on the filtered phased array ultrasonic area images in the filtered phased array ultrasonic area image set to complete image preprocessing and obtain a processed phased array ultrasonic area image set;

[0009] S3. Based on the improved defect area location 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 for defect area location and extraction to obtain the final phased array ultrasonic area image set;

[0010] S4. A new LeNet-5 network is constructed to obtain an improved LeNet-5 network. After training, a LeNet-5 network detection model is obtained, and the final phased array ultrasonic area image set is subjected to defect detection, and the final defect detection result is output to achieve defect detection.

[0011] The invention obtains the initial phased array ultrasonic area image set, evaluates the image quality of the initial phased array ultrasonic area image set, and screens out the images with large differences by comparing the image peak signal-to-noise ratio with the reference image, which can effectively eliminate the influence of structural artifacts and material noise and reduce the difficulty of image processing; secondly, the screened phased array ultrasonic area images are subjected to denoising processing and image enhancement processing. Among them, the adaptive median filtering algorithm is used for denoising processing. By comparing the similarity of pixel points in the filtering window, the noise points are selected and then denoised. This algorithm adopts different denoising methods according to different noise types, overcomes the deficiencies of the traditional median filtering algorithm, and retains the image details better; the histogram equalization algorithm is used for image enhancement processing, effectively enhancing the image contrast, and the method is simple; then, based on the improved defect area location method and the eight-domain connectivity detection algorithm, the defect area is located and extracted. Compared with the traditional defect area location method, the improved defect area location method introduces the K-means algorithm for clustering, greatly increasing the image segmentation effect; the eight-domain connectivity detection algorithm realizes defect marking and extraction, avoiding the problem of over-segmentation and having general applicability; finally, a new LeNet-5 network is constructed, and after training, a LeNet-5 network detection model is obtained to achieve defect detection; the neural network speeds up the network convergence speed by replacing the activation function and the convolution layer size, shortens the network training time while maintaining fewer parameters, and at the same time increases the defect recognition accuracy.

[0012] Preferably, the S1 includes the following steps:

[0013] S11. Use a phased array probe to scan the material to be detected, obtain a phased array ultrasonic area image, select sampling points on the phased array ultrasonic area image, where the sampling points are pixel points, and perform quantization processing on the sampling points to obtain an initial phased array ultrasonic area image set. Select any initial phased array ultrasonic area image from the initial phased array ultrasonic area image set and denote it as the phased array ultrasonic area image to be evaluated; select a standard phased array ultrasonic area image as the reference image, set the sizes of the phased array ultrasonic area image to be evaluated and the standard phased array ultrasonic area image to be m×n, and simultaneously select the pixel point coordinates (a, b). The pixel point gray values corresponding to the pixel point coordinates are denoted as A′(a, b) and A″(a, b) respectively. The formula for calculating the mean square error of the images is as follows:

[0014]

[0015] Among them, A represents the mean square error between the phased array ultrasonic area image to be evaluated and the standard phased array ultrasonic area image;

[0016] Set the maximum pixel point gray value on the phased array ultrasonic area image to be evaluated as Then the formula for calculating the peak signal-to-noise ratio of the image is as follows:

[0017]

[0018] Among them, α represents the peak signal-to-noise ratio between the phased array ultrasonic area image to be evaluated and the standard phased array ultrasonic area image;

[0019] S12. Calculate the peak signal-to-noise ratio of all the initial phased array ultrasonic area images in the initial phased array ultrasonic area image set in sequence to obtain a peak signal-to-noise ratio set; set the signal-to-noise ratio threshold as ω. When the peak signal-to-noise ratio in the peak signal-to-noise ratio set is greater than or equal to the signal-to-noise ratio threshold, there is no quality difference between the initial phased array ultrasonic area image corresponding to the peak signal-to-noise ratio at this time and the reference image; otherwise, there is a quality difference between the initial phased array ultrasonic area image corresponding to the peak signal-to-noise ratio and the reference image. Delete the initial phased array ultrasonic area images with quality differences to complete the image quality evaluation and obtain a filtered phased array ultrasonic area image set.

[0020] The present invention effectively excludes the influence of structural artifacts and material noise by obtaining an initial phased array ultrasonic area image set, performing image quality evaluation on the initial phased array ultrasonic area image set, and comparing the peak signal-to-noise ratio of the image with the reference image, screening out images with large differences, and reducing the difficulty of image processing.

[0021] Preferably, the S2 includes the following steps:

[0022] S21. Use the adaptive median filtering algorithm to denoise the selected phased array ultrasonic area images in the selected phased array ultrasonic area image set, and obtain a denoised phased array ultrasonic area image set. The specific steps are as follows:

[0023] S211. Select any selected phased array ultrasonic area image in the selected phased array ultrasonic area image set, denoted as the phased array ultrasonic area image to be denoised. Set a first filtering window and a second filtering window on the phased array ultrasonic area image to be denoised respectively;

[0024] Sort the gray values of the pixel points in the first filtering window, and select the median of the gray values of the pixel points. Find the maximum gray value and the minimum gray value of the pixel points in the first filtering window, and select any pixel point as the first pixel point; when the gray value of the first pixel point is greater than or equal to the minimum gray value and less than or equal to the maximum gray value, go to the next pixel point in the first filtering window, otherwise perform similarity calculation. The calculation formula is as follows:

[0025]

[0026] where β 1 represents the similarity of the first pixel point, a′ represents the gray value of the first pixel point, represents the median of the gray values of the pixel points, χ 1 represents a small constant;

[0027] Set a similarity threshold. When the similarity of the first pixel point is less than the similarity threshold, the first pixel point is a noise point. At this time, execute S213, otherwise the first pixel point is not a noise point;

[0028] S212. Calculate the mean of the gray values of the pixel points in the second filtering window, denoted as the mean of the gray values of the pixel points. Select any pixel point in the second filtering window as the second pixel point. At this time, perform similarity calculation. The calculation formula is as follows:

[0029]

[0030] where β 2 represents the similarity of the second pixel point, a″ represents the gray value of the second pixel point, represents the mean of the gray values of the pixel points, χ 2 represents a small constant;

[0031] When the similarity of the second pixel point is less than the similarity threshold, the second pixel point is a noise point. At this time, execute S213, otherwise the second pixel point is not a noise point;

[0032] S213. For the first pixel point and the second pixel point, sort the gray values of the pixel points in the first filtering window and a 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 point with the median gray value of the first filtering window, and replace the gray value of the second pixel point with the median gray value of the second filtering window to complete the denoising process. Until all the selected phased array ultrasonic area images in the selected phased array ultrasonic area image set are denoised, a denoised phased array ultrasonic area image set is obtained.

[0033] S22. Select any denoised phased array ultrasonic area image from the denoised phased array ultrasonic area image set, denoted 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 ends of the cumulative distribution function of the gray level random variable b′, and then combine with the probability density function of the gray level random variable b′ to obtain the probability of the pixel point gray value of the phased array ultrasonic area image to be enhanced at different gray levels. Draw the gray histogram of the phased array ultrasonic area image to be enhanced, and convert the gray histogram of the phased array ultrasonic area image to be enhanced to complete the image enhancement, obtain the processed phased array ultrasonic area image, and generate a processed phased array ultrasonic area image set.

[0034] The present invention performs denoising processing on the selected phased array ultrasonic area image by using an adaptive median filtering algorithm. By comparing the similarity of pixel points in the filtering window, noise points are selected and then denoised. This algorithm adopts different denoising methods according to different types of noise, overcomes the deficiencies of the traditional median filtering algorithm, and has a better effect of retaining image details. The histogram equalization algorithm is used for image enhancement processing, effectively enhancing the image contrast, and the usage method is simple.

[0035] Preferably, S3 includes the following steps:

[0036] S31. For the processed phased array ultrasonic area image set, use the K-means algorithm for clustering to segment the defect area and obtain a binary phased array ultrasonic area image set. The specific steps are as follows:

[0037] S311. Pass the processed phased array ultrasonic area image set through a filter, extract the texture features to obtain the texture features corresponding to each processed phased array ultrasonic area image, connect the texture features of similar pixel points to obtain a feature vector; select any k feature vectors as the centers of clusters, calculate the Euclidean distance from each feature vector to the center of the cluster, and add the feature vector corresponding to the minimum Euclidean distance from each feature vector to the center of the cluster to the cluster to obtain several clusters.

[0038] S312. Set the number of clusters to 3, denoted as the defect area cluster, the defect-free area, and the transition area cluster respectively. Recalculate the Euclidean distance from each feature vector to the center of the cluster in the several clusters, and continuously update the clusters until the centers of the clusters no longer change, obtaining the final defect area cluster, the final defect-free area, and the final transition area cluster.

[0039] S313. Traverse the final defect area cluster, find the minimum pixel point gray value, and use the minimum pixel point gray value as the global threshold. Use the global threshold to segment the processed phased array ultrasonic area images 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. Perform morphological processing on the binarized phased array ultrasonic area images in the binarized phased array ultrasonic area image set to obtain a set of binarized phased array ultrasonic area images after morphological processing; select any binarized phased array ultrasonic area image after morphological processing in the set of binarized phased array ultrasonic area images after morphological processing, denoted as the defect extraction phased array ultrasonic area image, select a pixel point on the defect extraction phased array ultrasonic area image as the current pixel point, scan the defect extraction phased array ultrasonic area image to obtain the eight-neighborhood pixel points of the current pixel point; set the distance threshold to ψ, when the distance between the eight-neighborhood pixel points and the current pixel point is less than or equal to the distance threshold, mark the corresponding eight-neighborhood pixel points, otherwise do not mark the corresponding eight-neighborhood pixel points, and connect the marked eight-neighborhood pixel points and the current pixel point to form an initial connected region.

[0041] S33. Determine the maximum and minimum pixel point coordinates in the initial connected region to obtain the maximum pixel point coordinates and the minimum pixel point coordinates, which are the boundaries of the initial connected region. Regard the pixel points at the maximum pixel point coordinates and the minimum pixel point coordinates as the current pixel points, repeat S32 to continuously update the initial connected region until the current pixel point goes out of bounds, obtain the final connected region, complete the defect area positioning, and extract the final connected region to obtain the final phased array ultrasonic area image, forming a set of final phased array ultrasonic area images.

[0042] The invention locates and extracts the defect area based on an improved defect area location method and an eight-domain connectivity detection algorithm, introduces the K-means algorithm for clustering to improve the traditional defect area location method, and can greatly improve the image segmentation effect compared with the traditional defect area location method; the eight-domain connectivity detection algorithm realizes defect marking and extraction, avoids the problem of over-segmentation, and has general applicability.

[0043] Preferably, S4 includes the following steps:

[0044] S41. Construct a new LeNet-5 network, input the image to be defect-detected from the input layer, pass through the first convolutional layer, set the convolutional kernel size to φ 1 ×φ 1 , with a stride of 1, then pass through the first pooling layer, set the pooling layer size to φ 2 ×φ 2 , with a stride of 1, reach the second convolutional layer, and the convolutional kernel size is φ 1 ×φ 1 , then respectively reach the second pooling layer, the third convolutional layer and the third pooling layer, where 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 results include cracks, lack of fusion, lack of penetration, porosity and slag inclusions, and an improved LeNet-5 network is obtained;

[0045] S42. Re-obtain the phased array ultrasonic area image, obtain a new phased array ultrasonic area image set, perform screening, denoising processing, image enhancement processing, and defect area location and extraction on the new phased array ultrasonic area images in the new phased array ultrasonic area image set, obtain a phased array ultrasonic area image sample set, and then perform a flipping operation on the phased array ultrasonic area image sample set to obtain an extended phased array ultrasonic area image sample set. After labeling the extended phased array ultrasonic area image sample set according to the defect detection results, train the improved LeNet-5 network to obtain a LeNet-5 network detection model. The specific steps are as follows:

[0046] S421. Set the improved LeNet-5 network to use the Leaky-ReLu function as the activation function, the loss function as the mean squared error loss function, and the initial learning rate as γ; randomly divide the extended phased array ultrasonic area image sample set into a sample training set and a sample test set, and then input the sample training set into the improved LeNet-5 network and iterate continuously until the improved LeNet-5 network converges to obtain a trained LeNet-5 network;

[0047] S422. Input the sample test set into the trained LeNet-5 network. Set the accuracy threshold as ξ. When the accuracy of the output result is greater than the accuracy threshold, obtain the LeNet-5 network detection model; 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-type images in the final phased array ultrasonic area-type image set, and input the final phased array ultrasonic area-type image set into the LeNet-5 network detection model to output the final defect detection result. An output label of 0 indicates that the phased array ultrasonic area-type image has no defect; an output label of 1 indicates that the phased array ultrasonic area-type image has a crack defect; an output label of 2 indicates that the phased array ultrasonic area-type image has an incomplete fusion defect; an output label of 3 indicates that the phased array ultrasonic area-type image has a lack of penetration defect; an output label of 4 indicates that the phased array ultrasonic area-type image has a porosity defect; an output label of 5 indicates that the phased array ultrasonic area-type image has a slag inclusion defect, thus realizing defect detection.

[0049] The present invention constructs a new LeNet-5 network. By replacing the activation function and the size of the convolutional layer, the network convergence speed is accelerated. Then, through training, the LeNet-5 network detection model is obtained to realize defect detection, which can shorten the network training time while maintaining fewer parameters and increase the defect recognition accuracy.

[0050] The present invention also discloses a system for a phased array ultrasonic area-type image defect detection method based on machine vision, specifically including: an image quality evaluation module, an image preprocessing module, a defect area location and extraction module, and a neural network defect detection module.

[0051] The image quality evaluation module is used to evaluate the quality of the initial phased array ultrasonic area-type image based on the image peak signal-to-noise ratio.

[0052] The image preprocessing module is used to perform denoising processing and image enhancement processing on the screened phased array ultrasonic area-type images.

[0053] The defect area location and extraction module is used to perform defect area location and extraction using an improved defect area location 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-type images using the LeNet-5 network detection model.

[0055] The present invention has the following beneficial effects:

[0056] 1. The invention evaluates the image quality of the initial phased array ultrasonic area-type image set. By comparing the image peak signal-to-noise ratio with the reference image, it can effectively eliminate the influence of structural artifacts and material noise, screen out images with large differences, and reduce the difficulty of image processing.

[0057] 2. The invention denoises the selected phased array ultrasonic area-type image by using the adaptive median filtering algorithm. This algorithm adopts different denoising methods according to different noise types, overcomes the deficiencies of the traditional median filtering algorithm, and better preserves the image details. It uses the histogram equalization algorithm for image enhancement processing, effectively enhancing the image contrast and having a simple usage method.

[0058] 3. The invention locates and extracts the defect area based on the improved defect area location method and the eight-domain connectivity detection algorithm. Compared with the traditional defect area location method, it can greatly improve the image segmentation effect. The eight-domain connectivity detection algorithm realizes defect marking and extraction, avoiding the problem of over-segmentation and having general applicability.

[0059] 4. The invention constructs a new LeNet-5 network, replaces the activation function and the size of the convolutional layer, speeds up the network convergence speed, and then obtains the LeNet-5 network detection model through training to realize defect detection. It can shorten the network training time while maintaining fewer parameters and increase the defect recognition accuracy.

[0060] Of course, it is not necessary for any product implementing the present invention to achieve all the above-mentioned advantages simultaneously. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] In order to more clearly illustrate the technical solutions of the embodiments of the invention, the drawings required for describing the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0062] Figure 1 It is a schematic flow chart of the defect detection of the phased array ultrasonic area-type image by a phased array ultrasonic area-type image defect detection system based on machine vision provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0063] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0064] In the description of the present invention, it should be understood that the terms "opening", "upper", "lower", "top", "middle", "inner", etc. indicating the orientation or position relationship are only for the convenience of describing the invention and simplifying the description, rather than indicating or implying that the components or elements referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as a limitation to the invention.

[0065] Embodiment 1

[0066] Please refer to Figure 1 , the present invention is a phased array ultrasonic area imaging defect detection method based on machine vision, including the following steps:

[0067] S1. Collect phased array ultrasonic area images to obtain an initial phased array ultrasonic area image set, and perform image quality evaluation on the initial phased array ultrasonic area image set based on the image peak signal-to-noise ratio to obtain a filtered phased array ultrasonic area image set;

[0068] The said S1 includes the following steps:

[0069] S11. Use a phased array probe to scan the material to be detected to obtain phased array ultrasonic area images. Select sampling points on the phased array ultrasonic area images. The sampling points are pixel points, and the sampling points are quantized to obtain an initial phased array ultrasonic area image set. Select any initial phased array ultrasonic area image from the initial phased array ultrasonic area image set and denote it as the phased array ultrasonic area image to be evaluated; select a standard phased array ultrasonic area image as the reference image, set the sizes of the phased array ultrasonic area image to be evaluated and the standard phased array ultrasonic area image to be m×n, and simultaneously select the pixel point coordinates (a, b). The pixel point gray values corresponding to the pixel point coordinates are respectively denoted as A′(a, b) and A″(a, b). The calculation formula of the image mean square error is as follows:

[0070]

[0071] where A represents the mean square error between the phased array ultrasonic area image to be evaluated and the standard phased array ultrasonic area image;

[0072] Set the maximum pixel point gray value on the phased array ultrasonic area image to be evaluated as Then the calculation formula of the image peak signal-to-noise ratio is as follows:

[0073]

[0074] where α represents the peak signal-to-noise ratio between the phased array ultrasonic area image to be evaluated and the standard phased array ultrasonic area image;

[0075] S12. Calculate the peak signal-to-noise ratio (PSNR) of all the initial phased array ultrasonic area images in the initial phased array ultrasonic area image set in sequence to obtain a PSNR set. Set the signal-to-noise ratio threshold as ω. When the PSNR in the PSNR set is greater than or equal to the signal-to-noise ratio threshold, there is no quality difference between the initial phased array ultrasonic area image corresponding to the PSNR at this time and the reference image; otherwise, there is a quality difference between the initial phased array ultrasonic area image corresponding to the PSNR and the reference image. 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. Perform denoising processing and image enhancement processing on the filtered phased array ultrasonic area images in the filtered 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. Use the adaptive median filtering algorithm to perform denoising processing on the filtered phased array ultrasonic area images in the filtered phased array ultrasonic area image set to obtain a denoised phased array ultrasonic area image set. The specific steps are as follows:

[0079] S211. Select any filtered phased array ultrasonic area image in the filtered phased array ultrasonic area image set, denoted as the phased array ultrasonic area image to be denoised. Set a first filtering window and a second filtering window on the phased array ultrasonic area image to be denoised.

[0080] Sort the gray values of the pixel points in the first filtering window, and select the median of the gray values of the pixel points. Find the maximum gray value and the minimum gray value of the pixel points in the first filtering window, and select any pixel point as the first pixel point. When the gray value of the first pixel point is greater than or equal to the minimum gray value and less than or equal to the maximum gray value, go to the next pixel point in the first filtering window; otherwise, perform similarity calculation. The calculation formula is as follows:

[0081]

[0082] where β 1 represents the similarity of the first pixel point, a′ represents the gray value of the first pixel point, represents the median of the gray values of the pixel points, and χ 1 represents a small constant.

[0083] Set a similarity threshold. When the similarity of the first pixel point is less than the similarity threshold, the first pixel point is a noise point, and at this time, execute S213; otherwise, the first pixel point is not a noise point.

[0084] S212. Calculate the mean of the grayscale values of the pixel points in the second filtering window, denoted as the mean of the grayscale values of the pixel points. Select any pixel point in the second filtering window as the second pixel point. At this time, perform similarity calculation, and the calculation formula is as follows:

[0085]

[0086] where β 2 represents the similarity of the second pixel point, a″ represents the grayscale value of the second pixel point, represents the mean of the grayscale values of the pixel points, and χ 2 represents a small constant;

[0087] When the similarity of the second pixel point is less than the similarity threshold, the second pixel point is a noise point. At this time, execute S213. Otherwise, the second pixel point is not a noise point;

[0088] S213. For the first pixel point and the second pixel point, sort the grayscale values of the pixel points in the first filtering window and a filtering window respectively to obtain the median of the grayscale values in the first filtering window and the median of the grayscale values in the second filtering window. Use the median of the grayscale values in the first filtering window to replace the grayscale value of the first pixel point, and use the median of the grayscale values in the second filtering window to replace the grayscale value of the second pixel point to complete the denoising process; until all the filtered phased array ultrasonic area images in the filtered phased array ultrasonic area image set are denoised, obtain the denoised phased array ultrasonic area image set;

[0089] S22. Select any denoised phased array ultrasonic area image in the denoised phased array ultrasonic area image set, denoted as the phased array ultrasonic area image to be enhanced; set the grayscale 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 grayscale level random variable b′, establish the cumulative distribution function of the grayscale level random variable b′, integrate both ends of the cumulative distribution function of the grayscale level random variable b′, and then combine with the probability density function of the grayscale level random variable b′ to obtain the probability of the grayscale value of the pixel points of the phased array ultrasonic area image to be enhanced at different grayscale levels, draw the grayscale histogram of the phased array ultrasonic area image to be enhanced, convert the grayscale histogram of the phased array ultrasonic area image to be enhanced, complete image enhancement, obtain the processed phased array ultrasonic area image, and generate the processed phased array ultrasonic area image set;

[0090] S3. Based on the improved defect area location method, the K-means algorithm is introduced to cluster the processed phased array ultrasonic area image set, and then the eight-region connectivity detection algorithm is used for defect area location and extraction to obtain the final phased array ultrasonic area image set;

[0091] S3 includes the following steps:

[0092] S31. For the processed phased array ultrasonic area image set, use the K-means algorithm for clustering to segment the defect area and obtain the binary phased array ultrasonic area image set. The specific steps are as follows:

[0093] S311. Pass the processed phased array ultrasonic area image set through a filter, extract the texture features to obtain the texture features corresponding to each processed phased array ultrasonic area image, connect the texture features of similar pixel points to obtain a feature vector; select any k feature vectors as the centers of the clusters, calculate the Euclidean distance from each feature vector to the center of the cluster, and add the feature vector corresponding to the minimum Euclidean distance from each feature vector to the center of the cluster to the cluster to obtain several clusters;

[0094] S312. Set the number of clusters to 3, denoted as the defect area cluster, the defect-free area, and the transition area cluster respectively. Calculate the Euclidean distance from each feature vector to the center of the cluster again among the several clusters, and continuously update the clusters until the centers of the clusters no longer change, obtaining the final defect area cluster, the final defect-free area, and the final transition area cluster;

[0095] S313. Traverse the final defect area cluster, find the minimum pixel point gray value, and use the minimum pixel point gray value as the global threshold. Use the global threshold to segment the processed phased array ultrasonic area images in the processed phased array ultrasonic area image set and perform binary processing to obtain the binary phased array ultrasonic area image set;

[0096] S32. Perform morphological processing on the binary phased array ultrasonic area-type images in the binary phased array ultrasonic area-type image set to obtain a set of binary phased array ultrasonic area-type images after morphological processing; select any binary phased array ultrasonic area-type image after morphological processing in the set of binary phased array ultrasonic area-type images after morphological processing, denote it as the defect extraction phased array ultrasonic area-type image, select a pixel point on the defect extraction phased array ultrasonic area-type image as the current pixel point, scan the defect extraction phased array ultrasonic area-type image to obtain the eight-neighbor pixel points of the current pixel point; set the distance threshold as ψ, when the distance between the eight-neighbor pixel point and the current pixel point is less than or equal to the distance threshold, mark the corresponding eight-neighbor pixel point, otherwise do not mark the corresponding eight-neighbor pixel point, and connect the marked eight-neighbor pixel points and the current pixel point to form an initial connected region;

[0097] S33. Determine the maximum and minimum pixel point coordinates in the initial connected region to obtain the maximum pixel point coordinate and the minimum pixel point coordinate, the maximum pixel point coordinate and the minimum pixel point coordinate are the boundaries of the initial connected region, regard the pixel points at the maximum pixel point coordinate and the minimum pixel point coordinate as the current pixel points, repeat S32 to continuously update the initial connected region until the current pixel point goes out of bounds, obtain the final connected region, complete the defect region positioning, and extract the final connected region to obtain the final phased array ultrasonic area-type image, forming a set of final phased array ultrasonic area-type images;

[0098] S4. Construct a new LeNet-5 network to obtain an improved LeNet-5 network, train to obtain a LeNet-5 network detection model, perform defect detection on the set of final phased array ultrasonic area-type images, and output the final defect detection result to achieve defect detection;

[0099] The S4 includes the following steps:

[0100] S41. Construct a new LeNet-5 network, input the image to be defect-detected from the input layer, pass through the first convolutional layer, set the convolutional kernel size as φ 1 ×φ 1 , with a stride of 1, then pass through the first pooling layer, set the pooling layer size as φ 2 ×φ 2 , with a stride of 1, reach the second convolutional layer, the convolutional kernel size is φ 1 ×φ 1 , then respectively reach the second pooling layer, the third convolutional layer and the third pooling layer, where 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, lack of penetration, porosity and slag inclusions, to obtain an improved LeNet-5 network;

[0101] S42. Re-obtain the phased array ultrasonic area image to obtain a new phased array ultrasonic area image set. After screening, denoising, image enhancement, and defect area location and extraction of the new phased array ultrasonic area images in the new phased array ultrasonic area image set, a phased array ultrasonic area image sample set is obtained. After performing a flipping operation on the phased array ultrasonic area image sample set, an extended phased array ultrasonic area image sample set is obtained. After labeling the extended phased array ultrasonic area image sample set according to the defect detection results, an improved LeNet-5 network is trained to obtain a LeNet-5 network detection model. The specific steps are as follows:

[0102] S421. Set the improved LeNet-5 network to use the Leaky-ReLu function as the activation function, the loss function as the squared loss function, and the initial learning rate as γ. Randomly divide the extended phased array ultrasonic area image sample set into a sample training set and a sample test set, and then input the sample training set into the improved LeNet-5 network and iterate continuously until the improved LeNet-5 network converges to obtain a trained LeNet-5 network;

[0103] S422. Input the sample test set into the trained LeNet-5 network, set the accuracy threshold as ξ. When the output result accuracy rate is greater than the accuracy threshold, a LeNet-5 network detection model is obtained; otherwise, adjust the network parameters and weights until the output result accuracy rate is greater than the accuracy threshold;

[0104] S43. Label the final phased array ultrasonic area images 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 result. An output label of 0 indicates that the phased array ultrasonic area image has no defect, an output label of 1 indicates that the phased array ultrasonic area image has a crack defect, an output label of 2 indicates that the phased array ultrasonic area image has an incomplete fusion defect, an output label of 3 indicates that the phased array ultrasonic area image has an incomplete penetration defect, an output label of 4 indicates that the phased array ultrasonic area image has a porosity defect, and an output label of 5 indicates that the phased array ultrasonic area image has a slag inclusion defect, thus realizing defect detection.

[0105] Embodiment 2

[0106] The present 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 area location and extraction module, and a neural network defect detection module;

[0107] The image quality evaluation module is used to evaluate the quality of the initial phased array ultrasonic area image based on the image peak signal-to-noise ratio;

[0108] The image preprocessing module is used to perform denoising processing and image enhancement processing on the selected phased array ultrasonic area image;

[0109] The defect area location and extraction are used to locate and extract the defect area by using an improved defect area location method and an eight-region connectivity detection algorithm;

[0110] The neural network defect detection module is used to detect defects in the final phased array ultrasonic area image by using the LeNet-5 network detection model.

[0111] In the description of this specification, the descriptions referring to terms such as "one embodiment", "example", "specific example", etc. mean that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in a suitable manner in any one or more embodiments or examples.

[0112] The preferred embodiments of the invention disclosed above are only used to help explain the invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and variations can be made according to the content of this specification. These embodiments are selected and specifically described in this specification in order to better explain the principle and practical application of the invention, so that those skilled in the art in the relevant technical field can well understand and utilize the invention.

Claims

1. A phased array ultrasonic area imaging defect detection method based on machine vision, characterized in that: The steps include: S1, collecting phased array ultrasonic area type images to obtain an initial phased array ultrasonic area type image set, performing image quality evaluation on the initial phased array ultrasonic area type image set based on the image peak signal-to-noise ratio, and obtaining a screened phased array ultrasonic area type image set; S2, performing denoising and image enhancement processing on the screened phased array ultrasonic area type images in the screened phased array ultrasonic area type image set to complete image preprocessing and obtain a processed phased array ultrasonic area type image set; S3. Based on the improved defect area positioning method, the processed phased array ultrasonic area image set is clustered by introducing the K-means algorithm, and then the defect area is positioned and extracted using the eight-domain connected detection algorithm to obtain 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, output the final defect detection result, and realize defect detection.

2. The method for detecting defects using phased array ultrasonic area imaging based on machine vision according to claim 1, characterized in that: The S1 comprises the following steps: S11, acquiring phased array ultrasonic area images, obtaining an initial phased array ultrasonic area image set, selecting a phased array ultrasonic area image to be evaluated; setting a standard phased array ultrasonic area image as a reference image, and calculating a peak signal-to-noise ratio of the phased array ultrasonic area image to be evaluated and the standard phased array ultrasonic area image; S12, setting a signal-to-noise ratio threshold, comparing the peak signal-to-noise ratio with the signal-to-noise ratio threshold, determining whether there is a quality difference between the initial phased array ultrasound area image and the reference image, deleting the initial phased array ultrasound area image with a quality difference, and obtaining a screened phased array ultrasound area image set.

3. The method for detecting defects using phased array ultrasonic area imaging based on machine vision according to claim 2, characterized in that: The S2 comprises the following steps: S21, using an adaptive median filtering algorithm to perform denoising on the screened phased array ultrasonic area type images in the screened phased array ultrasonic area type image set to obtain a denoised phased array ultrasonic area type image set; S22, performing image enhancement processing on the denoised phased array ultrasonic area images in the denoised phased array ultrasonic area image set by using a histogram equalization algorithm to obtain a processed phased array ultrasonic area image set.

4. The method for detecting defects using phased array ultrasonic area imaging based on machine vision according to claim 3, characterized in that: The S21 comprises the following steps: S211, setting a first filtering window and a second filtering window in the filtered phased array ultrasound area image set, selecting a first pixel point in the first filtering window, and selecting a second pixel point in the second filtering window; setting a similarity threshold, selecting the median of the grayscale value of the pixel point in the first filtering window, and then calculating the similarity of the first pixel point, when the similarity of the first pixel point is less than the similarity threshold, the first pixel point is recorded as a noise point; S212, after calculating the mean of the grayscale values ​​of the pixels in the second filtering window, calculate the similarity of the second pixels, and when the similarity of the second pixels is less than the similarity threshold, the second pixels are recorded as noise points; S213, using the grayscale median of the first filter window to replace the grayscale value of the first pixel, and using the grayscale median of the second filter window to replace the grayscale value of the second pixel, until all pixels are replaced, to obtain a denoised phased array ultrasound area image set.

5. The method for detecting defects using phased array ultrasonic area imaging based on machine vision according to claim 4, characterized in that: The S3 comprises the following steps: S31, clustering the processed phased array ultrasonic area image set using a K-means algorithm to segment the defect area to obtain a binary phased array ultrasonic area image set; S32, performing morphological processing on the binary phased array ultrasonic area image set to obtain a morphologically processed binary phased array ultrasonic area image set; selecting a defect extraction phased array ultrasonic area image from the morphologically processed binary phased array ultrasonic area image set, selecting a pixel point on the defect extraction phased array ultrasonic area image as a current pixel point, scanning the defect extraction phased array ultrasonic area image to obtain eight neighborhood pixel points of the current pixel point; and forming an initial connected area by setting a distance threshold; S33, determining the boundary of the initial connected area, continuously updating the initial connected area until the current pixel crosses the boundary, obtaining the final connected area, completing the defect area positioning, and extracting the final connected area to obtain the final phased array ultrasonic area image, forming a final phased array ultrasonic area image set.

6. The method for detecting defects using phased array ultrasonic area imaging based on machine vision according to claim 5, characterized in that: The S31 comprises the following steps: S311, extracting texture features of the processed phased array ultrasonic area image set to obtain a feature vector; clustering the feature vector using a K-means algorithm to obtain a plurality of clusters; S312, setting a number of clusters including a defective region cluster, a non-defective region cluster and a transition region cluster, and continuously updating the clusters until the center of the cluster no longer changes, thereby obtaining a final defective region cluster, a final non-defective region cluster and a final transition region cluster; S313, traversing the final defect area cluster, finding the minimum pixel grayscale value, and taking the minimum pixel grayscale value as a global threshold, using the global threshold to segment the processed phased array ultrasonic area image in the processed phased array ultrasonic area image set, and performing binarization processing to obtain a binary phased array ultrasonic area image set.

7. The method for detecting defects using phased array ultrasonic area imaging based on machine vision according to claim 6, characterized in that: The S4 comprises the following steps: S41. Construct a new LeNet-5 network, input the image to be defect detected from the input layer, pass through the first convolution layer, set the convolution kernel size to φ1×φ1, the step size to 1, then pass through the first pooling layer, set the pooling layer size to φ2×φ2, the step size to 1, reach the second convolution layer, the convolution kernel size is φ1×φ1, and then go to the second pooling layer, the third convolution layer and the third pooling layer respectively, wherein 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, lack of penetration, pores and slag inclusions, and obtains an improved LeNet-5 network; S42, reacquiring phased array ultrasonic area images to obtain a new phased array ultrasonic area image set, performing screening, denoising, image enhancement, and defect area positioning and extraction on new phased array ultrasonic area images in the new phased array ultrasonic area image set to obtain a phased array ultrasonic area image sample set, and then performing a flip operation on the phased array ultrasonic area image sample set to obtain an expanded phased array ultrasonic area image sample set, labeling the expanded phased array ultrasonic area image sample set according to defect detection results, and training an improved LeNet-5 network to obtain a LeNet-5 network detection model; S43, labeling the final phased array ultrasonic area type image in the final phased array ultrasonic area type image set, inputting the final phased array ultrasonic area type image set into the LeNet-5 network detection model, outputting the final defect detection result, and realizing defect detection.

8. The method for detecting defects using phased array ultrasonic area imaging based on machine vision according to claim 7, characterized in that: The training of the improved LeNet-5 network to obtain the LeNet-5 network detection model comprises the following steps: The improved LeNet-5 network is set to use the Leaky-ReLu function as the activation function, the loss function is the square loss function, and the initial learning rate is γ; the expanded phased array ultrasound area imaging sample set is randomly divided into a sample training set and a sample test set, and then the sample training set is input into the improved LeNet-5 network, and iterates continuously until the improved LeNet-5 network converges to obtain a 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.

9. A system for implementing the machine vision-based phased array ultrasonic area imaging defect detection method according to any one of claims 1 to 8, characterized in that: Specifically include: Image Quality assessment module, image preprocessing module, defect area location 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 ultrasonic area image based on the image peak signal-to-noise ratio; The image preprocessing module is used to perform denoising and image enhancement processing on the screened phased array ultrasonic area image; The defect area positioning and extraction are used to perform defect area positioning and extraction using an improved defect area positioning 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

  • Welding seam ultrasonic image defect identification method based on machine and depth vision fusion

    CN114519792A

  • Artificial intelligence-based flexible circuit board manufacturing defect detection system and method

    CN119180792A