A welding quality intelligent detection method and system

Through image processing technology, the neatness, uniformity and tone characteristics of the welding site are extracted and a comprehensive judgment index is generated, which solves the problem that the existing welding detection methods cannot comprehensively and accurately evaluate the welding quality, and achieves rapid and economical high-accuracy welding quality Evaluate.

CN118710641BActive Publication Date: 2024-11-05ENDU HEAVY IND (NANTONG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411187489.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-11-05
Estimated Expiration
2044-08-28

AI Technical Summary

Technical Problem

The existing welding inspection methods mainly rely on manual experience or high-cost and high-efficiency machine inspection, and it is impossible to comprehensively and accurately evaluate the welding quality, especially the bumps of the weld.

Method used

By obtaining the image at the welding, performing grayscale and HSV color space conversion, combining bilateral filtering, sobel operator and curve fitting, the neatness, uniformity and tone characteristics of the weld are extracted, and a comprehensive judgment index is generated to evaluate the welding quality. .

Benefits of technology

It achieves rapid and economical evaluation of welding quality, saves costs, improves detection accuracy and efficiency, and can consider both the collapse and protrusion of welds.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118710641B_ABST
    Figure CN118710641B_ABST
Patent Text Reader

Abstract

The present invention provides a welding quality intelligent detection method and system, which relates to the field of welding quality detection. The present invention comprises: obtaining an image at a weld, processing the image into a grayscale image and an HSV color space image, obtaining pixel uniformity and neatness of the weld in the grayscale image, and calculating the uniformity deviation rate and the neatness deviation rate; obtaining the weld hue value and the base material hue value in the HSV color space image, calculating the hue value deviation rate, and combining the three deviation rates to generate a comprehensive judgment index to judge the welding quality. The method comprehensively considers the influence of multiple factors on the welding quality, and only requires a picture of the weld to make a judgment, thereby improving accuracy and convenience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of welding detection, and in particular to a welding quality intelligent detection method and system. Background Art

[0002] The welding process is widely used in daily life to connect objects because of its convenient operation and excellent effect. The appearance quality of welding not only affects the aesthetics of the product, but more importantly, it is an intuitive indicator for evaluating the quality of welding connections. High-quality welding can ensure the safety of the assembly or structure and the performance of the structure. At present, the main welding detection methods are manual detection and machine detection. Manual detection is that the welder visually observes the welding point. This method is quick and convenient, but it relies too much on the welder's experience and the accuracy cannot be guaranteed; machine detection usually uses ultrasonic or X-rays to penetrate the material for detection. Although this method is accurate, it is costly and inefficient.

[0003] In the prior art, publication number CN115007992B discloses a method: the thickness value of the workpiece before welding is subtracted from the thickness value of the workpiece after welding to generate a welding depth, the welding depth and the workpiece thickness are detected by ultrasonic wave to determine the welding collapse ratio, the collapse ratio of the workpiece that meets the quality requirements is used as the standard collapse ratio in advance, and the actual workpiece collapse ratio is compared with the standard collapse ratio. If the actual collapse ratio is less than the standard collapse ratio, it may be that the welding depth is too small or the workpiece thickness is too large, and it is judged that the welding is not in place; if the actual collapse ratio is greater than the standard collapse ratio, it may be that the welding depth is too large or the workpiece thickness is too small, and it is judged that the welding is excessive.

[0004] The main problem with the above method is that the welding quality is judged by the collapse ratio of the welding point. However, the actual weld may not be completely collapsed, but may also have bulges. Therefore, judging the welding quality only by the collapse degree is incomplete and inaccurate. Summary of the invention

[0005] The purpose of the present invention is to provide a welding quality intelligent detection method and system to solve the problems raised in the above background technology.

[0006] To achieve the above object, the present invention provides the following technical solutions:

[0007] A welding quality intelligent detection method, the specific steps include:

[0008] Step 1: Obtain an image of the weld, scale the image, adjust the image size to 224*224, and then copy the image into two identical sets of images. One set is grayscaled to obtain a first recognition image, and the other set is converted from RGB color space to HSV color space to obtain a second recognition image. The pixel positions of the first recognition image and the second recognition image are mapped one by one.

[0009] Step 2: Filter the first recognition image using a bilateral filter, count the frequency of pixels at each level in the 256 gray levels to form a grayscale histogram, calculate the inter-class variance of each threshold in the histogram, select the optimal separation threshold by the maximum inter-class variance, use the optimal separation threshold to separate the first recognition image after filtering, identify the foreground part and the background part, extract the foreground part to form a third recognition image, and extract the background part as a fourth recognition image;

[0010] Step 3: Process the third recognition image with the Sobel operator to obtain edge pixel points of the third recognition image, perform curve fitting on each edge pixel point to obtain an approximate curve of the weld, take the inflection point of the curve on the fitted curve, use the curvature formula to obtain the inflection point curvature of the fitted curve, generate the weld neatness from the inflection point curvature, and preset a neatness threshold;

[0011] Step 4: Evenly divide the third recognition image according to the vertical coordinate to obtain a number of equal-height areas, count the number of retained pixels in each area, calculate the variance of the number of pixels in each area, record it as the weld uniformity, and preset a uniformity threshold;

[0012] Step 5: Map the position of each pixel in the third recognition image to the second recognition image, and collect the hue value corresponding to each retained pixel in the third recognition image to obtain the average hue value of the weld; collect the hue value corresponding to each pixel in the fourth recognition image to obtain the average hue value of the base material;

[0013] Step 6: Generate the uniformity deviation rate based on the uniformity and uniformity threshold of the weld, generate the uniformity deviation rate based on the weld uniformity and uniformity threshold, generate the hue deviation rate based on the average hue value of the weld and the average hue value of the base material, and generate a comprehensive judgment index based on the deviation rate to judge the welding quality.

[0014] Furthermore, the logic for calculating the optimal separation threshold is as follows: traverse all possible thresholds, separate the first recognition image into a background part and a foreground part according to the value of each threshold, count the number of pixels in the background part and the foreground part, calculate the mean of the grayscale values ​​of the pixels in the background part and the foreground part, and calculate the inter-class variance by a formula;

[0015] The formula for calculating the between-class variance is:

[0016] g(i) 2 =ω i0 ω i1 (μ i0 -μ i1 ) 2

[0017] Where: g(i) represents the inter-class variance when the threshold is i, ω i0 Indicates the proportion of the target (foreground) part to the total image when the threshold is i, μ i0 represents the gray value of the target part when the threshold is i, ω i1 Indicates the proportion of the background part to the total image when the threshold is i, μ i1 Indicates the gray value of the background part when the threshold is i;

[0018] When g(i) reaches its maximum value, the corresponding threshold i is the optimal separation threshold.

[0019] Furthermore, the principle of using the Sobel operator to process the third recognition image to obtain the edge pixels of the third recognition image is as follows: multiply the grayscale value of each pixel and the grayscale values ​​of its eight adjacent pixels by the Sobel operator horizontal template, and add all the products to obtain the horizontal gradient value of the pixel; multiply the grayscale value of the pixel and the grayscale values ​​of its eight adjacent pixels by the Sobel operator vertical template, and add all the results to obtain the vertical gradient value. The horizontal gradient value calculation formula is:

[0020]

[0021] The vertical gradient value calculation formula is:

[0022]

[0023] Where: Gx(i, j) represents the horizontal gradient value of the pixel with coordinates (i, j), Gy(i, j) represents the vertical gradient value of the pixel with coordinates (i, j), and X(i, j) represents the grayscale value of the pixel with coordinates (i, j);

[0024] The formula for generating the gradient magnitude is:

[0025]

[0026] Where: G(i, j) represents the gradient amplitude of the pixel with coordinates (i, j);

[0027] An edge threshold is set. When the gradient amplitude of a pixel with coordinates (i, j) is greater than the edge threshold, the pixel is regarded as an edge pixel.

[0028] Furthermore, the formula for calculating the inflection point curvature is:

[0029]

[0030] Where: k i represents the curvature of the i-th inflection point, u i ″(t) means to find the second-order derivative of the inflection point with horizontal coordinate t, u i ′(t) represents the first-order derivative of the inflection point with abscissa t.

[0031] Furthermore, the formula for generating weld evenness from the inflection point curvature is:

[0032]

[0033] in: Indicates the uniformity of the weld, n indicates the number of inflection points, k i represents the curvature of the i-th inflection point.

[0034] Furthermore, the formula for calculating the variance of the number of pixels in each area, that is, the uniformity of the weld seam, is:

[0035]

[0036] in: Represents the average number of pixels in each area, x i represents the number of pixels in the i-th region, m represents the number of regions, and D(x) represents the variance of the number of pixels in each region.

[0037] Furthermore, the formula for calculating the average hue value of the weld is:

[0038]

[0039] in: represents the average hue value of the weld, s represents the number of weld pixels, and h i Indicates the hue value of the i-th pixel of the weld;

[0040] The formula for calculating the average hue value of the parent material is:

[0041]

[0042] in: represents the average hue value of the base material, and p represents the number of pixels in the base material. i Indicates the hue value of the i-th pixel of the base material.

[0043] Furthermore, the formula for generating the neatness deviation rate is:

[0044]

[0045] Among them: △k represents the uniformity deviation rate, k 0 Indicates the neatness threshold, the actual neatness The larger the value is, the larger the uniformity deviation rate △k is. When the deviation is within the threshold, that is, 0≤△k≤1, the uniformity deviation is within the threshold.

[0046] The formula for generating the uniformity deviation rate is:

[0047]

[0048] Where: △D(x) represents the uniformity deviation rate, D(x) represents the uniformity of the weld, D 0 (x) represents the uniformity threshold. When △D(x)≤1, the uniformity deviation rate is within the threshold.

[0049] The formula for generating the hue deviation rate is:

[0050]

[0051] Where: △h represents the hue deviation rate, l 0 Indicates the hue value threshold, the actual weld hue value The larger the value is, the larger the hue deviation rate △h is. When the deviation rate is within the threshold, When , the hue value deviation rate is within the threshold;

[0052] The formula for generating the comprehensive judgment index is:

[0053]

[0054] Wherein: δ represents the comprehensive judgment index, △D(x) represents the uniformity deviation rate, △k represents the neatness deviation rate, and △h represents the hue deviation rate.

[0055] The present invention further provides a welding quality intelligent detection system, which is used to implement the above welding quality detection method, including:

[0056] Image acquisition module: obtain the image of the welding point, scale the image of the welding point, adjust the size of the image to 224*224, and then copy the image into two identical groups of images. One group is grayed to obtain the first recognition image, and the other group is converted from the RGB color space to the HSV color space to obtain the second recognition image, and the pixel positions of the first recognition image and the second recognition image are mapped one by one;

[0057] Image separation module: filter the first recognition image using a bilateral filter, count the frequency of pixels at each level in 256 gray levels to form a grayscale histogram, calculate the inter-class variance of each threshold in the histogram, select the optimal separation threshold by the maximum inter-class variance, use the optimal separation threshold to separate the first recognition image after filtering, identify the foreground part and the background part, extract the foreground part to form a third recognition image, and extract the background part as the fourth recognition image;

[0058] Curve fitting module: Use the Sobel operator to process the third recognition image to obtain the edge pixel points of the third recognition image, perform curve fitting on each edge pixel point to obtain the approximate curve of the weld, take the curve inflection point on the fitted curve, use the curvature formula to obtain the inflection point curvature of the fitted curve, generate the weld neatness from the inflection point curvature, and preset the neatness threshold;

[0059] Pixel recognition module: evenly divide the third recognition image according to the vertical coordinate to obtain several equal-height areas, count the number of retained pixels in each area, calculate the variance of the number of pixels in each area, record it as the weld uniformity, and preset the uniformity threshold;

[0060] Tone recognition module: maps the position of each pixel in the third recognition image to the second recognition image, and collects the tone value corresponding to each retained pixel in the third recognition image to obtain the average tone value of the weld; collects the tone value corresponding to each pixel in the fourth recognition image to obtain the average tone value of the base material;

[0061] Comprehensive processing module: Generate the uniformity deviation rate according to the uniformity threshold of the weld, generate the uniformity deviation rate according to the weld uniformity and uniformity threshold, generate the hue deviation rate according to the average hue value of the weld and the average hue value of the parent material, and generate a comprehensive judgment index based on the deviation rate to judge the welding quality.

[0062] Compared with the prior art, the present invention has the following beneficial effects:

[0063] The present invention evaluates the welding quality by analyzing the image features of the weld, specifically including the uniformity of the weld, the neatness of the weld and the color difference value of the weld. The method of mutually mapping the gray value image and the image of the HSV color space is adopted. The uniformity of the weld is represented by the variance of the pixel points in different regions, and the uniformity deviation rate is generated with the uniformity threshold. The uniformity of the weld is represented by the curvature of the image inflection point, and the neatness deviation rate is generated with the neatness threshold. The hue characteristics of the weld and the base material are identified by the HSV color space to generate the hue deviation rate. The three deviation rates generate a comprehensive judgment index to judge the welding quality. This method only needs the image of the welding point to analyze and judge, which is cost-saving and very fast. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] Figure 1 This is a flow chart of a method for intelligent detection of welding quality according to an embodiment of the present invention;

