Engineering construction defect automatic detection and classification method based on deep learning

By preprocessing and extracting features from weld surface images using deep learning and convolutional neural networks, weld defects are identified and evaluated. This solves the problems of low efficiency and high misjudgment rate of traditional methods in complex environments, and realizes automated and intelligent detection of welding quality.

CN121095141APending Publication Date: 2025-12-09STATE GRID SHANDONG ELECTRIC POWER CO
View PDF 0 Cites 12 Cited by

Patent Information

Application Number
CN202511073623.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-01
Publication Date
2025-12-09

AI Technical Summary

Technical Problem

Existing welding quality assessment methods based on traditional image processing or manual inspection are inefficient and have a high misjudgment rate in complex construction environments. They are also difficult to adapt to changes in texture features on the weld surface caused by oxidation and discoloration, resulting in inaccurate welding quality assessment.

Method used

Deep learning methods are used to denoise and normalize the illumination of weld surface images, extract texture features and vectorize them, combine convolutional neural networks to identify texture changes, use region growing algorithms to segment abnormal regions, and combine a pre-trained defect classification model and a Bayesian network to evaluate welding quality.

Benefits of technology

It enables automatic detection and classification of weld defects under small sample conditions, improves the accuracy and stability of welding quality assessment, and provides an intelligent welding quality control solution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121095141A_ABST
    Figure CN121095141A_ABST
Patent Text Reader

Abstract

The invention provides an engineering construction defect automatic detection and classification method based on deep learning, and the method comprises the steps: obtaining a welding seam surface image through the shooting of an unmanned plane, and carrying out the denoising and illumination normalization processing of the welding seam surface image, and obtaining a standardized image; welding seam surface texture features are extracted from the standardized image, a convolutional neural network is adopted to analyze the spatial distribution characteristics of textures, and vectorization processing is carried out to obtain texture feature vectors; segmenting a weld surface corresponding to abnormal region distribution by adopting a region growing algorithm, and analyzing pore and weld discontinuity in combination with the texture feature vector to obtain a defect candidate region; performing threshold division on the sizes and the numbers of the defects according to the defect types and the feature vectors of the candidate regions to obtain a severity grading result of each type of defects; and severity features are extracted from a grading result, and a Bayesian network is adopted to fuse texture feature vectors and defect type labels to obtain a welding quality evaluation score.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information technology, and in particular to an automatic detection and classification method for engineering construction defects based on deep learning. Background Technology

[0002] Construction quality inspection is a crucial link in ensuring the safety and durability of infrastructure, especially in critical areas such as grounding connections of distribution boxes, where welding quality directly affects the stable operation of the power system and public safety. High-quality welding can effectively prevent electrical faults, while defects can lead to serious accidents. Therefore, developing efficient and accurate welding quality assessment technologies is of paramount importance. However, existing methods based on traditional image processing or manual inspection often suffer from low efficiency and high false positive rates when dealing with complex construction environments. In particular, in images captured by drones, phenomena such as oxidation discoloration and abnormal gloss on the weld surface can significantly interfere with the inspection results. These limitations make it difficult for automated inspection technologies to meet the requirements of high precision and strong adaptability in practical engineering applications. Specifically, current methods generally lack adaptability to dynamically changing environments when processing weld surface texture features. For example, oxidation discoloration can alter the gloss and porosity distribution characteristics of the weld, while increased weld discontinuity also increases the difficulty of defect identification. These factors make it difficult for models to accurately distinguish defect types and severity, especially when sample data is limited. Setting the discrimination threshold and adjusting the defect classification standards become technical bottlenecks. Existing methods often employ fixed thresholds or rely on large amounts of labeled data, making it difficult to cope with the complexity and diversity of field environments. This directly limits the robustness and scalability of detection. Therefore, how to dynamically adjust the discrimination threshold and defect severity grading criteria under small sample conditions to adapt to changes in texture features on the weld surface caused by oxidation and discoloration, thereby improving the accuracy and stability of weld quality assessment, has become a critical issue that urgently needs to be addressed. Summary of the Invention

[0003] This invention provides a method for automatic detection and classification of engineering construction defects based on deep learning, mainly including:

[0004] (1) The weld surface image is denoised and the illumination is normalized to obtain a standardized image;

[0005] (2) Extract the surface texture features of the weld from the standardized image, analyze the spatial distribution characteristics of the texture using a convolutional neural network, and perform vectorization to obtain the texture feature vector;

[0006] (3) Identify the texture changes caused by oxidation based on the texture feature vector, record the coordinates of the discolored area, and use a clustering algorithm to classify the texture changes caused by oxidation to obtain the texture change type;

[0007] (4) Identify dark spot areas with low gloss and overexposed areas with high gloss in the standardized image according to the texture change type, and perform quantitative analysis on the shape, size and number of the identified areas to obtain the distribution of abnormal areas.

[0008] (5) The region growing algorithm is used to segment the weld surface corresponding to the abnormal region distribution. Combined with the texture feature vector, the porosity and weld discontinuity are analyzed to obtain the defect candidate region.

[0009] (6) Vectorize the porosity and weld discontinuity to obtain the feature vector of the defect candidate region, input it into the pre-trained defect classification convolutional neural network model, output the defect type probability vector, and identify the defect type based on the probability vector.

[0010] (7) Based on the defect type and the feature vector of the candidate region, the size and number of defects are divided into thresholds to obtain the severity classification results of various defects;

[0011] (8) Based on the defect classification results, the severity features are extracted, and combined with the texture feature vector and defect type label, a Bayesian network is used to perform feature fusion to generate a comprehensive evaluation score for welding quality.

[0012] Preferably, step (1) includes:

[0013] A fixed-focal-length industrial camera is used to acquire the original image of the weld surface. The original image is then decomposed into a three-layer wavelet decomposition to obtain the first weld image. A gray-level histogram is calculated for the first weld image. The second weld image is obtained by performing a piecewise linear transformation based on the peak and valley distribution characteristics of the gray-level histogram.

[0014] An illumination intensity distribution map is established based on the second weld image. The illumination intensity distribution map is processed by Gaussian filtering. The dark areas are supplemented with light using a brightness compensation coefficient to obtain the third weld image.

[0015] For the third weld image, the weld edge contour line is extracted, the tilt angle of the contour line is calculated, and the image is geometrically corrected based on the tilt angle and the coordinates of the image center point to obtain the fourth weld image.

[0016] The local variance value of the fourth weld image is calculated using a sliding window. The contrast enhancement coefficient is adaptively adjusted based on the local variance value to eliminate surface noise and obtain a standardized image.

[0017] Preferably, step (2) includes:

[0018] A sliding window is set according to the standardized image, and texture features are extracted within the sliding window using the gray-level co-occurrence matrix to obtain a first feature map;

[0019] The first feature map is decomposed into pyramids, the feature map is downsampled using a max pooling kernel, the correlation coefficients of adjacent scale feature maps are calculated, and the second feature map is obtained.

[0020] A three-layer convolutional neural network is constructed based on the second feature map, and the output of the convolutional neural network is processed by batch normalization to obtain the third feature map.

[0021] The third feature map is subjected to eigenvalue decomposition, and the texture feature vector is obtained by projection transformation and normalization of orthogonal basis vector group.

[0022] A sliding window of 8×8 pixels is set based on a standardized image, with a horizontal and vertical stride of 4 pixels. Local regions of the image are scanned, and texture features within the window are extracted using a gray-level co-occurrence matrix (GLCM) at 0°, 45°, 90°, and 135° to calculate the first feature map. A three-layer pyramid decomposition is performed on the first feature map, and a 2×2 max-pooling kernel is used to downsample the feature map. The cross-correlation coefficient between adjacent scale feature maps is calculated to generate a 32×32-dimensional second feature map. A three-layer convolutional neural network is constructed based on the second feature map: the first layer has 16 3×3 convolutional kernels, the second layer has 32 3×3 convolutional kernels, and the third layer has 64 3×3 convolutional kernels. Batch normalization is performed after each convolutional layer to obtain a 64×8×8-dimensional third feature map. The third feature map is reshaped to obtain a 4096-dimensional feature matrix. The covariance matrix of the feature matrix is ​​calculated, and the eigenvalues ​​and eigenvectors of the covariance matrix are extracted. The top 128 eigenvectors with a cumulative contribution rate of 95% are selected. An orthogonal basis vector set is constructed using the selected feature vectors. The 4096-dimensional feature matrix is ​​then projected and transformed to generate a 128-dimensional texture feature vector. After normalization, the texture feature vector is obtained.

[0023] Preferably, step (3) includes:

[0024] A three-channel color histogram (red, green, and blue) is generated by obtaining the texture feature vector. The feature vector is then segmented using the region growing method based on the color histogram. The dominant color component is extracted from the segmentation result to obtain the first color-changing region map.

[0025] Based on the first color-changing region map, the Sobel operator is used to extract the boundary contour of the color-changing region. The perimeter and area values ​​are calculated through the boundary contour. The four-neighbor search method is used to mark the connected components of the color-changing region to obtain the second color-changing region map.

[0026] For the second color-changing region map, calculate the centroid coordinates of the connected components, calculate the local density value based on the centroid coordinates, and determine the cluster center from the local density value to obtain the third color-changing region map;

[0027] Calculate the Euclidean distance matrix of the connected domains based on the third color-changing region map, construct a minimum spanning tree using the distance matrix, generate a spatial constraint matrix from the minimum spanning tree, and adjust the cluster centers according to the spatial constraint matrix to determine the texture change type.

