Method for detecting welding quality of welding seam of steel wheel based on artificial intelligence
By using adaptive weighted filtering and neural network models, the problems of noise interference and positioning deviation in the inspection of steel wheel welds are solved, achieving high-precision and stable weld quality inspection, which is suitable for large-scale automated production.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANXIAN HUACHAO METAL TECH CO LTD
- Filing Date
- 2025-12-29
- Publication Date
- 2026-04-17
AI Technical Summary
Existing image processing technologies are susceptible to noise interference in the inspection of steel wheel welds, resulting in large weld positioning deviations and incomplete grayscale data processing. This leads to insufficient accuracy and stability of the inspection results, making it difficult to meet the high-efficiency and precision requirements of large-scale automated production.
An adaptive weighted fusion filtering method is used to remove noise. The weld seam region is extracted by combining Canny edge detection with Hough linear transformation and region growing method. Gray-level sequence is constructed by straightening and smoothing gray-level matrix, and weld quality is quantified by using a neural network model.
It enables precise positioning and feature extraction of weld seams in complex environments, improving the accuracy and stability of inspection, adapting to diverse welding conditions, and meeting the quality control needs of large-scale automated production.
Smart Images

Figure CN121883398A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing technology, and in particular relates to an artificial intelligence-based method for detecting the welding quality of steel wheel welds. Background Technology
[0002] The welding quality of steel wheel welds directly determines the stability of the wheel structure and driving safety. As the automotive manufacturing industry moves towards automation and high precision, machine vision-based weld inspection technology is widely used. The accuracy of image processing is a core factor determining the inspection effect. Existing image processing methods suffer from common shortcomings: welding images are easily affected by noise from the production environment, and current processing methods lack specific adaptability, making it difficult to effectively suppress noise while preserving key weld details; the grayscale difference between the weld and the base material is easily affected by welding process fluctuations, leading to deviations in boundary positioning and region extraction, making it difficult to accurately locate the core weld area; the processing of grayscale data lacks a systematic design, failing to fully extract key information reflecting the weld fusion state, resulting in insufficient feature representation; the overall image processing workflow lacks adaptation and optimization to weld structural characteristics, making the inspection results susceptible to external factors, with insufficient accuracy and stability, failing to meet the high-efficiency and accurate requirements of large-scale automated production for weld quality inspection. Summary of the Invention
[0003] In view of the technical problems existing in the background art, the present invention proposes an artificial intelligence-based method for detecting the welding quality of steel wheel welds.
[0004] To achieve the above objectives, the technical solution adopted by the present invention includes the following steps:
[0005] S1. Obtain an image of the welded joint of the steel wheel;
[0006] S2. Filter and denoise the image of the weld joint, then locate the weld boundary by combining the Canny edge detection algorithm with the Hough linear transform, and extract the complete weld region using the region growing method to generate the weld ROI image.
[0007] S3. Obtain the grayscale value of each pixel in the complete ROI image, construct a grayscale matrix, and straighten the grayscale matrix along the weld centerline based on the main direction of the weld determined by the Hough linear transform to form a grayscale sequence. The length of the grayscale sequence is equal to the total number of pixels of the weld ROI along its main direction. Use moving average filtering to smooth the grayscale sequence to obtain a smoothed grayscale sequence.
[0008] S4. Calculate the adjacent gray level difference sequence of the smoothed gray level sequence, calculate its mean and standard deviation, use a sliding window to traverse and calculate the cumulative deviation coefficient, mark and merge the abnormal windows to obtain the abnormal weld segments; extract the gray level subsequence of each abnormal segment, and calculate including the gray level mean deviation and gray level distribution entropy.
[0009] S5. Normalize the grayscale mean deviation and grayscale distribution entropy features to obtain a standardized feature vector; input the standardized feature vector into a preset neural network model, and output the weld quality score through the neural network model.
[0010] Preferably, the specific implementation of filtering and denoising the image at the weld joint in step S2 is as follows:
[0011] S211. Divide the original image of the steel wheel welding point into multiple non-overlapping local windows, calculate the salt-and-pepper noise ratio for the pixel gray values in each window, and determine the pixels whose absolute value of the difference between the pixel gray value in the window and the mean gray value in the window is greater than a set gray value threshold as salt-and-pepper noise pixels, and count the proportion of them to the total number of pixels in the window as the salt-and-pepper noise ratio.
[0012] S212. Design a weighted fusion Gaussian median mixture filter kernel, and output grayscale values: ,in, The Gaussian filtered component, For median filtered components, The filter weight coefficients for the i-th window are obtained based on the proportion of salt-and-pepper noise.
[0013] ,
[0014] in, Let be the proportion of salt-and-pepper noise in the i-th window. Process each window to obtain the complete filtered and denoised weld image.
[0015] Preferably, the specific implementation of step S2, which uses the Canny edge detection algorithm combined with Hough linear transform to locate the weld boundary and uses the region growing method to extract the complete weld region to generate the weld ROI image, is as follows:
[0016] S221. Calculate the grayscale histogram of the denoised weld area image, and determine the grayscale peaks of the corresponding weld area in the histogram using the bimodal method. grayscale peaks in the parent material region Calculate the gray value of the trough between the two peaks. Adaptive high threshold calculated based on grayscale peak and trough values and low threshold ,in, This refers to the grayscale weighting coefficient. High and low threshold ratio coefficient;
[0017] S222. Substitute the adaptive threshold into the Canny edge detection algorithm to sequentially complete image gradient calculation, non-maximum suppression, and double threshold edge connection to obtain a preliminary weld edge image.
[0018] S223. Based on the structural characteristics of steel wheel welds, a pre-defined weld main direction angle range is established. ,in, Design the principal direction angle for the weld. To accommodate angle tolerance, a Hough line transform is performed on the initial weld edge image, retaining only lines whose angles fall within the preset weld main direction angle range. At the same time, the number of pixels and the length of each line are calculated. If the number of pixels of each line is greater than or equal to the minimum number of pixels for a single boundary line and its length is greater than or equal to the minimum length for a single boundary line, it is selected as a candidate weld boundary line.
[0019] S224. Calculate the centerline of the candidate boundary line as the weld centerline, and determine the initial boundary range of the weld using the outermost pixel coordinates of the candidate boundary line.
[0020] S225. Using the pixels on the weld centerline as the seed point set, calculate the average gray value and gray standard deviation of the seed points; set the region growth criteria, and for the pixels to be grown, if they meet the criteria... Furthermore, the gradient direction is consistent with the main direction of the weld. If the included angle is less than a set threshold, then the pixel is included in the growth region. The grayscale value of the pixel to be grown. The average grayscale value. This is the grayscale tolerance coefficient for growth. The standard deviation of grayscale;
[0021] S226. Using the initial boundary range as the growth boundary limit, perform the region growth operation to obtain the preliminary weld region;
[0022] S227. Perform morphological closing operation on the preliminary weld area to obtain the weld area, calculate the minimum bounding rectangle of the weld area, and determine the range of the weld ROI.
[0023] Preferably, step S3 obtains the grayscale value of each pixel in the complete ROI image, constructs a grayscale matrix, and straightens the grayscale matrix along the weld centerline based on the main weld orientation determined by the Hough linear transform, forming a grayscale sequence. The length of this grayscale sequence is equal to the total number of pixels in the weld ROI along its main orientation. The grayscale sequence is then smoothed using a moving average filter to obtain the smoothed grayscale sequence. The specific implementation of this smoothed grayscale sequence is as follows:
[0024] S31. Obtain the grayscale value of each pixel in the complete weld ROI image and construct a grayscale matrix G, where each element represents the grayscale value of the pixel at that location.
[0025] S32. Based on the determined main direction of the weld, extract all weld edge points in the weld ROI image, use the least squares iterative fitting algorithm to correct the weld centerline, calculate the distance deviation of each edge point from the initial main direction line, set a deviation threshold, remove abnormal edge points that exceed the threshold, and use the perpendicular bisector of the remaining effective edge points as a reference to iteratively optimize and obtain a dynamically smooth weld centerline.
[0026] S33. Calculate the weld width corresponding to each pixel position of the weld centerline, and perform adaptive symmetrical sampling based on the weld width at each position. At each pixel position of the centerline, symmetrically select a number of pixels equal to the current weld width on both sides as sampling pixels.
[0027] S34. Based on the distance from the pixel to the center line, assign grayscale weights, perform weighted fusion calculations on the multi-pixel grayscale values at each sampling location, and obtain the sequence grayscale value at that location. The fusion formula is: ,in, For the first The grayscale value of each sequence position. For the first The number of pixels at each sampling location Let be the weight of the t-th pixel, which is inversely proportional to the distance of the pixel from the center line. Given the original grayscale value of the t-th pixel, we obtain the grayscale sequence. , where L is the sequence length;
[0028] S35. A 3×1 window moving average filter is used to smooth the grayscale sequence, resulting in a smoothed sequence. .
[0029] Preferably, step S4 calculates the adjacent gray-level difference sequence of the smoothed gray-level sequence, calculates its mean and standard deviation, uses a sliding window to traverse and calculate the cumulative deviation coefficient, marks and merges abnormal windows to obtain abnormal weld segments; the specific implementation of extracting the gray-level subsequence of each abnormal segment and calculating the gray-level mean deviation and gray-level distribution entropy is as follows:
[0030] S41. Calculate the smooth sequence The sequence of grayscale differences between adjacent pixels: ,in, , The value range is from 1 to L-1;
[0031] S42. Calculate the integer difference sequence. mean and standard deviation A sliding window is used to traverse the difference sequence with a step size of 1 pixel, and the cumulative deviation coefficient for each window is calculated: ,in For the j-th sliding window, For the pixel index within the sliding window, The length of the sliding window is defined; windows with a cumulative deviation coefficient greater than a set deviation threshold are marked as abnormal windows; adjacent abnormal windows are merged to obtain continuous abnormal weld segments;
[0032] S43. Extract the grayscale subsequence corresponding to each abnormal weld segment, construct the grayscale histogram of the grayscale subsequence, and calculate the grayscale features of each abnormal segment, including grayscale distribution entropy: statistically analyze the probability of occurrence of each grayscale value in the grayscale histogram, calculate the entropy value based on the probability distribution, the higher the entropy value, the more chaotic the grayscale distribution in the abnormal segment, reflecting the fusion uniformity of the weld in this area; grayscale mean deviation: calculate the absolute difference between the grayscale mean of the grayscale subsequence of the abnormal segment and the reference grayscale mean, the larger the difference, the more significant the grayscale deviation of the abnormal segment from the normal state;
[0033] S44. Extract the maximum grayscale mean deviation and grayscale distribution entropy from all abnormal weld segments as core features.
[0034] Preferably, the structure of the neural network model in step S5 is as follows:
[0035] A neural network model consists of an input layer, at least two hidden layers, and an output layer;
[0036] The number of neurons in the input layer is matched with the dimension of the standardized feature vector, and is used to receive the gray-level mean deviation and gray-level distribution entropy features after normalization.
[0037] The hidden layers use the ReLU activation function, the number of neurons in each layer is set, and a Dropout layer is set after each hidden layer to prevent overfitting;
[0038] The output layer uses the Sigmoid activation function to output continuous values in the range of 0-1 as weld quality scores.
[0039] Compared with existing technologies, the advantages and positive effects of this invention are as follows: It addresses pain points such as welding image noise interference and weld seam positioning deviation by employing adaptive weighted fusion filtering to accurately suppress noise while preserving key details; it achieves accurate extraction of the weld seam ROI through a combination of Canny edge detection, Hough linear transform, and region growing; it comprehensively mines fusion state information through grayscale matrix straightening, smoothing, and abnormal segment feature analysis; and it effectively solves the problems of strong subjectivity and insufficient robustness in traditional detection by using a neural network model to quantify quality scoring. The overall process is adapted to the structural characteristics of the weld seam, significantly improving detection accuracy and stability, and meeting the high-efficiency quality control requirements of large-scale automated production. Attached Figure Description
[0040] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 This is a flowchart illustrating an artificial intelligence-based method for inspecting the welding quality of steel wheel welds. Detailed Implementation
[0042] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described below in conjunction with the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.
[0043] Numerous specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways than those described herein, and therefore the invention is not limited to the specific embodiments disclosed in the following specification.
[0044] In practice, existing methods for inspecting the quality of steel wheel welds primarily rely on manual visual inspection or simple rule-based algorithms. These methods suffer from low accuracy in identifying weld quality and are easily affected by human experience and ambient lighting, making it difficult to meet the demands of batch processing and high consistency in quality control. Therefore, this paper proposes an artificial intelligence-based method for inspecting the welding quality of steel wheel welds. The overall process of this method includes image acquisition, weld region extraction, grayscale sequence construction, abnormal segment feature analysis, and neural network quality scoring. The specific implementation process is as follows: Figure 1 As shown.
[0045] Firstly, to acquire clear and stable weld images in complex industrial environments and address the issues of reliance on experience, high subjectivity, and low efficiency associated with manual visual inspection, images of the welded areas of steel wheels were obtained. An industrial camera was used to acquire images of the welded areas of the steel wheels under fixed lighting conditions, providing a highly consistent and high-contrast raw data foundation for subsequent image processing and intelligent analysis.
[0046] To accurately preserve weld details even under strong noise interference and address the issue of weld edges being easily blurred by traditional filtering algorithms due to welding spatter, oil stains, and uneven lighting, a denoising filter is applied to the weld area image. Specifically, the original image is divided into multiple local windows, and the proportion of outlier pixels in each window is calculated. Based on this proportion, Gaussian filtering and median filtering with strong smoothing capabilities are dynamically fused to achieve local adaptive denoising, thereby obtaining a high-quality denoised weld area image. This is implemented by dividing the acquired original image of the steel wheel weld area into multiple non-overlapping local windows, calculating the salt-and-pepper noise ratio for the pixels within each window. The salt-and-pepper noise ratio is calculated by identifying pixels whose absolute difference between their grayscale value and the mean grayscale value within the window is greater than a set grayscale threshold as salt-and-pepper noise pixels, and statistically analyzing their proportion of the total pixels in the window as the salt-and-pepper noise ratio. A weighted Gaussian-median hybrid filter kernel is designed, and the filtered output grayscale value is: ,in, The Gaussian filtered component, For median filtered components, The filter weight coefficients for the i-th window are obtained based on the proportion of salt-and-pepper noise.
[0047] ,in, Let be the proportion of salt-and-pepper noise in the i-th window. Process each window to obtain the complete filtered and denoised weld image.
[0048] Then, the weld boundary is located using the Canny edge detection algorithm combined with Hough linear transform, and the complete weld region is extracted using the region growing method to generate a weld ROI image. Specifically, the gray-level histogram of the denoised weld image is calculated, and the gray-level peaks corresponding to the weld region in the histogram are determined using the bimodal method. grayscale peaks in the parent material region Calculate the gray value of the trough between the two peaks. Adaptive high threshold calculated based on grayscale peak and trough values and low threshold ,in, This refers to the grayscale weighting coefficient. The high and low threshold ratio coefficients are used. Then, the Sobel operator is used to calculate the first-order gradient of the image in both the horizontal and vertical directions, obtaining the gradient magnitude and gradient direction of each pixel. The gradient magnitude characterizes the edge strength, and the gradient direction indicates the edge direction. Next, non-maximum suppression is performed on the gradient magnitude image. Specifically, the gradient value of the current pixel is compared in both directions along the gradient direction. Only pixels with a gradient magnitude greater than their two neighboring pixels are retained, while the rest are set to zero, thus refining the originally wide edge response into single-pixel-wide candidate edges. Then, adaptive high and low thresholds calculated based on the bimodal grayscale histogram are introduced into the dual-threshold detection process: pixels with gradient magnitudes greater than the high threshold are directly marked as strong edges, pixels between the high and low thresholds are marked as weak edges, and pixels less than the low threshold are suppressed as non-edges. Finally, edge connection and tracking are performed on strong edge pixels. Starting from a strong edge, weak edge pixels connected to it are searched within its 8-neighborhood and promoted to valid edges until no more connected pixels are found. Based on the structural characteristics of the steel wheel weld, the main direction angle range of the weld is preset. ,in, Design the principal direction angle for the weld. To accommodate angle tolerance, a Hough line transform is performed on the initial weld edge image, retaining only lines whose angles fall within the preset weld main direction angle range. Simultaneously, the number of pixels and length of each line are calculated. If the number of pixels on each line is greater than or equal to the minimum number of pixels for a single boundary line, and its length is greater than or equal to the minimum length for a single boundary line, it is selected as a candidate weld boundary line. The centerline of the candidate boundary line is calculated as the weld centerline, and the initial boundary range of the weld is determined using the coordinates of the outermost pixel of the candidate boundary line. The pixels on the weld centerline are used as the seed point set, and the average gray value and gray standard deviation of the seed points are calculated. A region growth criterion is set; for pixels to be grown, if they meet the following criteria... Furthermore, the gradient direction is consistent with the main direction of the weld. If the included angle is less than a set threshold, then the pixel is included in the growth region. The grayscale value of the pixel to be grown. The average grayscale value. This is the grayscale tolerance coefficient for growth. The grayscale standard deviation is used as the growth boundary limit. A region growth operation is performed to obtain the preliminary weld area. A morphological closing operation is performed on the preliminary weld area to obtain the weld area. The minimum bounding rectangle of the weld area is calculated to determine the range of the weld ROI. Finally, a continuous and complete weld ROI image is formed, providing a precise object region for subsequent analysis.
[0049] To transform weld area information into easily analyzable structural features and address the issues of high complexity and poor robustness in directly analyzing weld quality features from images, a scheme based on centerline straightening and adaptive symmetric sampling along the main weld direction is adopted. This maps the weld ROI image into a grayscale sequence along the weld direction. Specifically, the grayscale value of each pixel in the complete ROI image is obtained, a grayscale matrix is constructed, and the grayscale matrix is straightened along the weld centerline based on the main weld direction determined by the Hough linear transform, forming a grayscale sequence. The length of this grayscale sequence is equal to the total number of pixels along the main weld direction of the ROI. A moving average filter is then used to smooth the grayscale sequence, resulting in a smoothed grayscale sequence.
[0050] Specifically, the grayscale value of each pixel in the complete weld ROI image will be obtained, and a grayscale matrix G will be constructed, where each element represents the grayscale value of the pixel at that location.
[0051] Based on the determined main weld orientation, all weld edge points are extracted from the weld ROI image. A least-squares iterative fitting algorithm is used to correct the weld centerline, calculating the distance deviation from each edge point to the initial main orientation line. A deviation threshold is set, and abnormal edge points exceeding the threshold are removed. Using the perpendicular bisector of the remaining valid edge points as a reference, a dynamically smooth weld centerline is obtained through iterative optimization. Specifically, based on the weld main orientation parameters obtained from the Hough transform, the extracted weld edge images in the weld ROI image are filtered, retaining only edge pixels whose angle with the main orientation is less than a set tolerance threshold, as a candidate weld edge point set, thereby eliminating noisy edges and interference from non-weld structures. Subsequently, using the main orientation line obtained from the Hough transform as the initial centerline model, a line parameter expression is established. The aforementioned candidate edge points are used as samples input into the least-squares fitting process. By minimizing the sum of squared perpendicular distances from all edge points to the line, the updated line parameters are obtained, achieving a first correction of the weld centerline. Furthermore, an iterative least squares approach is adopted. After each round of fitting, the vertical distance deviation from each edge point to the current centerline is recalculated, and a distance threshold is set. Outliers with excessive deviations are considered as outliers and are removed, while only valid edge points that meet the threshold constraint are retained for the next round of fitting. By continuously iterating and updating the line parameters and sample set, until the change in line parameters obtained from two adjacent fittings is less than the preset convergence threshold or the maximum number of iterations is reached, a stable and reliable weld centerline that is highly consistent with the true geometry of the weld is obtained. Then, after obtaining the valid edge points, the valid edge points are projected and sorted according to the main direction of the weld. At the same projection position, the edge points located on both sides of the weld are paired and matched. The midpoint of the line connecting each pair of left and right edge points is calculated, and this midpoint is used as the candidate center point at that position. When only a single edge point is detected at a certain position, interpolation compensation is performed by combining the center points of adjacent positions to ensure the continuity of the center point distribution. Subsequently, all candidate center points are combined into a center point set, and the center point set is fitted as a whole using least squares spline curve or polynomial fitting methods to obtain the initial perpendicular centerline model. Furthermore, an iterative optimization mechanism is introduced: in each iteration, the vertical distance from the edge points to the center line is recalculated based on the current center line, and the candidate center points are weighted according to the distance deviation, with smaller distances resulting in larger weights, to enhance the constraint effect of reliable points on the fitting results; then, the center line is refitted based on weighted least squares. Through multiple iterations, the center line gradually approaches the true geometric center axis of the weld while suppressing local noise disturbances, achieving dynamic updates and overall smoothness. Finally, the iteration stops when the center line change amplitude is less than a set threshold, resulting in a continuous, smooth weld center line that closely follows the weld center axis.
[0052] The weld width corresponding to each pixel position along the weld centerline is statistically analyzed. Adaptive symmetrical sampling is then performed based on the weld width at each position. For each pixel position along the centerline, a number of pixels equal to the current weld width are symmetrically selected on both sides as sampling pixels. Specifically, firstly, using the obtained smooth weld centerline as a reference, the normal direction (perpendicular to the tangent direction of the centerline at that position) is calculated for each pixel position along the centerline. Then, a pixel-by-pixel search is performed from the center point outwards along this normal direction until the boundary of the weld ROI or weld edge point is encountered. The corresponding boundary pixel positions on the left and right sides are recorded. The pixel distance between the left and right boundary points at this position is taken as the local weld width corresponding to that centerline pixel position. Through this method, a weld width distribution sequence that varies point-by-point along the centerline direction can be obtained, thus realistically reflecting the geometric differences of the weld at different positions. Furthermore, during grayscale sampling, each centerline pixel is used as a sampling reference point. Based on the weld width calculated at that location, several pixels are symmetrically selected on both sides along the normal direction as sampling points. The maximum distance between the selected points does not exceed half the current weld width, ensuring that the sampling range is always confined within the weld area. If the weld width is large, the number of sampling pixels is adaptively increased; if the weld width is small, the number of sampling pixels is reduced accordingly, thus achieving adaptive symmetrical sampling that dynamically changes with the weld shape. This method ensures that the sampling covers the entire weld cross-section while avoiding the introduction of base material region pixels into feature calculations, making the subsequent grayscale fusion results more representative and stable.
[0053] Gray-level weights are assigned based on the distance from each pixel to the center line. A weighted fusion calculation is performed on the multi-pixel gray-level values at each sampling location to obtain the sequence gray-level value at that location. The fusion formula is as follows: ,in, For the first The grayscale value of each sequence position. For the first The number of pixels at each sampling location Let be the weight of the t-th pixel, which is inversely proportional to the distance of the pixel from the center line. Given the original grayscale value of the t-th pixel, we obtain the grayscale sequence. Where L is the sequence length; a 3×1 window moving average filter is used to smooth the grayscale sequence to obtain a smoothed sequence. .
[0054] To map complex and varied weld anomaly features into intuitive and unified quality evaluation results, and to address the difficulty of adapting traditional threshold-based judgment methods to diverse welding conditions, a multi-layer neural network quality evaluation feature is adopted, using gray-level mean deviation and gray-level distribution entropy as inputs. The process involves calculating the adjacent gray-level difference sequences of the smoothed gray-level sequence, statistically analyzing their mean and standard deviation, using a sliding window to traverse and calculate the cumulative deviation coefficient, marking and merging anomaly windows to obtain weld anomaly segments, extracting the gray-level subsequences of each anomaly segment, and calculating the gray-level mean deviation and gray-level distribution entropy. This is implemented as S41, calculating the smoothed sequence... The sequence of grayscale differences between adjacent pixels: ,in, , The value range is from 1 to L-1; calculate the integer difference sequence. mean and standard deviation A sliding window is used to traverse the difference sequence with a step size of 1 pixel, and the cumulative deviation coefficient for each window is calculated: ,in For the j-th sliding window, For the pixel index within the sliding window, The length of the sliding window is defined; windows with a cumulative deviation coefficient greater than a set deviation threshold are marked as abnormal windows; adjacent abnormal windows are merged to obtain continuous weld abnormal segments; the gray-level subsequence corresponding to each weld abnormal segment is extracted, and a gray-level histogram of the gray-level subsequence is constructed. The gray-level features of each abnormal segment are calculated, including gray-level distribution entropy: the probability of occurrence of each gray-level value in the gray-level histogram is statistically analyzed, and the entropy value is calculated based on this probability distribution. The higher the entropy value, the more chaotic the gray-level distribution within the abnormal segment, reflecting the fusion uniformity of the weld in that region; gray-level mean deviation: the absolute difference between the gray-level mean of the gray-level subsequence of the abnormal segment and the baseline gray-level mean is calculated. The larger the difference, the more significant the gray-level deviation of the abnormal segment from the normal state; the largest gray-level mean deviation and gray-level distribution entropy among all weld abnormal segments are extracted as core features.
[0055] Finally, the grayscale mean deviation and grayscale distribution entropy features are normalized to obtain a standardized feature vector. The standardized feature vector is then input into a pre-defined neural network model, which outputs a quality score for the weld. The neural network model includes an input layer, at least two hidden layers, and an output layer.
[0056] The number of neurons in the input layer matches the dimension of the normalized feature vector, and is used to receive the normalized gray-level mean deviation and gray-level distribution entropy features. When constructing the neural network, the number of neurons in the input layer is set to correspond one-to-one with the dimension of the feature vector, so that each input neuron receives only the value of one feature component as input. The input layer itself does not have an activation function; it only serves to receive and distribute data, passing the feature vector to the subsequent hidden layers as is.
[0057] The hidden layers employ the ReLU activation function, with a set number of neurons per layer, and a Dropout layer is added after each hidden layer to prevent overfitting. In the construction of the hidden layers, at least two hidden layers are set according to the training sample size and feature complexity. Each layer contains several neurons for layer-by-layer nonlinear mapping of the input features. Each hidden layer neuron first performs a weighted summation of the input from the previous layer and adds a bias term, then transforms it using the ReLU activation function. That is, when the input is positive, the output is directly the value; when the input is negative, the output is zero, thereby enhancing the model's ability to express nonlinear relationships and effectively mitigating the gradient vanishing problem. To prevent the model from overfitting to the training data under limited sample conditions, a Dropout layer is introduced after each hidden layer. During training, a predetermined proportion of neurons' outputs is randomly set to zero, causing the network to form different substructures in each iteration, thus forcing the model to learn more robust and generalizable feature representations. By combining ReLU and Dropout, the stability and generalization performance of the model can be significantly improved while ensuring the network's expressive power.
[0058] The output layer employs the Sigmoid activation function, outputting a continuous value within the range of 0-1 as the weld quality score. After completing multi-layer hidden feature mapping, the output of the last hidden layer is fed into the output layer as input. The output layer is configured as a single neuron, used to comprehensively represent the overall state of weld quality. This neuron also first performs a weighted summation of the input and adds a bias term, then performs a non-linear mapping through the Sigmoid activation function, compressing the input of any real number range to between 0 and 1, obtaining a continuous output value. This output value is defined as the weld quality score, used to reflect the degree of weld quality from poor to excellent, where the closer the value is to 1, the better the weld quality, and the closer it is to 0, the greater the possibility of weld defects. During the model training phase, the real quality labels obtained from manual annotation or detection standards are used as supervision signals, and the network parameters are continuously updated by minimizing the error between the predicted score and the real label. In practical applications, the output score is directly used as the quantitative evaluation result of weld quality, realizing an intuitive and continuous intelligent assessment of weld quality.
[0059] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments for application in other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.
Claims
1. A method for detecting the welding quality of steel wheel welds based on artificial intelligence, characterized in that, Includes the following steps: S1. Obtain an image of the welded joint of the steel wheel; S2. Filter and denoise the image of the weld joint, then locate the weld boundary by combining the Canny edge detection algorithm with the Hough linear transform, and extract the complete weld region using the region growing method to generate the weld ROI image. S3. Obtain the gray value of each pixel in the complete ROI image, construct a gray matrix, and straighten the gray matrix along the weld centerline based on the main direction of the weld determined by the Hough linear transform to form a gray sequence. The length of the gray sequence is equal to the total number of pixels of the weld ROI along its main direction. A moving average filter is used to smooth the grayscale sequence, resulting in a smoothed grayscale sequence. S4. Calculate the adjacent gray level difference sequence after smoothing the gray level sequence, calculate its mean and standard deviation, use a sliding window to traverse and calculate the cumulative deviation coefficient, mark and merge the abnormal windows to obtain the abnormal weld segment. Extract the grayscale subsequence of each abnormal segment and calculate the grayscale mean deviation and grayscale distribution entropy. S5. Normalize the grayscale mean deviation and grayscale distribution entropy features to obtain a standardized feature vector; input the standardized feature vector into a preset neural network model, and output the weld quality score through the neural network model.
2. The method for detecting the welding quality of steel wheel welds based on artificial intelligence according to claim 1, characterized in that, The specific implementation of filtering and denoising the image at the weld joint in step S2 is as follows: S211. Divide the original image of the steel wheel welding point into multiple non-overlapping local windows, calculate the salt-and-pepper noise ratio for the pixel gray values in each window, and determine the pixels whose absolute value of the difference between the pixel gray value in the window and the mean gray value in the window is greater than a set gray value threshold as salt-and-pepper noise pixels, and count the proportion of them to the total number of pixels in the window as the salt-and-pepper noise ratio. S212. Design a weighted fusion Gaussian median mixture filter kernel, and output grayscale values: ,in, The Gaussian filtered component, For median filtered components, The filter weight coefficients for the i-th window are obtained based on the proportion of salt-and-pepper noise. , in, Let be the proportion of salt-and-pepper noise in the i-th window. Process each window to obtain the complete filtered and denoised weld image.
3. The method for detecting the welding quality of steel wheel welds based on artificial intelligence according to claim 1, characterized in that, In step S2, the weld boundary is located by combining the Canny edge detection algorithm with the Hough linear transform, and the complete weld region is extracted using the region growing method to generate the weld ROI image. The specific implementation of this method is as follows: S221. Calculate the grayscale histogram of the denoised weld area image, and determine the grayscale peaks of the corresponding weld area in the histogram using the bimodal method. grayscale peaks in the parent material region Calculate the gray value of the trough between the two peaks. Adaptive high threshold calculated based on grayscale peak and trough values and low threshold ,in, This is the grayscale weighting coefficient. High and low threshold ratio coefficient; S222. Substitute the adaptive threshold into the Canny edge detection algorithm to sequentially complete image gradient calculation, non-maximum suppression, and double threshold edge connection to obtain a preliminary weld edge image. S223. Based on the structural characteristics of steel wheel welds, a pre-defined weld main direction angle range is established. ,in, Design the principal direction angle for the weld. To accommodate angle tolerance, a Hough line transform is performed on the initial weld edge image, retaining only lines whose angles fall within the preset weld main direction angle range. At the same time, the number of pixels and the length of each line are calculated. If the number of pixels of each line is greater than or equal to the minimum number of pixels for a single boundary line and its length is greater than or equal to the minimum length for a single boundary line, it is selected as a candidate weld boundary line. S224. Calculate the centerline of the candidate boundary line as the weld centerline, and determine the initial boundary range of the weld using the outermost pixel coordinates of the candidate boundary line. S225. Using the pixels on the weld centerline as the seed point set, calculate the average gray value and gray standard deviation of the seed points; set the region growth criteria, and for the pixels to be grown, if they meet the criteria... Furthermore, the gradient direction is consistent with the main direction of the weld. If the included angle is less than a set threshold, then the pixel is included in the growth region. The grayscale value of the pixel to be grown. The average grayscale value. This is the grayscale tolerance coefficient for growth. The standard deviation of grayscale; S226. Using the initial boundary range as the growth boundary limit, perform the region growth operation to obtain the preliminary weld region; S227. Perform morphological closing operation on the preliminary weld area to obtain the weld area, calculate the minimum bounding rectangle of the weld area, and determine the range of the weld ROI.
4. The method for detecting the welding quality of steel wheel welds based on artificial intelligence according to claim 1, characterized in that, Step S3 obtains the grayscale value of each pixel in the complete ROI image, constructs a grayscale matrix, and straightens the grayscale matrix along the weld centerline based on the main weld orientation determined by the Hough linear transform, forming a grayscale sequence. The length of this grayscale sequence is equal to the total number of pixels in the weld ROI along its main orientation. The grayscale sequence is then smoothed using a moving average filter to obtain the smoothed grayscale sequence. The specific implementation of this smoothed grayscale sequence is as follows: S31. Obtain the grayscale value of each pixel in the complete weld ROI image and construct a grayscale matrix G, where each element represents the grayscale value of the pixel at that location. S32. Based on the determined main direction of the weld, extract all weld edge points in the weld ROI image, use the least squares iterative fitting algorithm to correct the weld centerline, calculate the distance deviation of each edge point from the initial main direction line, set a deviation threshold, remove abnormal edge points that exceed the threshold, and use the perpendicular bisector of the remaining effective edge points as a reference to iteratively optimize and obtain a dynamically smooth weld centerline. S33. Calculate the weld width corresponding to each pixel position of the weld centerline, and perform adaptive symmetrical sampling based on the weld width at each position. At each pixel position of the centerline, symmetrically select a number of pixels equal to the current weld width on both sides as sampling pixels. S34. Based on the distance from the pixel to the center line, assign grayscale weights, perform weighted fusion calculations on the multi-pixel grayscale values at each sampling location, and obtain the sequence grayscale value at that location. The fusion formula is: ,in, For the first The grayscale value of each sequence position. For the first The number of pixels at each sampling location Let be the weight of the t-th pixel, which is inversely proportional to the distance of the pixel from the center line. Given the original grayscale value of the t-th pixel, we obtain the grayscale sequence. , where L is the sequence length; S35. A 3×1 window moving average filter is used to smooth the grayscale sequence, resulting in a smoothed sequence. .
5. The method for detecting the welding quality of steel wheel welds based on artificial intelligence according to claim 1, characterized in that, Step S4 calculates the adjacent gray-level difference sequence of the smoothed gray-level sequence, calculates its mean and standard deviation, uses a sliding window to traverse and calculate the cumulative deviation coefficient, marks and merges abnormal windows to obtain abnormal weld segments; extracts the gray-level subsequence of each abnormal segment, and calculates the gray-level mean deviation and gray-level distribution entropy. The specific implementation is as follows: S41. Calculate the smooth sequence The sequence of grayscale differences between adjacent pixels: ,in, , The value range is from 1 to L-1; S42. Calculate the integer difference sequence. mean and standard deviation A sliding window is used to traverse the difference sequence with a step size of 1 pixel, and the cumulative deviation coefficient for each window is calculated: ,in For the j-th sliding window, For the pixel index within the sliding window, The length of the sliding window is defined; windows with a cumulative deviation coefficient greater than a set deviation threshold are marked as abnormal windows; adjacent abnormal windows are merged to obtain continuous abnormal weld segments; S43. Extract the grayscale subsequence corresponding to each abnormal weld segment, construct the grayscale histogram of the grayscale subsequence, and calculate the grayscale features of each abnormal segment, including grayscale distribution entropy: statistically analyze the probability of occurrence of each grayscale value in the grayscale histogram, calculate the entropy value based on the probability distribution, the higher the entropy value, the more chaotic the grayscale distribution in the abnormal segment, reflecting the fusion uniformity of the weld in this area; grayscale mean deviation: calculate the absolute difference between the grayscale mean of the grayscale subsequence of the abnormal segment and the reference grayscale mean, the larger the difference, the more significant the grayscale deviation of the abnormal segment from the normal state; S44. Extract the maximum grayscale mean deviation and grayscale distribution entropy from all abnormal weld segments as core features.
6. The method for detecting the welding quality of steel wheel welds based on artificial intelligence according to claim 1, characterized in that, The structure of the neural network model in step S5 is as follows: A neural network model consists of an input layer, at least two hidden layers, and an output layer; The number of neurons in the input layer is matched with the dimension of the standardized feature vector, and is used to receive the gray-level mean deviation and gray-level distribution entropy features after normalization. The hidden layers use the ReLU activation function, the number of neurons in each layer is set, and a Dropout layer is set after each hidden layer to prevent overfitting; The output layer uses the Sigmoid activation function to output continuous values in the range of 0-1 as weld quality scores.