[0065] Figure 2 This is a system module diagram for intelligent detection of welding quality according to an embodiment of the present invention. DETAILED DESCRIPTION

[0066] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments.

[0067] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The words "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0068] Example:

[0069] See also Figure 1 The present invention provides a welding quality intelligent detection method, which solves the problem of inaccurate welding quality detection. The specific steps include:

[0070] Step 1: Get the image of the welding point, scale the image of the welding point, adjust the size of the image to 224*224, and then copy the image into two identical groups of images. One group is grayed to obtain the first recognition image, and the other group is converted from the RGB color space to the HSV color space to obtain the second recognition image, and the pixel positions of the first recognition image and the second recognition image are mapped one by one.

[0071] In this embodiment, the image size is adjusted to 224*224, which can retain the main features and structural information of the image and avoid excessive distortion. At the same size, data can be more easily compared, reducing the computational complexity. The purpose of copying the image into two groups of images and graying one of the groups to generate the first recognition image is: the grayed image retains the brightness information of the image, reduces the interference of the image color, enhances the image contrast, and makes the structural features of the image easier to identify. Subsequently, it is necessary to find the optimal separation threshold for the first recognition image after the graying process to retrieve the number of pixels. The formula for graying is:

[0072] Y=0.299*R+0.587*G+0.114*B