[0028] A three-channel (red, green, and blue) color histogram is generated based on the texture feature vector. The color quantization level is set to 256. A region growing method is used to segment the feature vector, with the region growing threshold set to the standard deviation of the color difference between adjacent pixels. The dominant color component corresponding to the peak position in the histogram is extracted. The pixel coordinates of each color region are recorded using an eight-neighbor labeling method to obtain the first color-changing region map. Based on the first color-changing region map, the Sobel operator is used to extract the boundary contour of the color-changing region. The perimeter value is calculated by counting the number of pixels on the contour line, and the area value is calculated by counting the number of pixels enclosed by the contour line. The roundness value is calculated based on the ratio of perimeter to area. A four-neighbor search method is used to label the connected components of the region to obtain the second color-changing region map. The centroid coordinates are calculated for each connected component in the second color-changing region map. The local density value is calculated with the centroid coordinates as the center. The local density calculation radius is twice the radius of the circumcircle of the connected component. The coordinates of points with a density value greater than that of their neighbors are selected as cluster centers to obtain the third color-changing region map. Calculate the Euclidean distance matrix between connected components based on the third color-changing region map. Construct a minimum spanning tree based on the distance matrix and record the degree distribution of each node in the tree. Use the node degree distribution to classify the spatial association strength of connected components. Establish spatial constraints for regions whose distance is less than the average diameter of the connected components, generating a spatial constraint matrix. Adjust the cluster centers based on the spatial constraint matrix, calculate the membership degree between the adjusted cluster centers and each connected component, determine the category label of the connected components based on the maximum membership principle, and generate the texture change type result.

[0029] Preferably, step (4) includes:

[0030] The detection window is divided according to the texture changes of the standardized image, and the mean and variance sequences of the image pixels are calculated using the detection window.

[0031] A first abnormal region map is obtained by performing a three-peak decomposition on the brightness mean sequence. The dark spot region and the overexposed region in the first abnormal region map are merged by using a four-neighbor connected component labeling algorithm to obtain a second abnormal region map.

[0032] A three-level discrete wavelet transform is performed on the second abnormal region map, and the low-frequency energy ratio and high-frequency energy ratio of the abnormal region are calculated through the wavelet transform coefficients to obtain the third abnormal region map;

[0033] The boundary point sequence is extracted from the third abnormal region map. The eccentricity parameter of the boundary point sequence is calculated using the minimum bounding rectangle. A spatial distance matrix is ​​constructed based on the centroid of the abnormal region. The spatial distance matrix is ​​then clustered using a hierarchical clustering algorithm to obtain the distribution characteristics of the abnormal region.

[0034] Based on texture variation type, detection windows are divided on the standardized image, with the window size set to 1 / 16 of the image height. The mean and variance of brightness of pixels within each window are calculated. Trimodal decomposition is performed on the mean brightness sequence to obtain the first anomaly region map. Regions in the first anomaly region map with a mean brightness less than the lower quartile are marked as dark spots, and regions with a mean brightness greater than the upper quartile are marked as overexposed regions. These marked regions are merged to obtain the second anomaly region map. Discrete wavelet transform is performed on the second anomaly region map, and a three-level wavelet decomposition structure is selected. The low-frequency and high-frequency coefficients of each anomaly region are calculated, and the proportion of low-frequency and high-frequency energy is statistically analyzed to generate the third anomaly region map. Boundary tracking is performed on the third anomaly region map to extract the boundary point sequence of the anomaly region. The total length of the boundary point sequence is calculated to obtain the perimeter value, and the number of pixels enclosed by the boundary is calculated to obtain the area value. The roundness parameter is calculated based on the perimeter and area values ​​of the anomaly region, and the eccentricity parameter is calculated using the minimum bounding rectangle. A spatial distance matrix is ​​constructed based on the centroid of the anomaly region. A hierarchical clustering algorithm is applied to the spatial distance matrix, with the clustering distance threshold set to 1 / 8 of the image diagonal length. The number and distribution range of abnormal regions within each cluster are recorded. Based on the cluster distribution, an index of the degree of clustering of abnormal regions is calculated. For each cluster, three statistics are calculated: area proportion, perimeter proportion, and region quantity proportion, generating a characterization value of the distribution of abnormal regions.

[0035] Preferably, step (5) includes:

[0036] A seed point set is constructed based on pixels whose grayscale mean on the weld surface deviates from the overall image mean by more than the standard deviation threshold. The weld surface is then segmented using the region growing method to obtain the first defect image.

[0037] A gray-level co-occurrence matrix is ​​calculated for the first defect map, and the second defect map is obtained by obtaining the second angular moment, inverse difference moment and entropy value features through the co-occurrence matrix.

[0038] The boundary pixel sequence is extracted from the second defect map, the boundary curve equation is fitted using the least squares method, and the curvature change sequence is calculated based on the boundary curve to obtain the third defect map.

[0039] For the third defect map, if the region roundness parameter is greater than the roundness threshold, it is determined to be a porosity defect; if the number of region boundary segments is greater than the boundary segment number threshold, it is determined to be a discontinuity defect. Based on the determination results of porosity defects and discontinuity defects, defect candidate regions are obtained.

[0040] An initial seed point set is constructed based on the distribution of abnormal regions. Seed points are selected when the local gray-level mean deviates from the overall image mean by more than two standard deviations. A region growing method is used to segment the weld surface. During the growing process, the gray-level mean and variance of pixels within the current region are calculated. The gray-level threshold is adaptively adjusted based on the variance to obtain the first defect map. For the first defect map, a gray-level co-occurrence matrix is ​​calculated for each region, with matrix direction angles set to 0 degrees, 45 degrees, 90 degrees, and 135 degrees, and a displacement distance set to 2 pixels. The second defect map is obtained by calculating the second angular moment, inverse difference moment, and entropy value based on the normalized co-occurrence matrix. For each region in the second defect map, the boundary pixel sequence is extracted, and the boundary curve equation is fitted using the least squares method. The curvature change sequence of the boundary curve is calculated, and the number and distribution of curvature peak points are statistically analyzed to obtain the third defect map. For the third defect map, a roundness parameter is calculated based on the ratio of the perimeter to the area of ​​the region boundary curve. The number of segments of the region boundary is calculated based on the spacing of the curvature peak points. Morphological opening operations are used to smooth the region boundaries to obtain the fourth defect map. Regions with a roundness parameter greater than 0.8 in the fourth defect image are labeled as porosity defects. The diameter distribution and spatial density of the porosity region are calculated to generate a porosity feature description vector. Regions with more than 2 segments in the fourth defect image are labeled as discontinuous defects. The length and maximum opening width of the discontinuous region are calculated to generate a discontinuity feature description vector. A support vector machine is used to classify the porosity feature description vector and the discontinuity feature description vector to generate defect candidate region labeling results.

[0041] Preferably, the method further includes: determining the weld direction based on the surface texture characteristics of the weld, scanning grayscale values ​​line by line along the weld direction, identifying weld discontinuity defects based on the location of grayscale abrupt changes, identifying small-area anomalies and marking them as porosity defects, statistically analyzing the area and density of porosity defects, calculating the spacing and frequency of weld discontinuity defects, establishing porosity and weld discontinuity defect vectors, identifying candidate defect regions, and recording their location coordinates and size information, specifically including:

[0042] The horizontal and vertical components of the Sobel gradient operator are calculated based on the surface texture features of the weld. The first direction map is obtained by the distribution frequency of the gradient direction within a 360-degree range. The main direction of the weld is obtained by detecting straight line features.

[0043] A coordinate transformation matrix is ​​established for the main direction of the weld. After rotating and aligning the first direction pattern, a bicubic interpolation method is used to resample and obtain a horizontal texture image.

[0044] For the horizontal texture image, calculate the gray-level difference sequence of pixel row data. If the difference value is greater than three times the local gray-level standard deviation threshold, it is marked as a strong edge point. If the difference value is between two and three times the local gray-level standard deviation threshold and is connected to a strong edge point, it is marked as a weak edge point.

[0045] Based on the strong edge points and weak edge points, an eight-neighborhood connectivity analysis is performed, and regions with a connectivity length exceeding a preset length threshold are marked as discontinuous defect regions.

[0046] The horizontal and vertical components of the Sobel gradient operator are calculated based on the surface texture features of the weld. The distribution frequency of the gradient direction within a 360-degree range is statistically analyzed to obtain the first orientation map. Hough transform is used to detect straight line features, and the inclination angle of the line with the highest number of votes is extracted as the main direction of the weld. A coordinate transformation matrix is ​​established based on the main direction of the weld, and the first orientation map is rotated and aligned to obtain the second orientation map. Bicubic interpolation is used to resample the image, maintaining the weld texture direction parallel to the horizontal direction. For the second orientation map, a gray-level difference sequence of pixel row data is calculated. A high threshold is set to 3 times the local gray-level standard deviation, and a low threshold is set to 2 times the local gray-level standard deviation. Points in the difference sequence greater than the high threshold are marked as strong edge points, and points between the high and low thresholds that are connected to strong edge points are marked as weak edge points. Eight-neighborhood connectivity analysis is used to connect strong and weak edge points. Regions with a connectivity length exceeding a preset length threshold are marked as discontinuous defect regions, generating a third orientation map. Morphological processing is performed on discontinuous defect regions in the third-directed graph. A circular structuring element with a radius of 5 pixels is selected for opening and closing operations to extract the length and width parameters of each defect region. The distance sequence between the centroids of adjacent discontinuous defect regions is calculated, and Fourier transform is used to analyze the periodicity of the distance sequence, generating a defect distribution frequency vector. For regions processed by morphological opening operations, connected regions with areas smaller than a preset area threshold are extracted. The ratio of the square of the perimeter to the area of ​​the connected region is calculated to obtain a roundness parameter. Regions with roundness parameters greater than a preset roundness threshold are marked as porosity defects. The centroid coordinates, area size, and roundness parameter of each porosity defect are statistically analyzed, and the number of pores per unit area is calculated to generate a defect candidate region labeling map.

[0047] Preferably, step (6) includes:

[0048] The diameter and roundness parameters of pores in the defect candidate region image block are obtained, the crack length and orientation parameters are obtained by skeleton extraction algorithm, and the incomplete penetration depth parameter is obtained by gray-level gradient algorithm to generate the first feature matrix.

