Cover plate welding seam fusion width measuring method and device based on ultrasonic image
By constructing a cover weld fusion width detection model and performing adaptive grayscale stretching and pixel fusion processing, the problem of low measurement accuracy of cover weld fusion width is solved, and efficient and accurate automated measurement is achieved.
Patent Information
- Application Number
- CN202510318761.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2045-03-18
AI Technical Summary
In the prior art, the weld width measurement accuracy of the cover plate weld is low, which cannot meet the needs of automated assembly line production, and the traditional detection methods are inefficient and are susceptible to environmental influences.
Using the cover weld width measurement method based on ultrasonic images, the cover weld width detection model is constructed, the weld area is extracted and adaptive grayscale stretching and pixel fusion processing is performed, and the column measurement distance of each column of pixels is counted to determine the weld width dimension.
It improves the accuracy and efficiency of the weld width measurement of cover plate, realizes high-precision automated measurement, adapts to different weld clarity states, and reduces manual intervention and environmental impact.
Smart Images

Figure CN120254050A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a measurement method and device, in particular to a method and device for measuring the penetration width of a cover plate weld seam based on ultrasonic images. Background Art
[0002] Welding technology is a key process for constructing large and complex structures. In the fields of architecture, bridges, ships, aerospace, etc., the welding quality directly affects the safety of the structure. High-quality welding can prevent defects such as cracks and fractures from occurring during the use of the structure, thus avoiding catastrophic accidents.
[0003] It can be understood that defects may occur during the welding process, such as lack of fusion and incomplete penetration. These defects will affect the strength and durability of the cover plate weld seam. The penetration width of the weld seam of a welded part can be used as an important technical parameter to evaluate the welding quality. A reasonable penetration width can ensure good mechanical properties and structural integrity of the cover plate weld seam. Therefore, the measurement of the penetration width can help detect possible defects during the welding process. By timely discovering and correcting these problems, the welding quality can be improved.
[0004] Traditional methods for detecting cover plate weld seams, such as manual visual inspection, have problems such as strong subjectivity, low efficiency, and being easily affected by the environment. At present, in the technology for detecting cover plate weld seams, relatively advanced detection technologies have been proposed. For example, the application with the publication number CN118644466A proposes an image processing technology based on the YOLO deep learning model, which can quickly and accurately detect cover plate weld seam defects, reduce rework caused by inaccurate detection, and improve production efficiency. However, after identifying the cover plate weld seam, there are still problems of low measurement accuracy caused by human eye recognition for the measurement of the penetration width, which cannot meet the requirements of automated production line.
[0005] In summary, after accurately positioning the position of the cover plate weld seam, how to effectively measure the penetration width of the weld seam is still a technical problem that urgently needs to be solved at present. Summary of the Invention
[0006] The purpose of the present invention is to overcome the deficiencies existing in the prior art and provide a method and device for measuring the penetration width of a cover plate weld seam based on ultrasonic images, which can effectively measure the penetration width of the cover plate weld seam and improve the accuracy and efficiency of the penetration width measurement of the weld seam.
[0007] According to the technical solution provided by the present invention, a method for measuring the penetration width of a cover plate weld seam based on ultrasonic images, the method for measuring the penetration width of the cover plate weld seam includes:
[0008] Provide the ultrasonic image of the cover plate welding target with the weld width to be measured, and load the ultrasonic image of the cover plate welding target into the constructed cover plate weld width detection model, so as to use the cover plate weld width detection model to extract the weld area in the ultrasonic image of the cover plate welding target, and generate a weld width measurement area based on the extracted weld area;
[0009] For the weld width measurement area generated above, statistically calculate the column measurement distance corresponding to each column of pixels in the width direction of the weld width measurement area, and determine the weld width size of the cover plate weld in the ultrasonic image of the cover plate welding target based on all the column measurement distances.
[0010] When generating the weld width measurement area, it includes:
[0011] Based on the cover plate weld width detection model, extract the weld area in the ultrasonic image of the cover plate welding target to generate a basic weld area image;
[0012] Determine the clarity state of the basic weld area image. When the clarity state of the basic weld area image is low clarity, at least perform adaptive gray stretching processing on the basic weld area image to adjust the brightness of the pixels in the basic weld image through the adaptive gray stretching processing, and generate a gray stretched weld area image after the adaptive gray stretching processing;
[0013] Generate a weld width measurement area based on the gray stretched weld area image.
[0014] When determining the clarity state of the basic weld area image, it includes:
[0015] For the basic weld area image, calculate and determine the clarity value of the basic weld area image;
[0016] Compare the calculated clarity value of the basic weld area image with the clarity threshold to determine the clarity state of the basic weld area image. Among them, when the clarity value of the basic weld area image is less than the clarity threshold, the clarity state of the basic weld area image is determined to be low clarity, otherwise, the clarity state of the basic weld area image is determined to be high clarity.
[0017] When performing adaptive gray stretching processing on the basic weld area image, it includes:
[0018] Configure a gray stretching processing window, and use the configured gray stretching processing window to gradually slide and select on the basic weld area image to form a gray area to be stretched after each slide and selection;
[0019] For the gray area to be stretched selected by sliding, calculate and determine the gray gain coefficient of the current gray area to be stretched, and perform gray adjustment on all the pixels in the current gray area to be stretched based on the calculated gray gain coefficient, where,
[0020] When calculating the gray gain coefficient of the current gray-scale area to be stretched, the following formula is used:
[0021]
[0022] Among them, G i is the gray gain coefficient of the current gray-scale area to be stretched, MG is the maximum gain, mG is the minimum gain, start is the starting gray value of the current gray-scale area to be stretched, seq i is the pixel gray distribution interval within the current gray-scale area to be stretched, λ1 is the first proportional coefficient, λ2 is the second proportional coefficient, max(seqi) is the maximum gray value within the pixel distribution interval seq i and min(seqi) is the minimum gray value within the pixel distribution interval seq i ;
[0023] After gray-scale adjustment is performed on all gray-scale areas to be stretched, a gray-scale stretched weld area image is generated.
[0024] When generating a weld width measurement area based on the gray-scale stretched weld area image, at least pixel fusion processing is performed on the gray-scale stretched weld area image. Among them,
[0025] When performing pixel fusion processing, it includes:
[0026] Perform array division on the gray-scale stretched weld area image to obtain pixel areas to be fused distributed in an array after the array division. Among them, the array size of the pixel areas to be fused is the same as the array size of the gray-scale areas to be stretched;
[0027] For each pixel area to be fused, when performing pixel fusion, the following formula is used:
[0028]
[0029] Among them, I out (x, y) is the gray value of the pixel at the coordinate position (x, y) after pixel fusion, I in (x, y) is the pixel at the coordinate position (x, y) within the pixel area to be fused, G n (I in (x, y)) is the gray value of the pixel I in (x, y) after the above-mentioned adaptive gray-scale stretching processing, and d n is the pixel distance between a pixel and its m adjacent neighborhoods within the current pixel area to be fused.
[0030] When calculating and determining the sharpness value of the basic weld region image, the calculation method includes the calculation method using the Laplace operator, the calculation method using the Sobel operator, the calculation method of the Tenengrad function, or the calculation method using the Brenner gradient.
[0031] When counting the column measurement distances corresponding to each column of pixels, there is:
[0032] Perform array peak detection on each column of pixels, and count the column measurement distances corresponding to each column of pixels after the array peak detection, where
[0033] When counting the column measurement distances corresponding to each column of pixels, find the peak spacing, and configure the peak spacing adapted to the array peak statistical threshold as the column measurement distance of the current column of pixels. After extracting the weld region in the ultrasonic image of the cover plate welding target, determine the minimum circumscribed rectangle of the extracted weld region, and use the width of the minimum circumscribed rectangle as the array peak statistical threshold;
[0034] Determine the mode of all column measurement distances, and use the determined mode as the weld penetration width dimension.
[0035] When constructing the cover plate weld penetration width detection model, it includes:
[0036] Construct a basic model for weld penetration width detection, and construct a training data set for weld penetration width detection training used to train the basic model for weld penetration width detection. Among them,
[0037] The training data set for weld penetration width detection includes several training samples, and each training sample includes a training ultrasonic image of the cover plate weld, and the weld region is marked on the training ultrasonic image of the cover plate weld;
[0038] Configure the model training conditions for training the basic model for weld penetration width detection, and train the basic model for weld penetration width detection based on the configured model training conditions and the constructed training data set for weld penetration width detection until the model training reaches the target state. After that, configure the basic model for weld penetration width detection that reaches the target state as the cover plate weld penetration width detection model.
[0039] The configured model training conditions include the model training loss function. Among them,
[0040] The model training loss function includes:
[0041]
[0042] Among them, Loss is the value of the model training loss function, L CLS is the classification loss, L BOX is the bounding box regression loss, y iis the true label of the i-th training sample, is the class probability of the predicted output for the i-th training sample by the basic model for weld width detection, B i is the bounding box predicted by the basic model for weld width detection for the i-th training sample, is the true bounding box of the i-th training sample, N is the number of positive samples, for the predicted bounding box B i and the true bounding box perform the intersection over union operation.
[0043] A device for measuring the weld width of a cover plate based on ultrasonic images includes a weld width measurement processor, and a cover plate weld width detection model is deployed inside the weld width measurement processor;
[0044] For any ultrasonic image of a cover plate welding target, the weld width measurement processor measures the weld width of the cover plate using the method described above, and outputs the weld width size of the cover plate weld in the ultrasonic image of the cover plate welding target after the weld width measurement.
[0045] Advantages of the present invention: Construct a cover plate weld width detection model, and use the constructed cover plate weld width detection model to identify and extract the weld area of the ultrasonic image of the cover plate welding target, so that a weld width measurement area can be generated after the identification and extraction;
[0046] Statistically calculate the column measurement distances corresponding to each column of pixels in the width direction of the weld width measurement area, and determine the weld width size of the cover plate weld in the ultrasonic image of the cover plate welding target based on all the column measurement distances, thereby realizing the measurement of the weld width of the cover plate weld; when generating the weld width measurement area, adaptive gray-scale stretching processing and pixel fusion processing can be performed, thereby improving the accuracy and efficiency of the weld width measurement. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 is a flowchart of an embodiment of the cover plate weld width measurement of the present invention.
[0048] Figure 2 is a schematic diagram of an embodiment of the ultrasonic image of the cover plate welding target of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0049] The present invention will be further described below in conjunction with specific drawings and embodiments.
[0050] In order to effectively measure the weld width of the cover plate weld and improve the accuracy and efficiency of the weld width measurement, the present invention provides a method for measuring the weld width of the cover plate based on ultrasonic images. Specifically, the method for measuring the weld width of the cover plate includes:
[0051] Provide a cover plate welding target ultrasonic image with the weld width to be measured, and load the cover plate welding target ultrasonic image into the constructed cover plate weld width detection model, so as to use the cover plate weld width detection model to extract the weld area in the cover plate welding target ultrasonic image, and generate a weld width measurement area based on the extracted weld area;
[0052] For the weld width measurement area generated above, statistically calculate the column measurement distances corresponding to each column of pixels in the width direction of the weld width measurement area, and determine the weld width size of the cover plate weld in the cover plate welding target ultrasonic image based on all the column measurement distances.
[0053] Figure 1 FIG. shows a flowchart of an embodiment for measuring the weld width of the cover plate weld of the present invention. It can be seen from the figure that when measuring the weld width of the cover plate weld, it is necessary to provide a cover plate welding target ultrasonic image. Among them, the cover plate welding target ultrasonic image can be an image generated by ultrasonic scanning of the welded cover plate. The method of ultrasonic scanning the cover plate and the method of generating an image after ultrasonic scanning can be consistent with the prior art. It can be understood that when ultrasonic scanning the welded cover plate, the ultrasonic scanning area should at least include the welded area. The cover plate can be a component used in the automotive field. Of course, the cover plate can also be other welded components. The application field of the cover plate is not limited here, as long as it can meet the requirement of generating a cover plate welding target ultrasonic image through ultrasonic scanning.
[0054] It should be noted that the provided cover plate welding target ultrasonic image preferably includes a complete weld. As shown in the example, the weld generally has a rectangular shape. The area within the red frame in FIG. is the weld, and the width of the weld is the weld width. In order to realize the measurement of the weld width, a cover plate weld width detection model should be constructed, and the cover plate welding target ultrasonic image should be loaded into the cover plate weld width detection model. The cover plate weld width detection model can be used to perform target detection on the weld in the cover plate welding target ultrasonic image, and extract the weld area in the cover plate welding target ultrasonic image after target detection, that is, extract the area within the red frame in FIG. Specifically, when implementing, after extracting the weld area, a weld width measurement area can be generated. Figure 2 As shown in the example, the weld generally has a rectangular shape. Figure 2 In FIG., the area within the red frame is the weld, and the width of the weld is the weld width. In order to realize the measurement of the weld width, a cover plate weld width detection model should be constructed, and the cover plate welding target ultrasonic image should be loaded into the cover plate weld width detection model. The cover plate weld width detection model can be used to perform target detection on the weld in the cover plate welding target ultrasonic image, and extract the weld area in the cover plate welding target ultrasonic image after target detection, that is, extract the area within the red frame in FIG. Specifically, when implementing, after extracting the weld area, a weld width measurement area can be generated. Figure 2 In FIG., the area within the red frame is extracted. Specifically, when implementing, after extracting the weld area, a weld width measurement area can be generated.
[0055] It can be understood that the generated weld width measurement area should be in the image state, and the shape of the weld width measurement area is rectangular. Specifically, when implementing, after generating the weld width measurement area, the boundary state of the weld width measurement area can be determined, and thus the length direction and width direction of the weld width measurement area can be determined. For example, when extracting Figure 2When showing the weld area shown in the figure, the length direction of the red frame in the figure is the length direction of the weld width measurement area, and the width direction of the red frame is the width direction of the weld width measurement area. For other cases, reference can be made to the description here, and no further examples will be given.
[0056] In an embodiment of the present invention, the column measurement distances corresponding to each column of pixels are statistically calculated, and based on all the column measurement distances, the weld width dimension of the cover plate weld in the cover plate welding target ultrasonic image is determined. At this time, the measurement of the weld width of the cover plate weld is realized. Specifically, the method of statistically calculating the column measurement distances and determining the weld width dimension can refer to the corresponding description below.
[0057] In an embodiment of the present invention, when generating the weld width measurement area, it includes:
[0058] Based on the cover plate weld width detection model, the weld area in the cover plate welding target ultrasonic image is extracted to generate a basic weld area image;
[0059] Determine the clarity state of the basic weld area image. When the clarity state of the basic weld area image is low clarity, at least adaptive gray-scale stretching processing is performed on the basic weld area image to adjust the brightness of the pixels in the basic weld image through the adaptive gray-scale stretching processing, and a gray-scale stretched weld area image is generated after the adaptive gray-scale stretching processing;
[0060] Generate a weld width measurement area based on the gray-scale stretched weld area image.
[0061] As can be seen from the above description, when using the cover plate weld width detection model to extract the weld area, the extracted weld area is in an image state, and thus the weld area image can be directly obtained. Since the scanning parameters of ultrasonic scanning will be different, the clarity state of the generated basic weld area image will be different. It can be understood that when the clarity state of the basic weld area image is low clarity, it will affect the subsequent measurement of the weld width. Therefore, when the clarity state of the basic weld area image is low clarity, at least adaptive gray-scale stretching processing is performed on the basic weld area image to adjust the brightness of the pixels in the basic weld image.
[0062] In an embodiment of the present invention, when determining the clarity state of the basic weld area image, it includes:
[0063] For the basic weld area image, calculate and determine the clarity value of the basic weld area image;
[0064] The calculated clarity value of the basic weld area image is compared with the clarity threshold to determine the clarity state of the basic weld area image, wherein when the clarity value of the basic weld area image is less than the clarity threshold, the clarity state of the basic weld area image is determined to be low clarity, otherwise, the clarity state of the basic weld area image is determined to be high clarity.
[0065] In specific implementation, the clarity of the image can be measured by calculating the blurriness of the image. Specifically, when calculating and determining the clarity value of the basic weld area image, the calculation method includes a calculation method using a Laplace operator, a calculation method using a Sobel operator, a calculation method using a Tenengrad function, or a calculation method using a Brenner gradient. The following uses the calculation method using a Laplace operator as an example to illustrate the method and process of calculating the clarity value of the basic weld area image.
[0066] Specifically, the Laplace operator is used to calculate the second-order derivative of each pixel in the basic weld area image, which can reflect the local changes of the basic weld area image. After the Laplace operator is used for operation, the variance of the Laplace operator operation result is calculated to measure the blurriness of the basic weld area image. The variance is used to measure the discrete degree of the Laplace operator result. The larger the variance, the more drastic the local changes of the basic weld area image, that is, the clearer the basic weld area image.
[0067] Specifically, when the Laplace operator is used to calculate and determine the clarity value of the basic weld area image, then:
[0068]
[0069] Wherein, Blur is the clarity value of the basic weld area image, ΔI(x, y) is the Laplace operator calculation result of the pixel at point (x, y) in the basic weld image, Var(ΔI) is the variance of the Laplace operator calculation result, M is the total number of pixels in the basic weld area image, (x, y)∈Image represents the pixel coordinates belonging to the basic weld area image, and μ is the average value of the Laplace operator calculation results of M pixels.
[0070] When the Laplace operator is calculated for the pixel at the point (x, y) inside the basic weld image, we have:
[0071] ΔI(x,y)=I(x+1,y)+I(x-1,y)+I(x,y+1)+I(x,y-1)-4I(x,y)
[0072] Among them, I(x,y) is the brightness value of the pixel at the coordinate position (x,y) in the basic weld area image.
[0073] After obtaining the sharpness value of the basic weld region image by the above method, the calculated sharpness value of the basic weld region image should be compared with a preset sharpness threshold. Specifically, when the sharpness value is less than the sharpness threshold, the sharpness state of the basic weld region image is determined to be low sharpness; otherwise, the sharpness state of the basic weld region image can be determined to be high sharpness. In specific implementation, it can be determined according to the welded cover plate and the working condition of ultrasonic scanning. For example, the sharpness threshold can be set to 100. Of course, the sharpness threshold can also be set to other situations, which can be specifically selected according to needs.
[0074] It should be noted that the above shows an embodiment of determining the sharpness value of the basic weld region image by using the calculation method of the Laplace operator. When using the calculation methods of the Sobel operator, the Tenengrad function, or the Brenner gradient, the common technical means in the technical field can be used to determine the sharpness value of the basic weld region image. The specific calculation and determination methods and processes can be consistent with the prior art, which are well-known to those skilled in the technical field and will not be explained one by one here.
[0075] As can be seen from the above description, when the sharpness state of the basic weld region image is determined to be high sharpness, there is no need to perform adaptive gray-scale stretching processing on the basic weld region image; while when the sharpness state of the basic weld region image is determined to be low sharpness, the basic weld region image should be subjected to adaptive gray-scale stretching processing, so as to improve the image quality of the generated weld width measurement region and further improve the accuracy of weld width measurement.
[0076] In an embodiment of the present invention, when performing adaptive gray-scale stretching processing on the basic weld region image, it includes:
[0077] Performing array division on the basic weld region image to form a number of gray-scale regions to be stretched distributed in an array after the array division;
[0078] For any gray-scale region to be stretched, calculating and determining the gray-scale gain coefficient of the current gray-scale region to be stretched, and performing gray-scale adjustment on all pixels in the current gray-scale region to be stretched based on the calculated gray-scale gain coefficient, where
[0079] When calculating the gray-scale gain coefficient of the current gray-scale region to be stretched, there is:
[0080]
[0081] where G i is the gray-scale gain coefficient of the current gray-scale region to be stretched, MG is the maximum gain, mG is the minimum gain, start is the starting gray-scale value of the current gray-scale region to be stretched, seqi is the pixel gray distribution interval within the current gray-scale area to be stretched, λ1 is the first proportionality coefficient, λ2 is the second proportionality coefficient, max(seqi) is the maximum gray value within the pixel distribution interval seq i and min(seqi) is the minimum gray value within the pixel distribution interval seq i ;
[0082] After gray-scale adjustment is performed on all gray-scale areas to be stretched, a gray-scale stretched weld area image is generated.
[0083] It should be noted that when performing adaptive gray-scale stretching processing, the basic weld area image should be divided into an array so that after the array division, gray-scale areas to be stretched with an array distribution can be obtained. At this time, the sizes of each gray-scale area to be stretched are the same, that is, a uniform division of the basic weld area image is achieved. It can be understood that when the sizes of the gray-scale areas to be stretched are different, it will affect the stretching effect of the basic weld area image and the corresponding adaptive gray-scale stretching processing time. To meet the stretching effect of the basic weld area image and reduce the time of adaptive gray-scale stretching processing and improve the efficiency of measuring the width of the cover plate weld, the basic weld area image can be divided into an array in the way of 7×7 or 9×9. Specifically in implementation, the basic weld area image is preferably divided into an array in the way of 9×9. At this time, the basic weld area image is divided into 9 rows and 9 columns of gray-scale areas to be stretched.
[0084] Specifically, after the basic weld area image is divided into an array to obtain gray-scale areas to be stretched with an array distribution, the same operation processing is performed on each gray-scale area to be stretched. For example, the gray-scale gain coefficient of each gray-scale area to be stretched is calculated. Thereafter, the gray-scale of all pixels within the current gray-scale area to be stretched is adjusted by using the calculated gray-scale gain coefficient. When performing gray-scale adjustment, the gray value of each pixel within the current gray-scale stretching processing window can be multiplied by the corresponding gray-scale gain coefficient, and the new gray value obtained by multiplying the gray value by the corresponding gray-scale gain coefficient is used as the gray value of the current pixel.
[0085] Specifically in implementation, the above gray-scale gain calculation and corresponding gray-scale adjustment are performed on each gray-scale area to be stretched, then the adaptive gray-scale stretching processing of the basic weld area image is completed, and at this time, a gray-scale stretched weld area image can be generated.
[0086] The following specifically describes the case of calculating the grayscale gain coefficient. Specifically, the maximum gain MG represents the maximum adjustment range of grayscale stretching, and the maximum gain MG can be set to 3; the minimum gain mG represents the minimum adjustment range of grayscale stretching, and the minimum gain mG can be set to 1. The starting grayscale value start represents the starting grayscale of the current grayscale area to be stretched, that is, the minimum grayscale value of the current grayscale area to be stretched. After determining the grayscale area to be stretched, the corresponding starting grayscale value start can be determined.
[0087] For the pixel distribution interval seq of the current grayscale area to be stretched i , which represents the pixel distribution interval of the current grayscale area to be stretched. Therefore, for a determined grayscale area to be stretched, the maximum grayscale value max(seq i ) and the minimum grayscale value min(seq i ) corresponding to the current grayscale area to be stretched can be determined. In specific implementation, the first proportionality coefficient λ1 can be taken as 1 / 4, and the second proportionality coefficient λ2 can be taken as 3 / 4.
[0088] When calculating the grayscale gain coefficient, (max(start, seq i )) should be calculated first. When calculating (max(start, seq i ), the larger value between the starting grayscale value start and the pixel distribution interval seq i is taken, and after selecting the larger value, it can be used as the basis for grayscale adjustment, which helps to ensure that the adjustment of grayscale stretching will not fail due to too small an area.
[0089] Calculate , this part calculates the relationship between the minimum grayscale value min_seq i of the current pixel and the starting grayscale value start, and the size of the calculation result value can be adjusted through the second proportionality coefficient λ2. It can be understood that the larger the current calculated result value, the larger the grayscale value of the current pixel. Therefore, during the stretching process, its grayscale value needs to be reduced.
[0090] Calculate , it represents the relationship between the minimum grayscale value min_seq i of the current pixel and the maximum grayscale value max_seq i , and the size of this calculated result value can be adjusted through the first proportionality coefficient λ1 and the second proportionality coefficient λ2. It can be understood that the smaller the current calculated result value, the smaller the grayscale value of the current pixel. Therefore, during the stretching process, its grayscale value needs to be increased.
[0091] In specific implementation, based on the above calculation, the grayscale value temp is obtained, and the grayscale value temp will be based on the grayscale value seq of the current pixel iAdjust the relationship with the maximum gray value max_seq i and the starting gray value start to achieve the purpose of stretching the gray value.
[0092] As can be seen from the calculation of the above gray gain coefficient, for each gray area to be stretched, by comprehensively considering the gray value of the gray area to be stretched, the size of the gray area to be stretched, and the influence of the reference value, the gray gain coefficient can be configured within a reasonable range, so as to effectively adjust the gray range of the basic weld area image, enhance the contrast and visual effect of the basic weld area image. Specifically, after adaptive gray stretching processing, the pixel brightness in the low pixel interval can be increased, the pixel brightness in the high-brightness pixel interval remains unchanged, and the brightness of the middle pixels is stretched appropriately, so as to automatically adjust the contrast of the basic weld area image.
[0093] In an embodiment of the present invention, when generating a weld width measurement area based on a gray-stretched weld area image, at least pixel fusion processing is performed on the gray-stretched weld area image, where
[0094] When performing pixel fusion processing, it includes:
[0095] Divide the gray-stretched weld area image into an array to obtain pixel areas to be fused distributed in an array after the array division, where the array size of the pixel areas to be fused is the same as the array size of the gray areas to be stretched;
[0096] For each pixel area to be fused, during pixel fusion, there is:
[0097]
[0098] where I out (x, y) is the gray value of the pixel at the coordinate position (x, y) after pixel fusion, I in (x, y) is the pixel at the coordinate position (x, y) within the pixel area to be fused, G n (I in (x, y)) is the gray value of the pixel I in (x, y) after the above adaptive gray stretching processing, and d n is the pixel distance between a pixel in the current pixel area to be fused and its adjacent m neighborhood pixels.
[0099] It can be understood that if there is no need to perform pixel fusion processing on the gray-stretched weld area image, the gray-stretched weld area image can be configured as the weld width measurement area; when pixel fusion processing is performed on the gray-stretched weld area image, after pixel fusion processing, a weld width measurement area can be generated.
[0100] It should be noted that after the above-mentioned adaptive gray-scale stretching processing, for the generated gray-scale stretched weld region image, the entire image will not be within a single pixel brightness range, and thus a grid state will appear. To reduce the impact of the grid on subsequent weld width measurement, the present invention can perform pixel fusion processing on the gray-scale stretched weld region image, that is, the grid state in the image can be reduced through pixel fusion processing.
[0101] Specifically, when performing pixel fusion processing, it is necessary to perform array division on the gray-scale stretched weld region image. The method of performing array division can be the same as that for the basic weld region image array division. At this time, the array size of the pixel regions to be fused obtained by division is the same as the array size of the gray-scale regions to be stretched. That is: when performing array division on the gray-scale stretched weld region image, the array size is 7×7 or 9×9. For example, the gray-scale stretched weld region image can be divided into pixel regions to be fused with a 9×9 array distribution, so that the pixel regions to be fused and the gray-scale regions to be stretched are in one-to-one correspondence.
[0102] For a determined pixel region to be fused, the gray-scale value of each pixel within the pixel region to be fused can be determined. Thereafter, the pixel distance d between each pixel and its adjacent m neighboring pixels can be calculated using common technical means in the technical field. n , where m can take 9. After calculating the pixel distance d n , the above method can be used for pixel fusion to obtain the gray-scale value of each pixel after pixel fusion.
[0103] In an embodiment of the present invention, when counting the column measurement distances corresponding to each column of pixels, there is:
[0104] Perform array peak detection on each column of pixels, and count the column measurement distances corresponding to each column of pixels after array peak detection, where
[0105] When counting the column measurement distances corresponding to each column of pixels, find the peak spacing, and configure the peak spacing adapted to the array peak statistical threshold as the column measurement distance of the current column of pixels. Among them, after extracting the weld region in the ultrasonic image of the cover plate welding target, determine the minimum circumscribed rectangle of the extracted weld region, and use the width of the minimum circumscribed rectangle as the array peak statistical threshold;
[0106] Determine the mode of all column measurement distances, and use the determined mode as the weld width size.
[0107] As can be seen from the above description, after the weld region is extracted from the ultrasonic image of the cover plate welding target using the cover plate weld width detection model, the minimum bounding rectangle of the extracted weld region can be determined based on the border position of the extracted weld region. The method and process for determining the minimum bounding rectangle can be consistent with the prior art and will not be elaborated here. After determining the minimum bounding rectangle, the width of the minimum bounding rectangle can be used as the array peak statistical threshold.
[0108] When finding the peak spacing, it should be related to each column of pixels. For example, there are 10 rows in the first column of pixels, and the grayscale values of the corresponding pixels are 10, 31, 28, 25, 12, 13, 40, 50, 42, 43 respectively. Then, the first pixel maximum value is found at the head of the 10 rows, which is 31. Then, the pixel value that is the largest and closest to the tail is found at the end of the data, which is 50. Then the width is the corresponding index distance: 8 - 2 = 6. It should be understood that for the pixels in other columns, the method for finding the peak spacing can refer to the description here and will not be elaborated.
[0109] In specific implementation, when finding the peak spacing, the peak spacing adapted to the array peak statistical threshold specifically means that the peak spacing is not greater than the array peak statistical threshold, and the difference between the peak spacing and the array peak statistical threshold is within an allowable numerical range. The allowable numerical range can indicate that the peak spacing is not greater than the array peak statistical threshold but is relatively close to the array peak statistical threshold.
[0110] By using the above method, the column measurement distance of each column can be determined. After determining all the column measurement distances, the mode of all the column measurement distances can be obtained by using the statistical method adopted in the prior art. Thereafter, the determined mode is used as the weld width size, and thus the measurement of the weld width can be realized.
[0111] It should be noted that the measurement unit of the weld width size in the present invention is mm. When determining the weld width size through the weld width measurement area, the corresponding pixel size is first obtained, and then the corresponding pixel size is mapped to the corresponding physical size, that is, the weld width size is determined. When mapping the pixel size, the corresponding mapping relationship can be determined according to the situation of the ultrasonic image of the cover plate welding target. Thereafter, the determined mapping relationship can be used for the above mapping conversion. The method and process for determining the mapping relationship can be consistent with the prior art and are well-known to those skilled in the art, and will not be elaborated here.
[0112] In an embodiment of the present invention, when constructing the cover plate weld width detection model, it includes:
[0113] Construct a basic weld width detection model and construct a weld width detection training data set for model training of the basic weld width detection model, where
[0114] The weld width detection training dataset includes a number of training samples, each of which includes a training ultrasonic image of a cover plate weld, and the weld area is marked on the training ultrasonic image of the cover plate weld;
[0115] Configure the model training conditions for training the basic model of weld width detection, and train the basic model of weld width detection based on the configured model training conditions and the constructed weld width detection training dataset until the model training reaches the target state. After that, configure the basic model of weld width detection that reaches the target state as the cover plate weld width detection model.
[0116] In specific implementation, when constructing the basic model of weld width detection, it can be generated by using existing common object detection models. For example, YOLOV11 can be used to construct the basic model of weld width detection. Of course, other object detection models can also be used to construct the corresponding basic model of weld width detection; it should be understood that the basic model of weld width detection is the weld width detection model that has not been trained, and the weld width detection model is the model generated after training the basic model of weld width detection.
[0117] When training the basic model of weld width detection, a weld width detection training dataset should be constructed. Among them, the weld width detection training dataset includes a number of training samples. Generally, each training sample includes a training ultrasonic image of a cover plate weld, and the weld area is marked on the training ultrasonic image of the cover plate weld. Among them, the marked weld area should be the area including the weld, such as Figure 2 the area corresponding to the red box in.
[0118] The method for constructing the weld width detection training dataset will be illustrated by examples below. Specifically, at the cover plate welding site, the ultrasonic scanning images of the cover plate welds are collected in different scenarios. Among them, the data is collected according to two situations: the texture of the cover plate weld position is clear and fuzzy. A total of 3,000 ultrasonic images containing cover plate welds are collected. In one embodiment, there are 1,921 ultrasonic images with clear weld position texture and 1,079 ultrasonic images with unclear texture; specifically, whether the weld position texture is clear or fuzzy can be judged by those skilled in the art with the naked eye. Of course, other methods can also be used to determine it, and no further examples will be given here.
[0119] Perform training preprocessing on the above ultrasonic images. The training preprocessing performed at least includes image pixel normalization, changing image brightness, cropping, rotation, and / or mosaic. Specifically, when performing image pixel normalization, the pixel values are normalized from the original range (such as 0 to 255) to [0, 1], making the data ranges of different ultrasonic images consistent. The normalized data can better adapt to the input requirements of the basic model for weld width detection, thereby improving the training effect and generalization ability of the basic model for weld width detection and reducing the overfitting problem of the basic model for weld width detection caused by data range differences.
[0120] By changing the image brightness, simulate scenes with different brightness levels, enabling the basic model for weld width detection to better adapt to various brightness environments. By randomly cropping ultrasonic images, increase the diversity of training data. By removing irrelevant information in the ultrasonic images, make the basic model for weld width detection more focused on the target area. By rotating the ultrasonic images, the basic model for weld width detection can identify targets in different directions, increasing the diversity of training data and improving the generalization ability of the basic model for weld width detection. By using mosaic to splice multiple images into a large image, increase the diversity of training data and improve the generalization ability of the basic model for weld width detection.
[0121] It should be noted that when performing the above pre-training preprocessing, when performing corresponding processing on image pixel normalization, changing image brightness, cropping, rotation, and mosaic, the corresponding processing methods and processes can be consistent with the prior art and will not be elaborated here. It can be understood that when using the above training preprocessing, the corresponding training ultrasonic images of the cover plate welds can be obtained. Thereafter, existing common annotation tools can be used for weld area annotation, and thus a training sample can be formed. The number of training samples in the weld width detection training data set can be selected according to actual needs, specifically based on meeting the requirements of the basic model for weld width detection, which will not be elaborated here.
[0122] It should be understood that the configured model training conditions mainly meet the model training conditions for the basic model for weld width detection. The model training conditions generally should include the model training loss function, learning rate, and number of iterations, etc. The situation of the model training conditions can be selected according to needs. For example, the learning rate can be set to 0.01, and the number of iterations can be set to 300, etc. The situation of the model training loss function will be explained below.
[0123] In an embodiment of the present invention, the configured model training conditions include the model training loss function, where
[0124] The model training loss function includes:
[0125]
[0126] Among them, Loss is the value of the model training loss function, and L CLS is the classification loss, and L BOX is the bounding box regression loss, y i is the true label of the i-th training sample, is the class probability of the prediction output for the i-th training sample by the basic model for weld width detection, B i is the bounding box predicted by the basic model for weld width detection for the i-th training sample, is the true bounding box of the i-th training sample, N is the number of positive samples, is for the predicted bounding box B i and the true bounding box to perform the intersection over union operation.
[0127] Specifically, the classification loss L CLS can use the cross-entropy loss function to measure the difference between the predicted class probability and the true label, and the bounding box regression loss L BOX uses the intersection over union operation to measure the difference between the predicted bounding box and the true bounding box.
[0128] It should be noted that during object detection, the present invention is a two-class classification. Therefore, the class predicted by the basic model for weld width detection for the i-th training sample is whether the extracted region is a weld region. The bounding box B i can be obtained from the output of the basic model for weld width detection, and the manner and process of the intersection over union operation can be consistent with the prior art. For the number of positive samples, it is the number of training samples marked with welds in the weld width detection training data set.
[0129] During model training, for each training sample, a corresponding training weld region can be extracted and output through the basic model for weld width detection. Based on the output training weld region and the information of the corresponding training sample, the model training loss function value corresponding to the current training sample can be calculated. Repeating the model training operation, the model training loss function values corresponding to all training samples can be obtained.
[0130] Specifically, when using the weld width detection training data set to train the basic model for weld width detection for one epoch and the corresponding model training loss function value converges to 0.1, it can be considered that the model training of the basic model for weld width detection reaches the target state. At this time, the basic model for weld width detection that reaches the target state can be configured as the weld width detection model.
[0131] From the above description, a cover plate weld width measurement device based on ultrasonic images can be obtained. Specifically, it includes a weld width measurement processor, and a cover plate weld width detection model is deployed inside the weld width measurement processor;
[0132] For any ultrasonic image of a cover plate welding target, the weld width measurement processor measures the weld width of the cover plate using the method described above, and outputs the weld width size of the cover plate weld in the ultrasonic image of the cover plate welding target after the weld width measurement.
[0133] Specifically, the weld width measurement processor can be a commonly used computer device. By deploying the above-mentioned cover plate weld width detection model inside the weld width measurement processor, the weld width measurement processor can be enabled to have the ability to measure the weld width. Thereafter, the ultrasonic image of the cover plate welding target can be input into the weld width measurement processor to measure the weld width of the ultrasonic image of the cover plate welding target using the weld width measurement processor. The method and process of the weld width measurement can refer to the above description and will not be elaborated here.
Claims
1. A method for measuring the penetration width of a cover plate weld seam based on ultrasonic images, characterized in that, The method for measuring the weld width of the cover plate includes: Providing a target ultrasonic image of the cover plate weld with the weld width to be measured, and loading the target ultrasonic image of the cover plate weld into the constructed cover plate weld width detection model to extract the weld region in the target ultrasonic image of the cover plate weld by using the cover plate weld width detection model, and generating a weld width measurement region based on the extracted weld region; For the weld width measurement region generated above, statistically determine the column measurement distance corresponding to each column of pixels in the width direction of the weld width measurement region, and determine the weld width size of the cover plate weld in the target ultrasonic image of the cover plate weld based on all the column measurement distances.
2. The method for measuring the penetration width of the cover plate weld based on ultrasonic images according to claim 1, wherein, When generating the weld width measurement region, it includes: Extracting the weld region in the target ultrasonic image of the cover plate weld based on the cover plate weld width detection model to generate a basic weld region image; Determining the clarity state of the basic weld region image. When the clarity state of the basic weld region image is low clarity, at least perform adaptive gray stretching processing on the basic weld region image to adjust the brightness of the pixels in the basic weld image through the adaptive gray stretching processing, and generate a gray stretched weld region image after the adaptive gray stretching processing; Generating a weld width measurement region based on the gray stretched weld region image.
3. The method for measuring the penetration width of the cover plate weld seam based on ultrasonic images according to claim 2, characterized in that, When determining the clarity state of the basic weld region image, it includes: For the basic weld region image, calculate and determine the clarity value of the basic weld region image; Compare the calculated clarity value of the basic weld region image with the clarity threshold to determine the clarity state of the basic weld region image. Among them, when the clarity value of the basic weld region image is less than the clarity threshold, the clarity state of the basic weld region image is determined to be low clarity, otherwise, the clarity state of the basic weld region image is determined to be high clarity.
4. The method for measuring the fusion width of the cover plate weld seam based on the ultrasonic image according to claim 2, characterized in that, When performing adaptive gray stretching processing on the basic weld region image, it includes: Configuring a gray stretching processing window, and using the configured gray stretching processing window to gradually slide and select on the basic weld region image to form a gray region to be stretched after each slide selection; For the gray region to be stretched selected by sliding, calculate and determine the gray gain coefficient of the current gray region to be stretched, and perform gray adjustment on all the pixels in the current gray region to be stretched based on the calculated gray gain coefficient. Among them, When calculating the gray gain coefficient of the current gray region to be stretched, there is: Among them, G i is the gray gain coefficient of the current gray region to be stretched, MG is the maximum gain, mG is the minimum gain, start is the starting gray value of the current gray region to be stretched, seq i is the pixel gray distribution interval within the current gray region to be stretched, λ1 is the first proportionality coefficient, λ2 is the second proportionality coefficient, max(seqi) is the maximum gray value within the pixel distribution interval seq i and min(seqi) is the minimum gray value within the pixel distribution interval seq i ; After performing gray adjustment on all the gray regions to be stretched, generate a gray stretched weld region image.
5. The method for measuring the penetration width of the cover plate weld seam based on ultrasonic images according to claim 4, characterized in that, When generating a weld width measurement region based on the gray stretched weld region image, at least perform pixel fusion processing on the gray stretched weld region image. Among them, When performing pixel fusion processing, it includes: Performing array division on the gray stretched weld region image to obtain pixel regions to be fused distributed in an array after the array division, where the array size of the pixel regions to be fused is the same as the array size of the gray regions to be stretched; For each pixel region to be fused, during pixel fusion, there is: Among them, I out (x, y) is the gray value of the pixel at the coordinate position (x, y) after pixel fusion, and I in (x, y) is the pixel at the coordinate position (x, y) within the pixel area to be fused, and G n (I in (x, y)) is the gray value of the pixel I in (x, y) after the above-mentioned adaptive gray stretching process, and d n is the pixel distance between a pixel within the current pixel area to be fused and its adjacent m neighboring pixels.
6. The method for measuring the penetration width of the cover plate weld seam based on ultrasonic images according to claim 3, characterized in that When calculating and determining the clarity value of the basic weld region image, the calculation method includes the calculation method using the Laplacian operator, the calculation method using the Sobel operator, the calculation method of the Tenengrad function, or the calculation method using the Brenner gradient.
7. The method for measuring the fusion width of the cover plate weld seam based on the ultrasonic image according to any one of claims 1 to 6, characterized in that, When counting the column measurement distances corresponding to each column of pixels, there is: Perform array peak detection on each column of pixels, and count the column measurement distances corresponding to each column of pixels after the array peak detection, where When counting the column measurement distances corresponding to each column of pixels, find the peak spacing, and configure the peak spacing adapted to the array peak statistical threshold as the column measurement distance of the current column of pixels. After extracting the weld region in the ultrasonic image of the cover plate welding target, determine the minimum circumscribed rectangle of the extracted weld region, and use the width of the minimum circumscribed rectangle as the array peak statistical threshold; Determine the mode of all column measurement distances, and use the determined mode as the weld width dimension.
8. The method for measuring the penetration width of the cover plate weld seam based on ultrasonic images according to any one of claims 1 to 6, characterized in that, When constructing the cover plate weld width detection model, it includes: Construct a basic weld width detection model, and construct a weld width detection training data set for model training of the basic weld width detection model, where The weld width detection training data set includes several training samples, each training sample includes an ultrasonic image of a cover plate weld for training, and the weld region is marked on the ultrasonic image of the cover plate weld for training; Configure the model training conditions for model training of the basic weld width detection model, and perform model training on the basic weld width detection model based on the configured model training conditions and the constructed weld width detection training data set until the model training reaches the target state. After that, configure the basic weld width detection model that reaches the target state as the cover plate weld width detection model.
9. The method for measuring the penetration width of the cover plate weld based on ultrasonic images according to claim 8, characterized in that, The configured model training conditions include a model training loss function, where The model training loss function includes: Among them, Loss is the value of the model training loss function, L CLS is the classification loss, and L BOX is the bounding box regression loss. y i is the true label of the i-th training sample. is the class probability of the prediction output for the i-th training sample predicted by the basic model for weld width detection. B i is the bounding box predicted by the basic model for weld width detection for the i-th training sample. B i gt is the true bounding box of the i-th training sample. N is the number of positive samples. Iou(B i , B i gt ) performs the intersection over union operation on the predicted bounding box B i and the true bounding box B i gt .
10. An ultrasonic image-based cover plate weld width measurement device, characterized in that, Include a weld width measurement processor, and deploy a cover plate weld width detection model inside the weld width measurement processor; For any ultrasonic image of a cover plate welding target, the weld width measurement processor measures the weld width by using the method described in any one of claims 1 to 9 above, and outputs the weld width dimension of the cover plate weld in the ultrasonic image of the cover plate welding target after the weld width measurement.
Citation Information
Patent Citations
Weld joint quality defect real-time detection method based on deep learning
CN118644466A
Thin plate overlap joint narrow weld joint ultrasound fast nondestructive testing method and device
CN104931582A
Measuring method of laser lap joint welding seam width and device used by method
CN105021142A
Detection method, device and system for overlapping weld pool width
CN108508087A
Penetration identification method based on two-way molten pool geometric and texture feature fusion
CN112529103A