[0073] Wherein, Y is the gray value of the first recognition image, R represents the brightness value of the red channel of the initial image, G represents the brightness value of the green channel of the initial image, and B represents the brightness value of the blue channel of the initial image.

[0074] In this embodiment, the purpose of converting the image from the RGB color space to the HSV color space to generate the second recognition image is: the HSV color space uses a method that is more in line with human perception to describe color, and it divides the attributes of color into: hue (Hue), saturation (Saturation) and brightness (Value); wherein, hue indicates the type of color, which is an angle value from 0 to 360°, corresponding to the position on the color spectrum, 0° and 360° correspond to red, 120° corresponds to green, and 240° corresponds to blue; saturation indicates the intensity of the color, when the saturation is 0, it indicates grayscale color, the lightest color, the higher the saturation, the brighter the color; brightness indicates the lightness of the color, ranging from 0-100%, when the brightness is 0 it indicates black, and when the brightness is 100% it indicates white. The principle of converting an image from the RGB color space to the HSV color space is: for any pixel in the image, its RGB color space is (R 0 ,G 0 ,B 0 ), the HSV color space is (H 0 ,S 0 ,V 0 ), firstly, R 0 ,G 0 ,B 0 The value is converted to the range [0,1]:

[0075]

[0076] Then calculate H 0 ,S 0 ,V 0 The value of