[0049] Perform maximum and minimum value mapping based on the first feature matrix to obtain normalized feature values. Arrange the normalized feature values ​​according to the three types of defects: porosity, cracks, and incomplete penetration to generate a second feature matrix.

[0050] For the second feature matrix, calculate the eigenvalues ​​and eigenvectors, select the eigenvectors whose cumulative contribution rate reaches a preset threshold as the dimensionality reduction basis vectors, and generate the third feature matrix;

[0051] A neural network input tensor is constructed based on the third feature matrix. The input tensor is processed through convolutional layers and fully connected layers. The output probability vector is normalized by the Softmax function. The maximum component value of the probability vector and the corresponding threshold are determined to identify the defect type label.

[0052] Shape features are extracted from image patches of candidate defect regions. A contour tracking algorithm is used to calculate pore diameter and roundness, a skeleton extraction algorithm to calculate crack length and orientation, and a grayscale gradient algorithm to calculate incomplete penetration depth, generating a first feature matrix. The first feature matrix is ​​then normalized, and a maximum-minimum mapping method is used to map feature values ​​to the 0-1 interval. The normalized feature values ​​are then arranged according to three defect types: pores, cracks, and incomplete penetration, generating a second feature matrix. Principal component analysis is performed on the second feature matrix to calculate eigenvalues ​​and eigenvectors. The top principal components with a cumulative contribution rate of 95% are selected as the reduced-dimensionality basis vectors, generating a third feature matrix. A neural network input tensor is constructed based on the third feature matrix. The number of nodes in the input layer is set to be the same as the feature dimension. The first convolutional layer has 32 3×3 convolutional kernels, and the second convolutional layer has 64 3×3 convolutional kernels. A batch normalization layer is connected after the second convolutional layer to calculate the mean and variance of the feature map. The feature map is then standardized to eliminate data distribution bias. A fully connected layer is used to unfold the feature map. The number of hidden layer nodes is set to twice the input dimension, and the number of output layer nodes is set to 3 to correspond to the three defect types. The output of the fully connected layer is normalized using the Softmax function to generate a three-dimensional probability vector, corresponding to the probability scores of porosity, cracks, and incomplete penetration. Porosity probability thresholds, crack probability thresholds, and incomplete penetration probability thresholds are set. The defect type label is determined by comparing the value of the largest component in the probability vector with the corresponding threshold.

[0053] Preferably, step (7) includes:

[0054] The distribution density curve is calculated using the Gaussian kernel density estimation method based on the defect size data. The first judgment threshold is obtained by extracting the position where the slope change exceeds the preset slope threshold from the distribution density curve.

[0055] A square sliding window is set to statistically distribute the number of defects based on the first judgment threshold, and the range of defect fluctuation is obtained by calculating the defect number difference sequence between adjacent window positions.

[0056] The cumulative distribution of the defect quantity difference sequence is calculated using an exponential weighting method. When the slope of the cumulative distribution curve exceeds a preset slope threshold, a second judgment threshold is obtained.

[0057] The first and second determination thresholds are combined to classify various defect levels.

[0058] Based on the defect type feature vectors, statistical tables for pore diameter, crack length, and incomplete penetration depth are established. The size distribution density is calculated using Gaussian kernel density estimation, with the kernel function bandwidth set to 1 / 5 of the sample standard deviation. Positions in the density curve where the slope change exceeds a preset slope threshold are extracted as the first judgment threshold. A square sliding window of 1 / 10 of the image size is set for the first judgment threshold. The quantity distribution of various defects is statistically analyzed within the window, and the difference in defect quantity between adjacent window positions is calculated. The standard deviation of the difference sequence determines the quantity fluctuation range. An exponential weighting method is used to calculate the cumulative distribution of defect quantity. When the slope of the distribution curve exceeds a preset slope threshold, the quantity threshold is updated to generate a second judgment threshold. A support vector regressor based on a radial basis function kernel is established. The input features include three components: defect size, quantity, and distribution location. The output is a severity score. Cross-validation is used to optimize the support vector regressor parameters, selecting the parameter combination with the smallest validation error to generate a third judgment threshold. Severity levels are determined based on the third judgment threshold: defects exceeding the size threshold are considered size exceeding the standard, and defects exceeding the quantity threshold are considered density exceeding the standard. For each defect, a severity score is calculated, and defects are classified into three levels: minor, moderate, and severe, based on the score. The number and spatial distribution of defects in each level are counted, the location coordinates of defects and their corresponding severity levels are recorded, and a classification result table is generated.

[0059] Preferably, step (8) specifically includes:

[0060] Based on the defect classification results, three sets of characteristic values ​​are obtained: number density, spatial clustering degree and average size per unit area. The covariance matrix of the characteristic values ​​is calculated by principal component analysis to obtain the first characteristic matrix.

[0061] Hierarchical clustering is performed on the first feature matrix using Euclidean distance metric. If the ratio of inter-class distance to intra-class distance is less than a preset distance threshold, the center vector and covariance matrix of the cluster are recorded to obtain the second feature matrix.

[0062] Based on the second feature matrix, Bayesian network nodes are set, and the conditional probabilities between nodes are estimated using the expectation-maximization algorithm to obtain the third feature matrix.

[0063] Forward and backward propagation are performed on the node probabilities in the third feature matrix to perform probabilistic inference on the Bayesian network. The marginal probability distribution between nodes is iteratively calculated until convergence. The welding quality evaluation score is calculated based on the converged probability distribution.

[0064] Based on the classification results, a feature description matrix is ​​established. For each type of severe defect, three sets of feature values ​​are extracted: number density per unit area, spatial clustering, and average size. Principal component analysis is used to calculate the covariance matrix of the feature values. The principal components with a cumulative contribution rate of 95% are selected to obtain the first feature matrix. Euclidean distance is used to perform hierarchical clustering on the first feature matrix, calculating the ratio of inter-cluster distance to intra-cluster distance. Clustering stops when the ratio is less than a preset threshold. The center vector and covariance matrix of each cluster are recorded to obtain the second feature matrix. Bayesian network nodes are set based on the second feature matrix. The input layer contains texture feature node groups, the intermediate layer contains defect type node groups, and the output layer contains severity node groups. The expectation-maximization algorithm is used to estimate the conditional probabilities between nodes to obtain the third feature matrix. Forward propagation is performed on the node probabilities in the third feature matrix, updating the defect type node probabilities based on the observations of the texture feature nodes. Backward propagation is performed on the updated defect type node probabilities to calculate the posterior probability distribution of severity nodes. The belief propagation algorithm is used to perform probabilistic inference on the Bayesian network, iteratively calculating the marginal probability distribution between nodes until convergence. A comprehensive score is calculated based on the converged probability distribution, using a weighted summation method where the weight coefficients are proportional to the node confidence levels. The comprehensive score is then normalized to generate a welding quality assessment score in the range of 0-100.

[0065] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects:

[0066] This invention discloses an automatic detection and classification method for engineering construction defects based on deep learning. By preprocessing and standardizing weld surface images, texture features are extracted and their spatial distribution characteristics are analyzed. Texture changes caused by oxidation and discoloration are identified, and abnormal gloss areas are detected using spectral analysis. An abnormal region segmentation algorithm is employed, and a pre-trained convolutional neural network model is used to identify defect types such as porosity and cracks. Finally, texture features and defect information are fused, and a Bayesian network is used to comprehensively evaluate and score the welding quality. This invention achieves automatic detection and classification of weld surface defects, providing an intelligent solution for welding quality control and significantly improving welding production efficiency and product quality. Attached Figure Description

[0067] Figure 1 This is a flowchart of an automatic detection and classification method for engineering construction defects based on deep learning, according to the present invention.

[0068] Figure 2 This is a schematic diagram of an automatic detection and classification method for engineering construction defects based on deep learning, according to the present invention. Detailed Implementation

[0069] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.

[0070] like Figure 1 This embodiment of an automatic detection and classification method for engineering construction defects based on deep learning may specifically include:

[0071] S101 acquires images of the weld surface using a drone and preprocesses the images to generate standardized images.

[0072] The inspection equipment has a built-in defect detection function, which can be integrated into the equipment system or a dedicated application. The specific implementation method depends on the actual scenario. The defect detection function can be activated in various ways, including manually by the user (e.g., by clicking the detection button on the interface) or automatically via remote command (e.g., by triggering it according to a preset path during drone inspection). The specific details of the activation method can be configured by technical personnel according to requirements and are not limited here.

[0073] After the inspection function is activated, the equipment first uses an industrial camera mounted on the drone to acquire images of the weld surface. The resolution, focal length, and exposure parameters of the acquired images are dynamically adjusted according to environmental conditions to ensure that the image quality meets the requirements of subsequent processing. After acquisition, the equipment performs multi-stage preprocessing on the images to eliminate environmental interference and generate standardized images suitable for analysis.

[0074] The S1011 uses a fixed-focus camera to acquire images of the weld surface, and performs noise reduction on the images based on multi-scale decomposition technology to generate a preliminary processed image.

[0075] The drone is equipped with a fixed-focal-length industrial camera, with a focal length range of 35 to 75 mm and a field of view varying between 31 and 68 degrees, covering a weld seam area approximately 300 mm wide. During data acquisition, the drone's flight speed is controlled below 5 meters per second to ensure image clarity. The device adjusts exposure parameters in real time based on light sensor data. For example, during daytime when the light intensity is above 10,000 lux, the exposure time is set to 1 / 2000 second and the aperture to f / 8; at night when the light intensity is below 100 lux, the exposure time is extended to 1 / 500 second and the aperture is adjusted to f / 2.8. The acquired image resolution is 2048 × 1536 pixels, ensuring that the image quality of the edge areas reaches more than 90% of that of the center area.

[0076] The device employs multi-scale decomposition technology for noise reduction of the acquired raw images. Specifically, it uses three-level wavelet transform to decompose the image, covering frequency bands of 0 to 1024 Hz, 0 to 512 Hz, and 0 to 256 Hz, with high-frequency noise mainly concentrated above 1024 Hz. A soft thresholding method is used to filter out noise, with the threshold set at three times the standard deviation of the wavelet coefficients at each level. The signal-to-noise ratio of the reconstructed image after noise reduction is improved by approximately 8 dB, generating a preliminary processed image that provides a clear data foundation for subsequent analysis.

[0077] S1012 performs illumination normalization and geometric correction on the pre-processed image, extracts edge features and optimizes image contrast, and generates a standardized image.

[0078] The equipment performs illumination normalization on the initially processed image to eliminate the influence of uneven ambient lighting. Specifically, it analyzes the brightness distribution based on the image's grayscale histogram, identifies peak and valley features, and divides the image into dark and bright areas. Dark areas are enhanced with piecewise linear stretching, while bright areas retain their original features, generating an intermediate image with balanced illumination. An illumination intensity distribution map is created for the intermediate image, and a 5×5 Gaussian filter is used for smoothing with a standard deviation of 1.5, resulting in a smooth curve with good continuity. If local illumination differences exceed 50%, the brightness of dark areas is adjusted using a brightness compensation coefficient, with the compensation amount not exceeding 80% of the original brightness.

[0079] Subsequently, the equipment performs geometric correction on the image to calibrate the weld orientation. The Sobel operator is used to detect edges, extract the weld contour, and calculate the angle between the contour and the horizontal direction, with the angle controlled within ±15 degrees. An affine transformation matrix is ​​constructed based on the angle and the coordinates of the image center point, including translation, rotation, and scaling operations. After correction, the weld centerline is aligned with the image centerline.

[0080] To further optimize image quality, the device sets a 16×16 pixel sliding window in the weld area and calculates the local variance of the pixels within the window. If the variance is less than 100, the enhancement factor is set to 0.8; if the variance is greater than 500, the enhancement factor is set to 1.5; intermediate values ​​are linearly interpolated. After adjusting the contrast based on the enhancement factor, the opening and closing operations of a 3×3 structuring element are applied iteratively twice each to eliminate residual noise and generate a standardized image.

[0081] S102 extracts weld surface texture features from standardized images, analyzes the spatial distribution of texture using a deep convolutional network, and performs feature dimensionality reduction to generate texture feature vectors.

[0082] For standardized images, the device captures texture information of the weld surface through a multi-stage feature extraction process, analyzes its spatial characteristics using a deep learning model, and generates low-dimensional feature vectors for subsequent defect detection. Texture feature extraction aims to identify subtle changes on the weld surface, such as texture anomalies caused by oxidation discoloration or porosity distribution, providing a reliable basis for defect classification.

[0083] like Figure 2 S1021 uses a sliding window to scan the normalized image, calculates local texture features based on the gray-level co-occurrence matrix, and generates an initial feature map.

[0084] The device sets a 10×10 pixel sliding window on the standardized image, with a horizontal and vertical step size of 5 pixels to cover local areas of the image. The size of the sliding window is optimized to balance the expressive power of local features and computational efficiency; too large a window may lose details, while too small a window increases redundancy. For each window, a gray-level co-occurrence matrix is ​​used to statistically analyze the co-occurrence probability of pixel pairs in four directions: 0 degrees, 45 degrees, 90 degrees, and 135 degrees, with a pixel spacing of 1, generating statistical features reflecting texture directionality. Specifically, the 0-degree direction captures horizontal texture changes, the 45-degree direction reflects right-diagonal texture patterns, the 90-degree direction highlights vertical texture features, and the 135-degree direction reveals left-diagonal texture patterns. By calculating the matrix's energy, contrast, and correlation, an initial feature map is generated, with a size of 1 / 5 of the image resolution, providing high-resolution input for subsequent processing.

[0085] S1022 performs multi-scale decomposition on the initial feature map, uses pooling operations to downsample, analyzes the feature correlation between scales, and generates an optimized feature map.

[0086] The device performs a four-layer pyramid decomposition on the initial feature map to extract multi-scale texture information. The first layer downsamples using a 2×2 max-pooling kernel, halving the feature map size. The second layer continues downsampling, reducing the size to 1 / 4 of the original. The third and fourth layers shrink the size to 1 / 8 and 1 / 16 of the original, respectively. Pooling operations preserve salient features and reduce noise interference. For feature maps at adjacent scales, the device calculates the Pearson correlation coefficient to quantify the similarity of textures across different scales. A coefficient close to 1 indicates scale invariance, suitable for advanced feature extraction; a coefficient below 0.5 indicates significant local variations requiring further analysis. After fusing multi-scale information, an optimized 32×32-dimensional feature map is generated, significantly improving the expressive power of the features.

[0087] S1023 constructs a deep convolutional network to process and optimize feature maps, and combines normalization techniques to optimize the output, generating high-dimensional feature maps.

[0088] The device employs a four-layer convolutional neural network to process and optimize feature maps. The first layer contains 24 3×3 convolutional kernels to extract basic texture features such as edges and corners; the second layer contains 48 3×3 convolutional kernels, which combine to form complex texture patterns; the third layer contains 96 3×3 convolutional kernels to capture high-level semantic features; and the fourth layer contains 128 3×3 convolutional kernels to further enhance the abstraction of features. Batch normalization is applied after each convolutional layer to eliminate feature distribution offsets, accelerate network training, and improve stability. The network output is a high-dimensional feature map of 128×6×6 dimensions, containing rich spatial information and providing high-quality input for subsequent dimensionality reduction. It is understood that the number and size of the convolutional kernels can be adjusted according to the actual scenario and are not limited here.

[0089] S1024 performs dimensionality reduction on the high-dimensional feature map, generates a low-dimensional texture feature vector using principal component analysis, and then normalizes it.

[0090] The device flattens the high-dimensional feature map, generating a 9216-dimensional feature vector. For this vector, its covariance matrix is ​​calculated, and eigenvalues ​​and corresponding eigenvectors are extracted to reflect the correlation between features and the data variance distribution. The top 160 eigenvectors with a cumulative contribution rate of 97% are selected to construct an orthogonal basis vector set to ensure linear independence in the feature space. Through projection transformation, the high-dimensional vector is mapped to a 160-dimensional space, significantly reducing computational complexity. After projection, L2 normalization is applied to eliminate dimensional differences, generating the final texture feature vector. The normalized vector has a length of 1, facilitating subsequent similarity calculations.

[0091] S1025 calculates the matching degree between the weld surface and the standard sample based on the feature vector and generates texture analysis results.

[0092] The device uses Euclidean distance to measure the difference between texture feature vectors and a standard sample library. The standard sample library contains 60 samples covering various defect types, including porosity, cracks, and undercut, encompassing typical weld morphologies. The distance between the weld vector to be detected and each sample vector is calculated. Samples with a distance less than 0.3 are considered matches, indicating acceptable weld quality; samples with a distance greater than 0.6 indicate significant defects. The device generates matching results based on the distance distribution and outputs a texture quality score for the weld surface. Scores above 0.9 are considered high-quality welds, while scores below 0.7 require further inspection. The matching results provide important references for subsequent defect classification. Sliding windows and gray-level co-occurrence matrices ensure accurate capture of local features, multi-scale decomposition enhances feature robustness, deep convolutional networks further mine high-level semantic information, and dimensionality reduction balances accuracy and efficiency. The final matching results provide a reliable basis for weld quality assessment, significantly improving the automation and accuracy of the detection process.

[0093] S103 analyzes the texture changes on the weld surface caused by oxidation and discoloration based on texture feature vectors, records the spatial location of the discolored area, and uses a clustering method to classify the texture changes and generate texture change types.

[0094] The equipment utilizes texture feature vectors to identify oxidation discoloration on weld surfaces, focusing on analyzing the spatial distribution characteristics of color and texture to locate discolored areas and determine their type. Oxidation discoloration typically manifests as a change in the weld surface from a silvery-white metallic luster to light yellow, pale blue, or dark brown, affecting the continuity and uniformity of the texture. Through multi-stage analysis, the equipment can accurately distinguish different degrees of oxidation, providing crucial information for subsequent defect detection. The entire process includes color feature extraction, region segmentation, boundary analysis, and cluster classification steps to ensure the accuracy and robustness of the identification results.

[0095] S1031 generates color distribution features based on texture feature vectors, uses region segmentation technology to extract dominant color regions, and generates an initial color-changing region map.

[0096] The device constructs a three-channel color histogram (red, green, and blue) based on texture feature vectors, with a quantization level of 512 to capture subtle color variations. The color histogram reflects the tonal distribution of the weld surface; for example, the RGB values ​​of a standard weld are concentrated in the 200-255 range, exhibiting a silvery-white luster; lightly oxidized areas have RGB values ​​distributed in the 150-190 range, exhibiting a light yellow or pale blue hue; and heavily oxidized areas have RGB values ​​decreasing to the 70-110 range, exhibiting a dark brown or purple hue. The device uses a region growing algorithm to segment the feature vectors, with the growth threshold set at 1.4 times the standard deviation of the color difference between adjacent pixels, typically between 12 and 22. An excessively high threshold may lead to over-merging of regions, while an excessively low threshold results in fragmentation. After segmentation, the dominant color component corresponding to the histogram peak is extracted, its pixel coordinates are recorded, an initial color-changing region map is generated, and potential oxidation areas are marked.

[0097] S1032 analyzes the boundary characteristics of the initial color-changing region map, calculates geometric features and marks connected components, and generates an optimized color-changing region map.