[0077] V 0 =max(R,G,B)

[0078]

[0079] When processing images through OpenCV, it is necessary to visualize the HSV image. 0 ,S 0 ,V 0 The value is converted to [0,255]:

[0080] H=H 0 *2

[0081]

[0082] This completes the conversion of the image from RGB color space to HSV color space.

[0083] In this embodiment, the pixel points after image scaling are marked with coordinates, the bottom pixel point of the image is taken as the first row, the most coordinate pixel point is taken as the first column, a coordinate system is established, and the first recognition image and the second recognition image are mapped according to the coordinate system to ensure that each pixel point has unique coordinates.

[0084] Step 2: Filter the first recognition image using a bilateral filter, count the frequency of pixels at each level in 256 gray levels to form a grayscale histogram, and calculate the inter-class variance of each threshold in the histogram, select the best separation threshold by the maximum inter-class variance, use the best separation threshold to separate the first recognition image after filtering, identify the foreground part and the background part, extract the foreground part to form the third recognition image, and extract the background part as the fourth recognition image; the logic for calculating the best separation threshold is: traverse all possible thresholds, separate the first recognition image into the background part and the foreground part according to the value of each threshold, count the number of pixels in the background part and the foreground part, calculate the mean of the grayscale values ​​of the pixels in the background part and the foreground part, and calculate the inter-class variance by the formula;

[0085] The calculation formula of the inter-class variance is:

[0086] g(i) 2 =ω i0 ω i1 (μ i0 -μ i1 ) 2

[0087] In this embodiment, the calculation formula of the inter-class variance is the formula of the Otsu threshold method OTSU, g(i) represents the inter-class variance when the threshold is i, ω i0Indicates the proportion of the target (foreground) part to the total image, μ i0 represents the gray value of the target part when the threshold is i, ω i1 Indicates the proportion of the background part to the total image when the threshold is i, μ i1 Indicates the gray value of the background part when the threshold is i; when g(i) is larger, it means that the difference between the two parts of the image is greater and the separation effect is better. At this time, the corresponding i is the optimal separation threshold. In this example, the hue values ​​of the weld and the base material need to be compared later. The image is separated into the foreground part including the weld and the background part including the base material through the optimal separation threshold.

[0088] Step 3: Process the third recognition image with the Sobel operator to obtain edge pixel points of the third recognition image, perform curve fitting on each edge pixel point, obtain an approximate curve of the weld, take the curve inflection point on the fitted curve, use the curvature formula to obtain the inflection point curvature of the fitted curve, generate the weld neatness from the inflection point curvature, and preset the neatness threshold; the principle of identifying edge pixel points by the Sobel operator is: multiply the grayscale value of each pixel point and the grayscale values ​​of its eight adjacent pixels by the Sobel operator horizontal template, and add all the products to obtain the horizontal gradient value of the pixel point, multiply the grayscale value of the pixel point and the grayscale values ​​of its eight adjacent pixels by the Sobel operator vertical template, and add all the results to obtain the vertical gradient value, the horizontal gradient value calculation formula of the pixel point with coordinates (i, j) and grayscale value X(i, j) is:

[0089]

[0090] The vertical gradient value calculation formula is:

[0091]

[0092] The calculation formula of the gradient amplitude G(i, j) is:

[0093]

[0094] In this embodiment, the larger the curvature of the inflection point, the larger the deviation of the curvature of the weld here from the horizontal plane, and the smaller the neatness; the smaller the curvature of the inflection point, the smaller the deviation of the curvature of the weld here from the horizontal plane; Gx(i, j) represents the horizontal gradient value of the pixel point in the i-th row and j-th column; Gy(i, j) represents the vertical gradient value of the pixel point in the i-th row and j-th column; X(i, j) represents the grayscale value of the pixel point in the i-th row and j-th column; G(i, j) represents the gradient amplitude of the pixel point in the i-th row and j-th column.

[0095] By traversing all the gradient amplitudes, the optimal edge threshold is set. When the gradient amplitude of the pixel point with coordinates (i, j) is greater than the optimal edge threshold, the pixel point is regarded as an edge pixel point;

[0096] Assume that the image has n inflection points, then the curvature k of the i-th inflection point is i The calculation formula is:

[0097]

[0098] Weld seam flatness is generated from the inflection point curvature k The formula is:

[0099]

[0100] Among them, k i Indicates the curvature value corresponding to the i-th inflection point in the function graph, u i ′(t) indicates that the horizontal coordinate of the i-th inflection point is t, and the first-order derivative of the corresponding function, u i ″(t) means the second-order derivative of the function corresponding to the i-th inflection point with abscissa t.

[0101] The neatness threshold: The base material is set as a horizontal plane, and the level difference between the weld and the base material surface is the neatness. By observing or measuring the range of the weld protrusion or depression, the neatness threshold k that meets the quality standard and aesthetics is determined. 0 .

[0102] Step 4: Evenly divide the third recognition image according to the vertical coordinate to obtain a number of equal-height areas, count the number of retained pixels in each area, calculate the variance of the number of pixels in each area, record it as the weld uniformity, and preset a uniformity threshold;

[0103] In this embodiment, the uniformity of the weld seam means dividing the weld seam into equal-sized regions, and calculating the variance of the pixels in all regions to determine whether the number of pixels in each region is close. The larger the variance of the number of pixels, the larger the difference in the number of pixels in each region, and the smaller the uniformity of the weld seam; the smaller the variance of the number of pixels, the smaller the difference in the number of pixels in each region, and the greater the uniformity of the weld seam;

[0104] If there are m regions, then calculate the average number of pixels in all m regions for:

[0105]

[0106] The variance of the number of pixels D(x) is:

[0107]

[0108] in, Represents the average number of pixels in all regions, x i represents the number of pixels in the ith region, and D(x) represents the variance of the number of pixels in all regions, i.e., the uniformity of the weld;

[0109] Setting of the uniformity threshold: Collect materials with unqualified welding quality, detect the uniformity of the weld, and determine the optimal uniformity threshold D based on the morphology of samples with unqualified welds and samples with qualified welds. 0 (x).

[0110] Step 5: Map the position of each pixel in the third recognition image to the second recognition image, and collect the hue value corresponding to each retained pixel in the third recognition image to obtain the average hue value of the weld; collect the hue value corresponding to each pixel in the fourth recognition image to obtain the average hue value of the base material, and set the hue deviation threshold.

[0111] In this embodiment, the average hue value is collected in the HSV color space. The target color space for conversion can be determined by cv2.COLOR_BGR2HSV of the OpenCV library in Python. The hue value of the point with coordinates (r, t) is extracted by hsv_image[r, t, 0]. The hue value is the hue information of the pixel point. The hue value h of each pixel point is output by h_values, and the average hue value of the weld with s pixels is calculated. for:

[0112]

[0113] Using the same method, the average hue value of the base material with p pixels can be calculated as:

[0114]