[0098] The equipment applies the Previtt operator to the initial discolored region map to extract the boundary contours of the discolored regions. Compared to other operators, the Previtt operator is more stable in noisy environments. The total number of pixels along the contour line is calculated as the perimeter, typically between 100 and 160 pixels; the number of pixels enclosed by the contour is calculated as the area, typically between 700 and 1100 pixels. Based on the perimeter and area, a roundness value is calculated using the formula 4π × area / perimeter². A roundness value close to 1 indicates that the region is circularly diffused. Typically, the roundness value of the oxidation region at the center of the melt pool is 0.9 to 0.95, decreasing to 0.55 to 0.75 at the edges. The equipment uses an eight-neighbor search method to label connected components, avoiding oblique connections that might be ignored by four-neighbors, ensuring region integrity. After labeling, an optimized discolored region map is generated, recording the boundary information of each connected component.

[0099] S1033 calculates the spatial distribution characteristics of connected components, determines cluster centers, constructs spatial constraints, and generates a classification color-changing region map.

[0100] The device calculates the centroid coordinates of connected components in the optimized color-changing region map. Using the centroid as the center, a search radius is set to 1.8 times the radius of the circumcircle of the connected component, typically between 12 and 22 pixels. Based on the search radius, local density values ​​are calculated, expressed as the number of pixels per unit area. If the density of a point exceeds 1.3 times the average density of its neighborhood, it is marked as a cluster center; an adaptive threshold avoids biases that might arise from a fixed threshold. The device further calculates the Euclidean distance matrix between connected components, with typical distance values ​​between 20 and 60 pixels. Based on the distance matrix, a minimum spanning tree is constructed using the Kruskal algorithm, recording the degree distribution of nodes. Nodes with a degree of 1 represent isolated regions, nodes with a degree of 2 reflect chain-like distributions, and nodes with a degree greater than 3 are cluster centers. The device generates a spatial constraint matrix based on the tree structure, with constraints on pairs of regions whose distance is less than the average diameter of the connected components, typically between 25 and 35 pixels. The matrix adjusts the cluster centers, optimizes spatial correlation, and generates a categorized color-changing region map.

[0101] S1034 optimizes clustering results based on spatial constraints, determines texture variation types, and outputs classification labels.

[0102] The equipment utilizes a classification-based color-changing region map and employs a fuzzy C-means clustering algorithm to adjust cluster centers. Compared to the traditional K-means algorithm, fuzzy clustering is more suitable for handling the boundary ambiguity of oxidized regions. The membership degree between each connected component and the cluster center is calculated using a Gaussian kernel function, with the standard deviation set to 1 / 4 of the connected component diameter, typically 6 to 10 pixels. Based on the principle of maximum membership, category labels are assigned to connected components, generating texture variation types. The classification results include three categories: light oxidation, moderate oxidation, and heavy oxidation, each further subdivided into two spatial patterns: locally concentrated and uniformly diffused. For example, lightly oxidized areas typically appear light yellow and are concentrated at the weld edge; heavily oxidized areas are dark brown and are mostly uniformly distributed. The classification labels provide important basis for subsequent quality assessment.

[0103] Through color histograms, region segmentation, and cluster analysis, the device can efficiently identify oxidation discoloration characteristics on weld surfaces. Dynamic threshold design for region growth improves the adaptability of segmentation, boundary feature analysis reveals the spatial patterns of oxidation, and adaptive selection of cluster centers enhances the robustness of classification.

[0104] S104 identifies dark spots and overexposed areas with abnormal gloss in the standardized image of the weld surface based on texture variation type. By quantifying the geometric features and distribution characteristics of the regions, it generates a distribution characterization of the abnormal regions.

[0105] The equipment analyzes texture variations in standardized images to identify areas of abnormal gloss, focusing on dark spots and overexposed areas, and quantifies their shape, size, and distribution in detail. Gloss anomalies typically manifest as uneven brightness distribution on the weld surface; for example, dark spots appear low-brightness due to insufficient gloss, while overexposed areas appear high-brightness due to excessive reflection. These anomalies may be related to defects such as porosity and cracks, directly affecting the accuracy of weld quality assessment. Through multi-stage processing, the equipment can accurately locate abnormal areas and quantify their characteristics, providing a reliable basis for defect classification.

[0106] S1041 divides the detection window based on texture change type, analyzes brightness distribution characteristics, and generates an initial abnormal region map.

[0107] The device divides the standardized image into detection windows based on texture variation type. The window size is set to 1 / 20 of the image height, typically 40 pixels, with a 40% overlap rate between windows to ensure continuous feature extraction. For an image with a resolution of 1280×960, approximately 600 windows are used, ensuring coverage while controlling computational complexity. For each window, the mean and variance of pixel brightness are calculated to generate a brightness mean sequence. The mean brightness of a normal weld surface is typically between 170 and 230, with a variance between 80 and 120; the mean brightness of dark spot areas is below 110, with a variance exceeding 180; and the mean brightness of overexposed areas is above 250, with a variance below 60. The device uses the expectation-maximization algorithm to perform Gaussian mixture modeling on the brightness mean sequence, decomposing it into three peaks corresponding to dark, normal, and bright areas, respectively. Based on the peak boundary points, areas with brightness below the first quartile are marked as dark spots, and areas above the third quartile are marked as overexposed, generating an initial abnormal area map to preliminarily locate glossy abnormal areas.

[0108] S1042 performs region merging and feature extraction on the initial anomaly region map, and uses wavelet transform to analyze frequency characteristics to generate an optimized anomaly region map.

[0109] The equipment applies an eight-neighbor connected component labeling algorithm to the initial anomalous region map, merging adjacent dark spots and overexposed areas. Compared to four-neighbor, eight-neighbor is better at capturing obliquely connected regions, improving the integrity of the merging. After merging, a second anomalous region map containing independent anomalous regions is generated. For this map, the equipment performs a four-level discrete wavelet transform and uses Haar wavelet basis function decomposition to separate low-frequency and high-frequency components. The low-frequency component reflects the overall brightness distribution, while the high-frequency component captures local light intensity abrupt changes. In normal weld seam areas, the low-frequency energy proportion is 70% to 80%, and the high-frequency energy proportion is 20% to 30%; in anomalous regions, the high-frequency energy proportion usually exceeds 40%, indicating significant texture abrupt changes. The equipment statistically analyzes the energy distribution of each anomalous region, generating an optimized anomalous region map that highlights frequency characteristics, providing high-quality input for analysis.

[0110] S1043 extracts the geometric and spatial features of the optimized anomaly region map and generates anomaly region distribution representations through cluster analysis.

[0111] The device applies the Canny edge detection algorithm to the optimized anomaly region map, extracting the boundary point sequence of the anomaly region. The total number of boundary pixels is calculated as the perimeter, typically 80 to 150 pixels; the number of enclosing pixels is calculated as the area, typically 600 to 1000 pixels. Based on the perimeter and area, a roundness parameter is calculated using the formula 4π × area / perimeter². Circular defects have a roundness close to 1, while strip-shaped defects have a roundness below 0.5. The device further uses the minimum bounding rectangle to calculate the eccentricity. The ratio of the major axis to the minor axis reflects the region's shape; circular defects have an eccentricity of approximately 1, while strip-shaped defects have an eccentricity exceeding 2.5. Based on the centroids of the anomaly regions, a spatial distance matrix is ​​constructed, with matrix elements representing the Euclidean distance between centroids, typically 15 to 50 pixels. The device uses the DBSCAN clustering algorithm to analyze the distance matrix, with the density radius set to 1 / 10 of the image diagonal length, approximately 120 pixels. The clustering results generate multiple clusters, each recording the number, area percentage, and perimeter percentage of the anomaly regions. An area percentage exceeding 15% indicates a large-area anomaly, a perimeter percentage exceeding 25% indicates complex boundaries, and a region number percentage exceeding 20% ​​reflects a dense distribution. Based on these statistics, the equipment generates a characterization value for the distribution of anomaly areas, quantifying the spatial characteristics of the defects.

[0112] Through brightness analysis, wavelet transform, and geometric feature extraction, the equipment can efficiently identify abnormal gloss areas on the weld surface. Dynamic division of the detection window ensures comprehensive capture of brightness features, eight-neighbor merging improves regional integrity, wavelet transform reveals frequency characteristics, and cluster analysis quantifies the patterns of abnormal distribution. The generated characterization values ​​clearly reflect the distribution patterns of dark spots and overexposed areas. For example, porosity defects exhibit a uniform distribution of small-area circular anomalies, while crack defects show a concentrated distribution of large-area strip-shaped anomalies, providing accurate support for defect classification.

[0113] S105 uses a region growing algorithm to segment abnormal regions on the weld surface, combines texture features to analyze porosity and weld discontinuity defects, and generates candidate defect regions through direction detection and edge analysis.

[0114] Based on the distribution of abnormal regions in standardized images, the equipment uses a region growing algorithm to segment the weld surface and combines texture feature vectors to identify porosity and discontinuity defects. Porosity manifests as small, circular anomalies, while weld discontinuities appear as strip-shaped or crack-like areas. These defects directly affect the mechanical properties and electrical reliability of the weld. Through multi-stage feature extraction and classification, the equipment can accurately locate defect areas and generate candidate labels.

[0115] S1051 constructs a seed point set based on grayscale features, and uses a region growing algorithm to segment the weld surface to generate an initial defect region map.

[0116] The equipment analyzes the grayscale distribution of the weld surface and selects pixels whose grayscale values ​​deviate from the overall image mean by more than 1.8 times the standard deviation as seed points. Typical weld images have a grayscale mean of 150 to 190 and a standard deviation of 15 to 25. Seed point grayscale values ​​are typically below 100 or above 240, reflecting dark spots or overexposed areas. A region growing algorithm is used to expand from the seed points, with the growth threshold dynamically adjusted based on the number of pixels within the region.

[0117] When a region has fewer than 80 pixels, the threshold is set to 8; when the number of pixels exceeds 400, the threshold increases to 18. This adaptive strategy avoids fragmentation of small regions and excessive merging of large regions. After growth, an initial defect region map is generated, marking potential pores and discontinuities, providing a foundation for subsequent feature extraction.