[0115] in, represents the average hue value of all pixels at the weld, s represents the number of pixels at the weld, and h i Represents the hue value of the i-th pixel at the weld;

[0116] represents the average hue value of all pixels of the base material, p represents the number of pixels of the base material, l i Indicates the hue value of the i-th pixel of the base material;

[0117] The hue deviation threshold: collect the hue value of the base material, and determine the optimal deviation threshold l by observing and comparing the hue deviation of the welding material with different hue values ​​and the base material. 0 .

[0118] Step 6: Generate the uniformity deviation rate based on the uniformity and uniformity threshold of the weld, generate the uniformity deviation rate based on the weld uniformity and uniformity threshold, generate the hue deviation rate based on the average hue value of the weld and the average hue value of the base material, and generate a comprehensive judgment index based on the deviation rate to judge the welding quality.

[0119] In this embodiment, the parent material is regarded as a horizontal plane, and the uniformity deviation rate of the weld represents the surface difference between the weld and the parent material. The larger the surface difference, the lower the uniformity of the weld and the worse the welding quality; the smaller the surface difference, the closer the weld and the parent material are to being flush, the higher the uniformity and the better the welding quality; the calculation formula of the uniformity deviation rate is:

[0120]

[0121] k 0 Indicates the neatness threshold, the actual neatness The larger the value is, the greater the uniformity deviation rate △k is. When the deviation is within the threshold, that is, 0≤△k≤1, the uniformity test passes.

[0122] In this embodiment, materials with unqualified welding quality are collected, and the uniformity at the weld is detected. The optimal uniformity threshold is determined according to the morphology of samples with unqualified welds and qualified welds. The closer the weld uniformity is to the threshold, the greater the uniformity deviation rate is, and the worse the welding quality is; the farther the weld uniformity is from the threshold, the smaller the uniformity deviation rate is, and the better the welding quality is. The calculation formula of the uniformity deviation rate is:

[0123]

[0124] D 0 (x) represents the uniformity threshold. The larger the actual uniformity D(x), the larger the uniformity deviation rate △D(x). When the deviation is within the threshold, that is, 0≤△D(x)≤1, the uniformity test passes.

[0125] In this embodiment, the hue deviation rate represents the deviation between the hue value at the weld and the hue value of the base material in the HSV color space. The smaller the hue deviation rate, the closer the hue of the weld is to that of the base material, and the better the welding quality. The larger the hue deviation value, the greater the difference between the hue of the weld and the base material, and the worse the welding quality. The calculation formula of the hue deviation rate is:

[0126]

[0127] l 0 Indicates the hue value threshold, the actual weld hue value The larger the value is, the larger the hue deviation rate △h is. When the deviation rate is within the threshold, When , the hue value detection passes;

[0128] The formula for generating the comprehensive judgment index based on the three deviation rates is:

[0129]

[0130] Among them, △D(x) and △k constitute the coefficients of the comprehensive judgment index, and the value range is [0,1]. If the three deviation rates are all within the threshold range, it can be judged as qualified. At this time, the uniformity threshold is 0≤△D(x)≤1, the neatness threshold is 0≤△k≤1, and the hue deviation rate is That is: the value range of δ is

[0131] See also Figure 2 The present invention further provides a welding quality intelligent detection system, which is used to implement the above welding quality detection method, including:

[0132] Image acquisition module: obtain the image of the welding point, scale the image of the welding point, adjust the size of the image to 224*224, and then copy the image into two identical groups of images. One group is grayed to obtain the first recognition image, and the other group is converted from the RGB color space to the HSV color space to obtain the second recognition image, and the pixel positions of the first recognition image and the second recognition image are mapped one by one;

[0133] Image separation module: filter the first recognition image using a bilateral filter, count the frequency of pixels at each level in 256 gray levels to form a grayscale histogram, calculate the inter-class variance of each threshold in the histogram, select the optimal separation threshold by the maximum inter-class variance, use the optimal separation threshold to separate the first recognition image after filtering, identify the foreground part and the background part, extract the foreground part to form a third recognition image, and extract the background part as the fourth recognition image;

[0134] Curve fitting module: Use the Sobel operator to process the third recognition image to obtain the edge pixel points of the third recognition image, perform curve fitting on each edge pixel point to obtain the approximate curve of the weld, take the curve inflection point on the fitted curve, use the curvature formula to obtain the inflection point curvature of the fitted curve, generate the weld neatness from the inflection point curvature, and preset the neatness threshold;

[0135] Pixel recognition module: evenly divide the third recognition image according to the vertical coordinate to obtain several equal-height areas, count the number of retained pixels in each area, calculate the variance of the number of pixels in each area, record it as the weld uniformity, and preset the uniformity threshold;