[0118] S1052 calculates texture features and extracts boundary information, analyzes regional curvature characteristics, and generates an optimized defect region map.

[0119] The equipment calculates a gray-level co-occurrence matrix for the initial defect area map, setting the orientation to 0 degrees, 45 degrees, 90 degrees, and 135 degrees, with a displacement distance of 3 pixels to capture the directionality and local variations of the texture. After normalizing the matrix, it extracts the angular second moment, inverse moment, and entropy features: the angular second moment of normal welds is between 0.35 and 0.55, the inverse moment is between 0.15 and 0.25, and the entropy value is between 3.8 and 4.8; the angular second moment of defect areas is below 0.15, the inverse moment is above 0.4, and the entropy value exceeds 5.5. Based on these features, a second defect area map is generated. For this map, the equipment extracts the boundary pixel sequence of each region and uses a fifth-order polynomial to fit the boundary curve using the least squares method to ensure the third-order continuity of the curve. When calculating the curvature, the formula for a quadratic curve formed by four adjacent points is used; the curvature of the normal weld boundary is between 0.008 and 0.025, and the peak curvature of the defect area can reach 0.12. The distribution of curvature peak points is statistically analyzed to generate an optimized defect area map, highlighting the geometric characteristics of porosity and discontinuities.

[0120] S1053 determines the weld direction and analyzes edge features, marks porosity and discontinuity defects, and generates feature description vectors.

[0121] The device utilizes texture features to calculate the horizontal and vertical components of the Prewitt gradient operator, statistically analyzing the frequency distribution of the gradient direction within a 360-degree range, with a resolution of 8 degrees. The gradient direction of a normal weld is concentrated around the main direction at 40 degrees, exhibiting a bimodal distribution. A fast Hough transform is used to detect straight line features, selecting lines with a vote count exceeding 70% of the image width as the main weld direction. A rotation matrix is ​​constructed based on the main direction, and the image undergoes coordinate transformation. Biquadratic interpolation resampling is used, with an interpolation kernel of 3×3 pixels, generating a horizontally aligned texture image. For this image, the gray-level difference sequence of the row data is calculated, with a high threshold set at 3.5 times the local standard deviation and a low threshold at 2.2 times. Points with difference values ​​exceeding the high threshold are marked as strong edges, while points between the low and high thresholds and connected to strong edges are marked as weak edges. Through eight-neighbor connectivity analysis, strong and weak edge points are connected, and regions with a connectivity length exceeding 4% of the image width are marked as discontinuous defects. Morphological closing operations are performed using elliptical structuring elements with a radius of 4 pixels to smooth defect boundaries. For regions smaller than 150 pixels, the ratio of the squared perimeter to the area is calculated. Regions with a roundness of 12.8 to 14.5 are marked as porosity defects. Pore diameters are statistically analyzed to be between 0.4 and 1.8 mm, with a density of 2 to 6 per square centimeter. Discontinuous defects have lengths between 2 and 8 mm and opening widths between 0.15 and 0.7 mm. A porosity feature vector containing roundness, area, and density, and a discontinuous defect feature vector containing length, width, and spacing are generated.

[0122] S1054 classifies defects based on feature vectors and quantifies their distribution characteristics to generate defect candidate region labels.

[0123] The device employs a random forest classifier to classify pores and discontinuous feature vectors. The training samples include 1200 normal regions and 600 defective regions, with feature vectors containing 4 and 5 components respectively, achieving a classification accuracy of 96%. After classification, the spacing sequence of discontinuous defects is statistically analyzed, and a 512-point Fast Fourier Transform is used to determine periodicity. A spectral peak value between 0.15 and 0.35 indicates a periodic distribution, while a peak value between 0.45 and 0.65 reflects a clustered distribution. Defects with a spacing of less than 25 pixels are considered crack propagation risk areas. For pore defects, the distribution density within a 100×100 pixel window is calculated; windows with a density exceeding 5 are marked as pore clusters. A defect candidate region labeling map is generated, recording the coordinates, size, and type of each region. Porous defects are predominantly small, circular areas, while discontinuous defects are predominantly distributed in strip-like clusters.

[0124] Through region growing, texture analysis, and orientation detection, the device achieves efficient identification of surface defects in welds. Adaptive thresholding improves the flexibility of segmentation, gray-level co-occurrence matrix and curvature analysis enhance the expressiveness of features, orientation alignment and edge detection ensure accurate localization of discontinuities, and random forest classification improves the ability to distinguish defect types. The generated candidate region labels clearly reflect the spatial distribution characteristics of porosity and discontinuities, providing solid support for weld quality assessment.

[0125] S106 vectorizes the morphological features of porosity, cracks, and incomplete penetration defects to generate a feature matrix of candidate defect regions. This matrix is ​​then input into a pre-trained convolutional neural network model, which outputs the probability distribution of defect types and determines the defect category based on the probability results.

[0126] The equipment extracts multidimensional features from candidate defect regions, quantifying characteristics such as porosity size, crack morphology, and incomplete penetration depth to form a structured feature matrix. By analyzing these features using a deep learning model, the equipment can efficiently distinguish different types of weld defects, providing accurate data for quality assessment. The entire process encompasses feature extraction, normalization, dimensionality reduction analysis, and neural network classification, ensuring the robustness of feature representation and the reliability of classification results. Porosity typically manifests as small, circular anomalies, cracks appear as elongated strips, and incomplete penetration forms a dark area at the weld root; these differences provide the basis for classification.

[0127] S1061 extracts geometric and texture features from the defect candidate region, quantifies the morphological parameters of porosity, cracks and incomplete penetration, and generates an initial feature matrix.

[0128] The equipment extracts features from image blocks of candidate defect regions. For pores, a region-filling algorithm is used to calculate their diameter and roundness. Typical diameter values ​​range from 0.4 to 1.9 mm, and roundness ranges from 0.82 to 0.94, reflecting the regularity of the pores. Crack features are extracted using a tensor voting algorithm to extract the skeleton, with a calculated length of 2 to 9 mm and an angle of ±50 degrees between the crack's direction and the main weld direction, capturing the crack's extension path. Incomplete penetration features are calculated based on the Laplacian operator to calculate the grayscale gradient rate of change. The gradient rate for normal welds is between 0.15 and 0.28, while incomplete penetration areas rise to over 0.45, reflecting depth anomalies. The equipment integrates these parameters to generate an initial feature matrix containing nine components: pore diameter, roundness, and area; crack length, width, and direction; and incomplete penetration depth, width, and length, providing multi-dimensional input for subsequent processing.

[0129] S1062 normalizes the initial feature matrix, optimizes the feature distribution, and reorganizes it to generate a standardized feature matrix.

[0130] The equipment employs a zero-mean normalization method to process the initial feature matrix. Each feature component is subtracted from its mean and then divided by its standard deviation to eliminate dimensional differences. The standard deviation for pore diameter is approximately 0.3 mm, for crack length approximately 1.5 mm, and for incomplete penetration depth approximately 0.1 mm. After normalization, the feature values ​​are distributed in the range of -2 to 2. The equipment rearranges the features according to the categories of pores, cracks, and incomplete penetration, forming a standardized feature matrix with a dimension of nine times the number of regions. This arrangement facilitates the neural network in distinguishing feature patterns of different defects, improving classification efficiency while preserving the relative relationships between features.

[0131] S1063 performs feature dimensionality reduction analysis, extracts principal components to generate a low-dimensional feature matrix, and optimizes the neural network input.

[0132] The equipment applies singular value decomposition to the standardized feature matrix, calculating eigenvalues ​​and eigenvectors to analyze the correlation between features. The cumulative contribution rate of the first four principal components reaches 96%, indicating a strong linear dependence of the original features. The equipment selects these principal components as dimensionality-reducing basis vectors, projecting the feature matrix into four-dimensional space to generate a low-dimensional feature matrix. After dimensionality reduction, the pore feature retains the main information of diameter and roundness, the crack feature highlights length and direction, and the incomplete penetration feature emphasizes depth and width. This compression not only reduces computational complexity but also enhances the discriminative power of the features, providing an efficient representation for neural network inputs.

[0133] S1064 constructs a convolutional neural network to process low-dimensional feature matrices, outputs probability distributions, and determines defect types.

[0134] The device converts the low-dimensional feature matrix into a three-dimensional tensor, which is then input into a convolutional neural network. The network structure consists of three convolutional layers: the first layer uses 48 3×3 convolutional kernels to extract edge and shape features; the second layer uses 96 3×3 convolutional kernels to integrate local patterns; and the third layer uses 192 3×3 convolutional kernels to generate high-level features. Layer normalization is applied after each convolutional layer to adjust the mean of the feature map to 0 and the variance to 1, stabilizing the training process. Two fully connected layers follow the convolutional layers. The number of hidden layer nodes is three times the feature dimension, approximately 12, and the number of output layer nodes is 3, corresponding to pores, cracks, and incomplete welds. The output is converted into a probability vector using the Softmax function, with probability thresholds of 0.88 for pores, 0.82 for cracks, and 0.78 for incomplete welds. The device selects the defect type corresponding to the maximum probability; if the maximum probability is below the threshold, it is marked as an area to be confirmed. The classification results show that the probability of identifying porosity is consistently above 0.92, cracks between 0.85 and 0.95, and incomplete penetration above 0.80, reflecting the morphological complexity of different defects. The generated defect type labels clearly distinguish the characteristics of porosity, cracks, and incomplete penetration. For example, porosity is mainly characterized by small diameter and high roundness, cracks are characterized by elongated distribution, and incomplete penetration manifests as a dark area combining depth and width, providing a reliable basis for weld quality control.

[0135] S107 performs threshold analysis on the size and quantity of weld defects based on defect type and its feature vector, quantifies the distribution characteristics of various defects, and generates severity classification results.