[0136] Tone recognition module: maps the position of each pixel in the third recognition image to the second recognition image, and collects the tone value corresponding to each retained pixel in the third recognition image to obtain the average tone value of the weld; collects the tone value corresponding to each pixel in the fourth recognition image to obtain the average tone value of the base material;

[0137] Comprehensive processing module: Generate the uniformity deviation rate according to the uniformity threshold of the weld, generate the uniformity deviation rate according to the weld uniformity and uniformity threshold, generate the hue deviation rate according to the average hue value of the weld and the average hue value of the parent material, and generate a comprehensive judgment index based on the deviation rate to judge the welding quality.

[0138] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.

[0139] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented by software, the above embodiments may be implemented in whole or in part in the form of a computer program product. Those skilled in the art may appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein may be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed by hardware or software methods depends on the specific application and design constraints of the technical solution.

[0140] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0141] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.

Claims

1. A welding quality intelligent detection method, characterized in that: The specific steps include: Step 1: Obtain an image of the weld, scale the image, adjust the image size to 224*224, and then copy the image into two identical sets of images. One set is grayscaled to obtain a first recognition image, and the other set is converted from RGB color space to HSV color space to obtain a second recognition image. The pixel positions of the first recognition image and the second recognition image are mapped one by one. Step 2: Filter the first recognition image using a bilateral filter, count the frequency of pixels at each level in the 256 gray levels to form a grayscale histogram, calculate the inter-class variance of each threshold in the histogram, select the optimal separation threshold by the maximum inter-class variance, use the optimal separation threshold to separate the first recognition image after filtering, identify the foreground part and the background part, extract the foreground part to form a third recognition image, and extract the background part as a fourth recognition image; Step 3: Process the third recognition image with the Sobel operator to obtain edge pixel points of the third recognition image, perform curve fitting on each edge pixel point to obtain an approximate curve of the weld, take the inflection point of the curve on the fitted curve, use the curvature formula to obtain the inflection point curvature of the fitted curve, generate the weld neatness from the inflection point curvature, and preset a neatness threshold; Step 4: Evenly divide the third recognition image according to the vertical coordinate to obtain a number of equal-height areas, count the number of retained pixels in each area, calculate the variance of the number of pixels in each area, record it as the weld uniformity, and preset a uniformity threshold; Step 5: Map the position of each pixel in the third recognition image to the second recognition image, and collect the hue value corresponding to each pixel in the third recognition image to obtain the average hue value of the weld; collect the hue value corresponding to each pixel in the fourth recognition image to obtain the average hue value of the base material, and preset the hue deviation threshold; Step 6: Generate the uniformity deviation rate according to the uniformity threshold of the weld, generate the uniformity deviation rate according to the uniformity threshold of the weld, generate the hue deviation rate according to the average hue value of the weld and the average hue value of the base material, and generate a comprehensive judgment index based on the deviation rate to judge the welding quality; The formula for calculating the inflection point curvature is: Where: k i represents the curvature of the i-th inflection point, u i ″(t) means to find the second-order derivative of the i-th inflection point with abscissa t, u i ′(t) means to find the first-order derivative of the i-th inflection point with abscissa t; The formula for generating weld smoothness from the inflection point curvature is: in: Indicates the uniformity of the weld, n indicates the number of inflection points, k i represents the curvature of the i-th inflection point; The formula for calculating the variance of the number of pixels in each area, that is, the uniformity of the weld, is: in: Represents the average number of pixels in each area, x i represents the number of pixels in the ith region, m represents the number of regions, and D(x) represents the variance of the number of pixels in each region; The formula for calculating the average hue value of a weld is: in: represents the average hue value of the weld, s represents the number of weld pixels, and h i Indicates the hue value of the i-th pixel of the weld; The formula for calculating the average hue value of the parent material is: in: represents the average hue value of the base material, p represents the number of pixels in the base material, l i Indicates the hue value of the i-th pixel of the base material; The principle for generating the comprehensive judgment index is: The formula for generating the neatness deviation rate is: Among them: △k represents the neatness deviation rate, k0 represents the neatness threshold, and the actual neatness The larger the value is, the larger the uniformity deviation rate △k is. When the deviation is within the threshold, that is, 0≤△k≤1, the uniformity deviation is within the threshold. The formula for generating the uniformity deviation rate is: Where: △D(x) represents the uniformity deviation rate, D(x) represents the weld uniformity, D0(x) represents the uniformity threshold, when △D(x)≤1, the uniformity deviation rate is within the threshold; The formula for generating the hue deviation rate is: Among them: △h represents the hue deviation rate, l0 represents the hue value threshold, and the actual weld hue value The larger the value is, the larger the hue deviation rate △h is. When the deviation rate is within the threshold, When , the hue value deviation rate is within the threshold; The formula for generating the comprehensive judgment index is: Wherein: δ represents the comprehensive judgment index, △D(x) represents the uniformity deviation rate, △k represents the neatness deviation rate, and △h represents the hue deviation rate.

2. A welding quality intelligent detection method as claimed in claim 1, characterized in that: The logic for calculating the optimal separation threshold in step 2 is: traverse all possible thresholds, separate the first recognition image into a background part and a foreground part according to the value of each threshold, count the number of pixels in the background part and the foreground part, calculate the mean of the grayscale values ​​of the pixels in the background part and the foreground part, and calculate the inter-class variance by a formula; The formula for calculating the between-class variance is: g(i) 2 =ω i0 oh i1 (m i0 -m i1 ) 2 Where: g(i) represents the inter-class variance when the threshold is i, ω i0 Indicates the proportion of the foreground part to the total image when the threshold is i, μ i0 represents the gray value of the foreground part when the threshold is i, ω i1 Indicates the proportion of the background part to the total image when the threshold is i, μ i1 Indicates the gray value of the background part when the threshold is i; When g(i) reaches its maximum value, the corresponding threshold i is the optimal separation threshold.

3. A welding quality intelligent detection method as claimed in claim 1, characterized in that: The principle of processing the third recognition image with the Sobel operator to obtain the edge pixels of the third recognition image in step 3 is as follows: multiplying the grayscale value of each pixel and the grayscale values ​​of its eight adjacent pixels with the Sobel operator horizontal template, and adding all the products to obtain the horizontal gradient value of the pixel; multiplying the grayscale value of the pixel and the grayscale values ​​of its eight adjacent pixels with the Sobel operator vertical template, and adding all the results to obtain the vertical gradient value; the horizontal gradient value calculation formula is: The vertical gradient value calculation formula is: Where: Gx(i, j) represents the horizontal gradient value of the pixel with coordinates (i, j), Gy(i, j) represents the vertical gradient value of the pixel with coordinates (i, j), and X(i, j) represents the grayscale value of the pixel with coordinates (i, j); The formula for generating the gradient magnitude is: Where: G(i, j) represents the gradient amplitude of the pixel with coordinates (i, j); An edge threshold is set. When the gradient amplitude of a pixel with coordinates (i, j) is greater than the edge threshold, the pixel is regarded as an edge pixel.

4. An intelligent welding quality detection system, characterized in that: The system is used to implement the welding quality intelligent detection method according to any one of claims 1 to 3, comprising: Image acquisition module: obtain the image of the welding point, scale the image of the welding point, adjust the size of the image to 224*224, and then copy the image into two identical groups of images. One group is grayed to obtain the first recognition image, and the other group is converted from the RGB color space to the HSV color space to obtain the second recognition image, and the pixel positions of the first recognition image and the second recognition image are mapped one by one; Image separation module: filter the first recognition image using a bilateral filter, count the frequency of pixels at each level in 256 gray levels to form a grayscale histogram, calculate the inter-class variance of each threshold in the histogram, select the optimal separation threshold by the maximum inter-class variance, use the optimal separation threshold to separate the first recognition image after filtering, identify the foreground part and the background part, extract the foreground part to form a third recognition image, and extract the background part as the fourth recognition image; Curve fitting module: Use the Sobel operator to process the third recognition image to obtain the edge pixel points of the third recognition image, perform curve fitting on each edge pixel point to obtain the approximate curve of the weld, take the curve inflection point on the fitted curve, use the curvature formula to obtain the inflection point curvature of the fitted curve, generate the weld neatness from the inflection point curvature, and preset the neatness threshold; Pixel recognition module: evenly divide the third recognition image according to the vertical coordinate to obtain several equal-height areas, count the number of retained pixels in each area, calculate the variance of the number of pixels in each area, record it as the weld uniformity, and preset the uniformity threshold; Tone recognition module: maps the position of each pixel in the third recognition image to the second recognition image, and collects the tone value corresponding to each retained pixel in the third recognition image to obtain the average tone value of the weld; collects the tone value corresponding to each pixel in the fourth recognition image to obtain the average tone value of the base material; Comprehensive processing module: Generate the uniformity deviation rate according to the uniformity threshold of the weld, generate the uniformity deviation rate according to the weld uniformity and uniformity threshold, generate the hue deviation rate according to the average hue value of the weld and the average hue value of the parent material, and generate a comprehensive judgment index based on the deviation rate to judge the welding quality.