[0136] In this application embodiment, the device utilizes the feature vectors of porosity, cracks, and incomplete penetration defects, combined with information on size, quantity, and distribution, to classify defects through multi-stage analysis. The classification aims to assess the degree of impact of defects on weld quality; for example, small porosity may only affect local performance, while long cracks or deep incomplete penetration may lead to structural failure. Through statistical analysis and machine learning methods, the device can accurately classify defect levels, generating intuitive classification results to support engineering decisions.

[0137] S1071 uses kernel density estimation to analyze defect size distribution and extracts key thresholds to classify size levels.

[0138] The equipment constructs statistical models based on the dimensional characteristics of each type of defect, generating distribution tables for pore diameter, crack length, and incomplete penetration depth. The probability density of dimensions is calculated using the Gaussian kernel density estimation method, with the kernel function bandwidth set to 1 / 4 of the sample standard deviation. The bandwidth for pore diameter is approximately 0.15 mm, for crack length approximately 0.8 mm, and for incomplete penetration depth approximately 0.06 mm. The density curves reflect the central tendency of the dimensions: pore diameter exhibits a bimodal distribution between 0.4 and 1.8 mm, with peak values ​​at 0.7 mm and 1.4 mm, respectively; crack length shows a right-skewed distribution between 1 and 9 mm, with a peak value at 3.5 mm; and incomplete penetration depth approximates a normal distribution between 0.15 and 0.9 mm, with a peak value at 0.45 mm. The equipment analyzes the curve slope, marking points where the slope exceeds 0.4 as inflection points, typically corresponding to critical dimensions of 1.1 mm pores, 4 mm cracks, and 0.6 mm incomplete penetration, serving as initial thresholds for size grading. This method smooths out data noise and highlights key characteristics of the size distribution.

[0139] S1072 uses a sliding window to statistically analyze the fluctuations in the number of defects and generates a threshold for the quantity distribution.

[0140] The equipment uses a primary threshold to set a square sliding window on a standardized image. The window side length is 1 / 12 of the image size, typically 80 pixels, and the window step size is 40% of the side length to ensure a balance between coverage and efficiency. Within each window, the number of porosity, cracks, and incomplete penetration is counted. In normal weld areas, there are fewer than 4 porosity defects, fewer than 2 cracks, and the length of incomplete penetration is less than 1 / 5 of the window side length. The equipment calculates the difference in defect count between adjacent windows, forming a difference sequence. The standard deviation of the sequence reflects the fluctuation range of the count; the standard deviation for porosity is approximately 1.2, for cracks approximately 0.8, and for incomplete penetration approximately 0.15. A moving average method is used to smooth the difference sequence, with a window size of 5, generating a smooth count fluctuation curve. When the slope of the curve exceeds 0.25, it is marked as a critical point in the count distribution, typically corresponding to 6 porosity defects, 3 cracks, and an incomplete penetration length of 1 / 3 of the window side length, serving as a secondary threshold for count grading.

[0141] S1073 uses a regression model to comprehensively score features and classify the severity levels of defects.

[0142] The device constructs a random forest regressor based on a Gaussian kernel function. Input features include defect size, number, and spatial coordinates; the output is a severity score. The regressor optimizes its parameters using 10-fold cross-validation.

[0143] The maximum tree depth was set to 15, the number of trees to 200, and the mean square error was controlled within 5%. The scoring system integrates multiple characteristics: porosity is determined by diameter and density; individual pores larger than 1.2 mm in diameter score 65-85, and areas with a density exceeding 5 pores per square centimeter score 75-95. Crack scoring considers length and direction; cracks longer than 5 mm and perpendicular to the weld score 80-100. Incomplete penetration is based on depth and length; areas with a depth greater than 0.7 mm score 70-90. The equipment classifies defects according to the scores: below 55 is a minor defect, 55-75 is a moderate defect, and above 75 is a severe defect. After classification, the distribution of defects at each level is statistically analyzed, their coordinates and scores are recorded, and a detailed classification result table is generated. The classification results clearly distinguish the spatial distribution of minor, moderate, and severe defects. For example, minor pores are mostly randomly scattered, moderate cracks are uniformly distributed, and severe incomplete penetration is often concentrated at both ends of the weld, providing precise guidance for quality control.

[0144] S108 extracts severity features based on defect classification results, combines texture feature vectors and defect type labels, and uses a Bayesian network to perform feature fusion to generate a comprehensive evaluation score for welding quality.

[0145] The equipment extracts multidimensional features from the grading results, integrates information on defect size, distribution, and type, and evaluates weld quality using a probabilistic inference model. Severe defects such as large-diameter porosity or long cracks can significantly reduce weld reliability and safety, while minor defects may only require local repair. Bayesian networks, by modeling causal relationships between features, can effectively fuse texture and defect information, generating a quantitative score from 0 to 100 to reflect the overall weld performance. The entire process includes feature matrix construction, cluster analysis, probability estimation, and inference computation, ensuring the accuracy and consistency of the evaluation results.

[0146] S1081 extracts defect features from the grading results, constructs an initial feature matrix, and optimizes the feature representation.

[0147] Based on the grading results, the equipment statistically analyzes the density per unit area, spatial clustering, and average size of each type of defect to form a feature description matrix. Pore density is typically 2 to 6 per square centimeter, crack density is 0.5 to 2 per square centimeter, and the length density of incomplete penetration is 1 to 3 millimeters per square centimeter. Spatial clustering is calculated using the K-nearest neighbor algorithm; the nearest neighbor distance for pores is 4 to 9 millimeters, decreasing to 1.5 to 3 millimeters for clustered areas; the clustering distance for cracks is 10 to 20 millimeters. Regarding average size, pore diameter is 0.3 to 1.7 millimeters, crack length is 1 to 8 millimeters, and incomplete penetration depth is 0.1 to 0.8 millimeters. The equipment uses factor analysis to calculate the covariance matrix of the features, extracting the first four factors, which contribute a cumulative 97%. The first factor mainly reflects size characteristics, contributing approximately 55%; the second factor relates to distribution density, contributing approximately 25%. The optimized initial feature matrix has a dimension of four times the number of defect areas, significantly improving the feature discrimination ability.

[0148] S1082 integrates feature matrices through cluster analysis to generate cluster feature matrices to support probabilistic modeling.

[0149] The device applies Manhattan distance to the initial feature matrix for hierarchical clustering. Compared to Euclidean distance, Manhattan distance is more robust to outliers. The ratio of inter-class distance to intra-class distance is calculated, with a threshold of 2.2. Clustering stops when the ratio falls below this value, typically forming 3 to 5 clusters, each corresponding to a defect group of different severity. Each cluster records a center vector and a covariance matrix. The center vector reflects typical feature values; for example, in a severely defective cluster, the pore diameter is approximately 1.5 mm and the crack length is approximately 6 mm. The covariance matrix quantifies the correlation between features; for example, the correlation coefficient between pore density and clustering degree is approximately 0.7. A clustering feature matrix is ​​generated, with dimensions equal to the number of clusters multiplied by the number of features, providing structured input to the Bayesian network.

[0150] S1083 constructs a Bayesian network and estimates the conditional probability, generating a probability feature matrix.

[0151] The device employs a Bayesian network based on a clustering feature matrix, comprising three layers: the input layer has 10 texture feature nodes, covering surface roughness, texture periodicity, and grayscale contrast; the middle layer has 5 defect type nodes, including porosity, cracks, incomplete penetration, slag inclusion, and undercut; and the output layer has 3 severity nodes, corresponding to minor, moderate, and severe levels. A variational Bayesian algorithm is used to estimate the conditional probabilities between nodes. Compared to the expectation-maximization algorithm, the variational method is more robust to noise. The algorithm iterates 15 to 20 times, with a convergence threshold of 0.0005, generating a probability feature matrix that records the conditional probability distribution of each node. For example, when a high density of porosity feature nodes is observed, the probability of porosity defect nodes rises to 0.85, significantly affecting the severity nodes.

[0152] S1084 performs probabilistic reasoning and calculates a comprehensive score to generate a welding quality assessment result.

[0153] The equipment executes a joint tree inference algorithm on the probability feature matrix, calculating the marginal probabilities between nodes through message passing. Forward propagation updates the defect type probability based on texture features; for example, high roughness texture increases the crack probability to 0.75. Backward propagation adjusts the severity probability based on the defect type; activation of crack nodes increases the severity probability to 0.65. After 10 inference iterations, the marginal probabilities converge, with a standard deviation below 0.002. The equipment calculates scores based on the convergence probabilities, using a linear weighting method. The weights are determined by the node entropy; nodes with lower entropy have higher weights, typically ranging from 0.2 to 0.4. Scores are normalized to 0 to 100, with high-quality welds scoring 92 to 98, acceptable welds 82 to 91, minor defects 70 to 81, and severe defects 60 to 69. The scoring results record the defect coordinates and levels, generating a detailed quality assessment table. The generated assessment scores clearly reflect the weld's condition; for example, severe defects are concentrated in the weld's initial segment, while minor defects are randomly distributed, providing a scientific basis for quality management and repair decisions.

[0154] It should also be noted that the various specific technical features described in the above embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, the present invention will not describe the various possible combinations separately. Furthermore, various different embodiments of the present invention can also be arbitrarily combined, as long as they do not violate the spirit of the present invention, and should also be regarded as the content disclosed by the present invention.

Claims

1. A method for automatic detection and classification of engineering construction defects based on deep learning, characterized in that, The method includes: (1) The weld surface image is denoised and the illumination is normalized to obtain a standardized image; (2) Extract the surface texture features of the weld from the standardized image, analyze the spatial distribution characteristics of the texture using a convolutional neural network, and perform vectorization to obtain the texture feature vector; (3) Identify the texture changes caused by oxidation based on the texture feature vector, record the coordinates of the discolored area, and use a clustering algorithm to classify the texture changes caused by oxidation to obtain the texture change type; (4) Identify dark spot areas with low gloss and overexposed areas with high gloss in the standardized image according to the texture change type, and perform quantitative analysis on the shape, size and number of the identified areas to obtain the distribution of abnormal areas. (5) The region growing algorithm is used to segment the weld surface corresponding to the abnormal region distribution. Combined with the texture feature vector, the porosity and weld discontinuity are analyzed to obtain the defect candidate region. (6) Vectorize the porosity and weld discontinuity to obtain the feature vector of the defect candidate region, input it into the pre-trained defect classification convolutional neural network model, output the defect type probability vector, and identify the defect type based on the probability vector. (7) Based on the defect type and the feature vector of the candidate region, the size and number of defects are divided into thresholds to obtain the severity classification results of various defects; (8) Based on the defect classification results, the severity features are extracted, and combined with the texture feature vector and defect type label, a Bayesian network is used to perform feature fusion to generate a comprehensive evaluation score for welding quality.

2. The method according to claim 1, characterized in that, Step (1) includes: A fixed-focal-length industrial camera is used to acquire the original image of the weld surface. The original image is then decomposed into a three-layer wavelet decomposition to obtain the first weld image. A gray-level histogram is calculated for the first weld image. The second weld image is obtained by performing a piecewise linear transformation based on the peak and valley distribution characteristics of the gray-level histogram. An illumination intensity distribution map is established based on the second weld image. The illumination intensity distribution map is processed by Gaussian filtering. The dark areas are supplemented with light using a brightness compensation coefficient to obtain the third weld image. For the third weld image, the weld edge contour line is extracted, the tilt angle of the contour line is calculated, and the image is geometrically corrected based on the tilt angle and the coordinates of the image center point to obtain the fourth weld image. The local variance value of the fourth weld image is calculated using a sliding window. The contrast enhancement coefficient is adaptively adjusted based on the local variance value to eliminate surface noise and obtain a standardized image.

3. The method according to claim 1, characterized in that, Step (2) includes: A sliding window is set according to the standardized image, and texture features are extracted within the sliding window using the gray-level co-occurrence matrix to obtain a first feature map; The first feature map is decomposed into pyramids, the feature map is downsampled using a max pooling kernel, the correlation coefficients of adjacent scale feature maps are calculated, and the second feature map is obtained. A three-layer convolutional neural network is constructed based on the second feature map, and the output of the convolutional neural network is processed by batch normalization to obtain the third feature map. The third feature map is subjected to eigenvalue decomposition, and the texture feature vector is obtained by projection transformation and normalization of orthogonal basis vector group.

4. The method according to claim 1, characterized in that, Step (3) includes: A three-channel color histogram (red, green, and blue) is generated by obtaining the texture feature vector. The feature vector is then segmented using the region growing method based on the color histogram. The dominant color component is extracted from the segmentation result to obtain the first color-changing region map. Based on the first color-changing region map, the Sobel operator is used to extract the boundary contour of the color-changing region. The perimeter and area values ​​are calculated through the boundary contour. The four-neighbor search method is used to mark the connected components of the color-changing region to obtain the second color-changing region map. For the second color-changing region map, calculate the centroid coordinates of the connected components, calculate the local density value based on the centroid coordinates, and determine the cluster center from the local density value to obtain the third color-changing region map; Calculate the Euclidean distance matrix of the connected domains based on the third color-changing region map, construct a minimum spanning tree using the distance matrix, generate a spatial constraint matrix from the minimum spanning tree, and adjust the cluster centers according to the spatial constraint matrix to determine the texture change type.

5. The method according to claim 1, characterized in that, Step (4) includes: The detection window is divided according to the texture changes of the standardized image, and the mean and variance sequences of the image pixels are calculated using the detection window. A first abnormal region map is obtained by performing a three-peak decomposition on the brightness mean sequence. The dark spot region and the overexposed region in the first abnormal region map are merged by using a four-neighbor connected component labeling algorithm to obtain a second abnormal region map. A three-level discrete wavelet transform is performed on the second abnormal region map, and the low-frequency energy ratio and high-frequency energy ratio of the abnormal region are calculated through the wavelet transform coefficients to obtain the third abnormal region map; The boundary point sequence is extracted from the third abnormal region map. The eccentricity parameter of the boundary point sequence is calculated using the minimum bounding rectangle. A spatial distance matrix is ​​constructed based on the centroid of the abnormal region. The spatial distance matrix is ​​then clustered using a hierarchical clustering algorithm to obtain the distribution characteristics of the abnormal region.

6. The method according to claim 1, characterized in that, Step (5) includes: A seed point set is constructed based on pixels whose grayscale mean on the weld surface deviates from the overall image mean by more than the standard deviation threshold. The weld surface is then segmented using the region growing method to obtain the first defect image. A gray-level co-occurrence matrix is ​​calculated for the first defect map, and the second defect map is obtained by obtaining the second angular moment, inverse difference moment and entropy value features through the co-occurrence matrix. The boundary pixel sequence is extracted from the second defect map, the boundary curve equation is fitted using the least squares method, and the curvature change sequence is calculated based on the boundary curve to obtain the third defect map. For the third defect map, if the region roundness parameter is greater than the roundness threshold, it is determined to be a porosity defect; if the number of region boundary segments is greater than the boundary segment number threshold, it is determined to be a discontinuity defect. Based on the determination results of porosity defects and discontinuity defects, defect candidate regions are obtained.

7. The method according to claim 6, characterized in that, Also includes: The weld direction is determined based on the surface texture characteristics of the weld. Grayscale values ​​are scanned line by line along the weld direction. Weld discontinuities are identified based on the locations of abrupt grayscale changes. Small-area anomalies are identified and marked as porosity defects. The area and density of porosity defects are statistically analyzed, and the spacing and frequency of weld discontinuities are calculated. Porosity and weld discontinuity defect vectors are established. Defect candidate regions are identified, and their location coordinates and dimensions are recorded. Specifically, this includes: The horizontal and vertical components of the Sobel gradient operator are calculated based on the surface texture features of the weld. The first direction map is obtained by the distribution frequency of the gradient direction within a 360-degree range. The main direction of the weld is obtained by detecting straight line features. A coordinate transformation matrix is ​​established for the main direction of the weld. After rotating and aligning the first direction pattern, a bicubic interpolation method is used to resample and obtain a horizontal texture image. For the horizontal texture image, calculate the gray-level difference sequence of pixel row data. If the difference value is greater than three times the local gray-level standard deviation threshold, it is marked as a strong edge point. If the difference value is between two and three times the local gray-level standard deviation threshold and is connected to a strong edge point, it is marked as a weak edge point. Based on the strong edge points and weak edge points, an eight-neighborhood connectivity analysis is performed, and regions with a connectivity length exceeding a preset length threshold are marked as discontinuous defect regions.

8. The method according to claim 1, characterized in that, Step (6) includes: The diameter and roundness parameters of pores in the defect candidate region image block are obtained, the crack length and orientation parameters are obtained by skeleton extraction algorithm, and the incomplete penetration depth parameter is obtained by gray-level gradient algorithm to generate the first feature matrix. Perform maximum and minimum value mapping based on the first feature matrix to obtain normalized feature values. Arrange the normalized feature values ​​according to the three types of defects: porosity, cracks, and incomplete penetration to generate a second feature matrix. For the second feature matrix, calculate the eigenvalues ​​and eigenvectors, select the eigenvectors whose cumulative contribution rate reaches a preset threshold as the dimensionality reduction basis vectors, and generate the third feature matrix; A neural network input tensor is constructed based on the third feature matrix. The input tensor is processed through convolutional layers and fully connected layers. The output probability vector is normalized by the Softmax function. The maximum component value of the probability vector and the corresponding threshold are determined to identify the defect type label.

9. The method according to claim 1, characterized in that, Step (7) includes: The distribution density curve is calculated using the Gaussian kernel density estimation method based on the defect size data. The first judgment threshold is obtained by extracting the position where the slope change exceeds the preset slope threshold from the distribution density curve. A square sliding window is set to statistically distribute the number of defects based on the first judgment threshold, and the range of defect fluctuation is obtained by calculating the defect number difference sequence between adjacent window positions. The cumulative distribution of the defect quantity difference sequence is calculated using an exponential weighting method. When the slope of the cumulative distribution curve exceeds a preset slope threshold, a second judgment threshold is obtained. The first and second determination thresholds are combined to classify various defect levels.

10. The method according to claim 1, characterized in that, Step (8) specifically includes: Based on the defect classification results, three sets of characteristic values ​​are obtained: number density, spatial clustering degree and average size per unit area. The covariance matrix of the characteristic values ​​is calculated by principal component analysis to obtain the first characteristic matrix. Hierarchical clustering is performed on the first feature matrix using Euclidean distance metric. If the ratio of inter-class distance to intra-class distance is less than a preset distance threshold, the center vector and covariance matrix of the cluster are recorded to obtain the second feature matrix. Based on the second feature matrix, Bayesian network nodes are set, and the conditional probabilities between nodes are estimated using the expectation-maximization algorithm to obtain the third feature matrix. Forward and backward propagation are performed on the node probabilities in the third feature matrix to perform probabilistic inference on the Bayesian network. The marginal probability distribution between nodes is iteratively calculated until convergence. The welding quality evaluation score is calculated based on the converged probability distribution.

Citation Information

Cited By

  • Control method and system for laser hybrid welding

    CN121289758A

  • New energy automobile part defect detection method and system based on deep learning

    CN121504919A

  • Airborne cloud particle image quality intelligent evaluation and screening method and system

    CN121504936A

  • Engineering surface defect detection image intelligent segmentation and damage degree rating system

    CN121563986A

  • Solid-solid interface structure consistency evaluation method for all-solid-state battery

    CN121612906A