Welding defect classification method and system based on deep learning
Through the welding defect classification method based on deep learning, the welding image features are automatically extracted using the feature fusion CNN model, which solves the problems of low recognition accuracy and poor real-time performance in traditional methods, and achieves efficient and accurate welding defect recognition.
Patent Information
- Application Number
- CN202510430613.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2045-04-08
AI Technical Summary
Traditional welding defect detection methods have problems such as low recognition accuracy, limitations in feature extraction and poor real-time performance, and it is difficult to adapt to complex and variable welding defects.
Using a welding defect classification method based on deep learning, the CNN image recognition and classification model for feature fusion is constructed, and the high-dimensional visual features in the welding image are automatically extracted, and the robustness and accuracy of defect recognition are improved through multi-level feature fusion and adaptive feature weighting mechanisms.
It significantly improves the accuracy and robustness of welding defect identification, improves the efficiency and reliability of industrial quality monitoring, and meets the demand for real-time inspection on the industrial site.
Smart Images

Figure CN120236142A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image processing, and particularly to a welding defect classification method and system based on deep learning. Background Art
[0002] Welding defect detection and classification is an important quality control task in industrial manufacturing. Especially in the fields of automation and intelligent manufacturing, its accuracy and real-time performance directly affect production efficiency and product quality. Traditional welding defect detection methods mainly rely on image processing technology and manual feature extraction, such as edge detection, morphological operations, and gray-level co-occurrence matrix, etc. These methods rely on artificially designed features and have strong limitations. When dealing with complex and variable welding defects, they often cannot accurately extract effective features, resulting in low detection accuracy. At the same time, traditional machine learning algorithms, such as support vector machines, K-nearest neighbor algorithms, etc., also have difficulties in dealing with high-dimensional data and cannot fully mine the deep feature information in images. Therefore, there are obvious deficiencies in the accuracy of defect recognition and classification.
[0003] In recent years, deep learning technology, especially convolutional neural networks (CNNs), has made remarkable progress in the field of computer vision, especially achieving extremely high accuracy in image classification and object detection tasks. Convolutional neural networks can automatically learn features extracted from raw data, greatly reducing the dependence on manual feature engineering. Ario et al. developed an artificial neural network (ANN) to extract molten pool geometric features for welding quality control, but it still lacks in high-precision detection for dealing with welding defects; Kovacevic et al. established a model for molten pool size information and back weld width based on a classical neural network, but due to the limited dimensional feature extraction ability of this algorithm, the accuracy in detecting welding defects is not high; Liu Xinfeng et al. used features such as the extracted molten pool length, width, area, and trailing angle as the input of a neural network. Although the proposed neural network model accurately predicted the change in the back weld width of the molten pool, it could not accurately detect welding defects; He Deqiang proposed an intelligent model for welding quality detection based on attention-balanced context Mask R-CNN, which accurately predicted welding defects, but due to the dependence on ultrasonic detection images, it could not perform real-time detection; Zhang Zefa used CNN and welding images to study online defect detection of robotic arc welding of aluminum alloys based on deep learning. Although this model accurately predicted welding defects, it lacked an analysis of the welding mechanism for defect prediction; Guo proposed a welding defect classification method based on lightweight CNN, visualized the feature data of each convolutional layer to verify the feasibility of the model and improve the interpretability of the model, but it lacked robustness in various welding scenarios. These models have achieved high-precision defect prediction in specific scenarios based on CNN and its improved algorithms, but there are still certain defects.
[0004] In existing research, Li et al. developed a welding defect prediction model based on convolutional neural network (CNN) for welding defect detection in the gas metal arc welding (GMAW) process in "Defects detection of GMAW process based on convolutional neural network algorithm". By combining feature extraction and processing of the molten pool image, the accuracy and robustness of defect detection were significantly improved. This scheme first developed a visual perception system. By arranging filters and cameras at specific angles, the problem of arc light interference during the welding process was successfully solved, and clear molten pool images were obtained. Using image processing algorithms, the system pre-processed the original images, including defining the region of interest (ROI), morphological filtering, and affine transformation, to eliminate the influence of arc light interference and welding spatter on the images and extract high-quality molten pool boundary images. The image pre-processing steps are as Figure 1 shown.
[0005] In terms of model design, this study used CNN to automatically extract high-dimensional visual features from a large number of molten pool images, and combined welder experience to analyze key features in the molten pool (such as black holes in the middle of the molten pool, pores at the tail of the molten pool, and slag inclusions at the edge of the molten pool). The architecture of its model training process is as Figure 2 shown. These features are used to predict welding defects such as burn-through, pores, and slag inclusions. By optimizing network parameters (convolution kernel size, batch size, learning rate, etc.), the model achieved an accuracy rate of over 97% in prediction and demonstrated strong robustness in various welding scenarios. This study has made significant progress in terms of accuracy and robustness, but there are still some deficiencies in cross-scenario generality and adaptability to different welding parameter changes. On the other hand, the image processing steps of this method are relatively complex, which will increase the calculation time and affect the application of the system under extreme real-time requirements. Summary of the Invention
[0006] In view of this, the present application provides a welding defect classification method and system based on deep learning, which can achieve efficient and accurate welding defect recognition through deep learning technology, and at the same time significantly improve the efficiency and reliability of industrial quality monitoring.
[0007] The present application discloses a welding defect classification method based on deep learning, which includes:
[0008] Step 1: Collect welding images and use them as training samples in the training set, and pre-process the welding images in the training set;
[0009] Step 2: Construct a CNN image recognition and classification model with feature fusion;
[0010] Step 3: Use the training samples in Step 1 to train the CNN image recognition and classification model in Step 2 to obtain a trained CNN image recognition and classification model;
[0011] Step 4: Input the welding image to be classified and recognized into the trained CNN image recognition and classification model, and through model inference, obtain the defect category to which the welding image belongs.
[0012] Further, the said Step 2 includes:
[0013] The CNN image recognition and classification model with feature fusion includes a data feature fusion layer, a first pooling layer, a deep feature fusion layer, a second pooling layer, a feature abstract representation layer, a third pooling layer, a feature high-level representation layer, a fourth pooling layer, a first fully connected layer, a second fully connected layer, a third fully connected layer, and a Softmax layer connected in sequence;
[0014] Data feature fusion layer:
[0015] After the original welding image is input, multiple parallel convolution operations are performed to extract features of different scales. By integrating the features of different channels, the expression ability of the model for the defect area is enhanced. The network not only extracts deep convolution features but also strengthens the main features of welding defects, enabling subsequent layers to more accurately identify and classify different types of welding defects; the features of different scales include edges and textures;
[0016] First pooling layer:
[0017] Perform max pooling on the feature map generated by the data feature fusion layer to reduce the spatial dimension of the feature map;
[0018] Deep feature fusion layer:
[0019] The pooled feature map is further fused, integrating the information of different channels, and using cross-layer connection or channel attention mechanism to enhance the feature expression ability, enabling the model to capture the morphology and structure of welding defects;
[0020] Second pooling layer:
[0021] Perform a pooling operation on the output of the deep feature fusion layer while retaining the main features;
[0022] Feature abstract representation layer:
[0023] Perform global average pooling or other dimensionality reduction strategies on the pooled deep feature map to extract global context information and further compress the feature representation;
[0024] Third pooling layer:
[0025] Perform a pooling operation again to remove redundant information and ensure that only the most representative defect features are retained;
[0026] Feature high-level representation layer:
[0027] Further refine the high-level semantic features through non-linear transformation and feature compression, so that different types of welding defects can be more accurately distinguished;
[0028] Fourth pooling layer:
[0029] Further reduce the feature dimension;
[0030] First fully connected layer, second fully connected layer and third fully connected layer:
[0031] Flatten the high-level features after pooling and successively learn the high-dimensional mapping relationship through multiple fully connected layers to improve the classification performance;
[0032] Softmax layer:
[0033] The final output of the third fully connected layer calculates the probability distribution of each category through the Softmax layer, and finally outputs the defect category to which the welding image belongs, realizing automatic defect recognition.
[0034] Furthermore, the step 3 includes:
[0035] The CNN image recognition and classification model uses the cross-entropy loss function as the objective function. In the welding defect recognition task, the output of the CNN image recognition and classification model is the probability distribution of each defect category, and the cross-entropy loss function guides the CNN image recognition and classification model to gradually optimize the parameters by calculating the matching degree between the predicted probability and the true label, and performs regularization processing based on the optimized parameters to make the network finally converge and obtain the trained CNN image recognition and classification model.
[0036] Furthermore, the definition of the cross-entropy loss function is:
[0037] Let the true class label of each training sample in the training set be y, and the output of the CNN image recognition and classification model be the probability distribution p of the class; if y is the true label vector of One-hot encoding, then the cross-entropy loss function is defined as:
[0038]
[0039] where N is the number of batch samples, C is the number of classification categories, y ij represents the true label value of the i-th training sample in the j-th class; p ij represents the predicted probability that the i-th sample is classified as the j-th type of welding defect, and the class labels include pores, slag, and burn-through, and the calculation method is:
[0040]
[0041] Among them, z ij is the network output before the Softmax activation function, that is, the logit value of the i-th sample in the target class j, and z ik is the logit value of the i-th sample in any class k.
[0042] Furthermore, the objective of the cross-entropy loss function is to minimize the difference between the predicted distribution p and the true distribution y of the CNN image recognition and classification model; when the predicted probability p of the CNN image recognition and classification model ij gets closer to the label value y of the true class ij , that is, when p ij →1, the corresponding loss value -log(p ij )→0; conversely, when p ij →0, the loss value tends to infinity.
[0043] Furthermore, the optimization parameters of the CNN image recognition and classification model include:
[0044] Through the backpropagation algorithm, the CNN image recognition and classification model updates the parameters using the Adam optimizer, and its parameter update formula is:
[0045]
[0046] Among them, θ t represents the model parameters at the t-th iteration; θ t+1 represents the model parameters after the t-th iteration; η represents the learning rate; m t and v t are the first-order momentum estimate and second-order momentum estimate of the gradient respectively; ε is a constant.
[0047] Furthermore, the regularization process based on the optimized parameters includes:
[0048] The expression of regularization is:
[0049]
[0050] Among them, λ is the weight of the regularization strength, ||θ|| 2 is the L2 norm of the model parameters, and L total is the total loss function, and L is the cross-entropy loss function.
[0051] Furthermore, step 4 includes: after inputting the welding image to be classified into the trained CNN image recognition and classification model, the Softmax classification layer normalizes the extracted features and outputs the probability distribution of the sample belonging to each defect category, where the probability value p ijIt represents the predicted probability that the i-th sample is classified as the j-th type of welding defect, and the category corresponding to the maximum probability value is selected as the final defect classification result.
[0052] This application also discloses a welding defect classification system based on deep learning for implementing the above-mentioned welding defect classification method based on deep learning, which includes:
[0053] A preprocessing module, which is used to collect welding images and use them as training samples in the training set, and preprocess the welding images in the training set;
[0054] A model construction module, which is used to construct a CNN image recognition and classification model with feature fusion;
[0055] A model training module, which is used to train the CNN image recognition and classification model with training samples to obtain a trained CNN image recognition and classification model;
[0056] A defect classification module, which is used to input the welding image to be classified and recognized into the trained CNN image recognition and classification model, and through model inference, obtain the defect category to which the welding image belongs.
[0057] Due to the adoption of the above technical solutions, this application has the following advantages:
[0058] 1. In the CNN architecture of this application, a deep feature fusion mechanism is proposed for cross-layer integration of features at different depths. By combining low-level and high-level features, the network can simultaneously maintain detail information and abstract information, thereby improving the robustness and accuracy of defect recognition. The fusion of low-level features (edges, textures) and high-level features (shapes, defect positions, etc.) ensures a complete representation of welding defects. The fusion technology of low-level features and high-level features ensures the effective integration and representation of deep features.
[0059] 2. This application introduces an adaptive feature weighting mechanism, which allows the model to dynamically weight the extracted features between different convolutional layers. During the model training process, the network can learn the weighting coefficients of features at different levels, and weight and fuse them according to the importance of each layer of features, thereby improving the recognition ability of key features. In the deep neural network, an adaptive weighting strategy is used to weight and fuse the output features of different convolutional layers.
[0060] 4. By adopting a deep convolutional neural network and a feature fusion mechanism, this application significantly improves the accuracy and efficiency of welding defect classification. The multi-level convolutional neural network can automatically extract detailed features and abstract features from welding images, avoiding the dependence on manually designed features in traditional methods. In complex welding images, especially in scenarios of micro-defects and multi-class defects, this application demonstrates higher accuracy and robustness, effectively solving the deficiencies of traditional methods in recognition accuracy and generalization ability.
[0061] In addition, by combining multi-scale convolutional kernel parallel feature extraction and pooling operations, the computational load of the model is significantly optimized, the processing speed is improved, and the requirements for real-time detection in industrial fields are met. The feature fusion mechanism further integrates low-level and high-level feature information, enabling the model to comprehensively capture complex patterns in welding images and reducing errors caused by external interferences such as illumination and noise. This innovative design ensures the stability and applicability of this application in complex industrial environments.
[0062] 5. This application uses deep learning technology to achieve automatic welding defect classification, completing feature extraction and classification tasks without manual intervention, simplifying the operation process, and improving the detection efficiency. At the same time, through optimized training methods and learning rate adjustment strategies, the convergence speed and classification performance of the model are enhanced, reducing development and operation costs, and having broad industrial application value. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the technical solutions in the embodiments of this application, the following will briefly introduce the drawings required for description in the embodiments. Obviously, the drawings described below are only some embodiments recorded in the embodiments of this application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.
[0064] Figure 1 is a schematic diagram of image preprocessing in the prior art;
[0065] Figure 2 is a schematic diagram of the model training process architecture in the prior art;
[0066] Figure 3 is a schematic flowchart of a method for welding defect classification based on deep learning in an embodiment of this application;
[0067] Figure 4 is a schematic diagram of the overall framework of the CNN image recognition and classification model in an embodiment of this application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0068] The present application will be further described in conjunction with the accompanying drawings and embodiments. The described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art shall fall within the scope of protection of the embodiments of the present application.
[0069] The present application aims to solve the key technical problems existing in traditional welding defect detection methods, including low defect recognition accuracy, limitations in feature extraction, and poor real-time performance. Existing methods usually rely on manually designed features and traditional machine learning algorithms, and it is difficult to adapt to the complexity and diversity of welding defect morphologies. Especially when facing situations such as blurred boundaries and large texture variations, the accuracy of detection and classification significantly decreases. Moreover, traditional methods have low computational efficiency and cannot meet the real-time requirements of defect detection in industrial fields. Therefore, referring to Figure 3 , the present application provides an embodiment of a welding defect classification method based on deep learning, which includes:
[0070] S1: Collect welding images and use them as training samples in the training set, and preprocess the welding images in the training set.
[0071] Input the welding image into the system through a camera, vision sensor, or other devices as the input data of the classification system. Subsequently, preprocess the image, including denoising, normalization, and grayscale conversion, to eliminate noise and unnecessary interference in the image, improve the quality of the image, and ensure the accuracy of subsequent processing.
[0072] S2: Construct a CNN image recognition and classification model with feature fusion.
[0073] Referring to Figure 4 , the CNN image recognition and classification model with feature fusion includes a data feature fusion layer, a first pooling layer, a deep feature fusion layer, a second pooling layer, a feature abstraction representation layer, a third pooling layer, a feature high-level representation layer, a fourth pooling layer, a first fully connected layer, a second fully connected layer, a third fully connected layer, and a Softmax layer connected in sequence; integrate features at different levels through a multi-stage feature fusion mechanism. The welding image is subjected to feature extraction and processing through a convolutional neural network (CNN), and the specific process is as follows:
[0074] Data feature fusion layer:
[0075] After the original welding image is input, multiple parallel convolutional operations are performed to extract features at different scales, such as basic information like edges and textures. By integrating features from different channels, the expression ability of the model for defect regions is enhanced, providing a basis for subsequent feature extraction. In this process, the network not only extracts deep convolutional features but also strengthens the main features of welding defects, enabling subsequent layers to more accurately identify and classify different types of welding defects.
[0076] The first pooling layer:
[0077] Perform max pooling (2×2, stride 2) on the feature map generated by the data feature fusion layer to reduce the spatial dimension of the feature map, reduce the computational amount, and at the same time improve the translational invariance of the features.
[0078] The deep feature fusion layer:
[0079] The pooled feature map is further fused to integrate information from different channels, and the cross-layer connection or channel attention mechanism is used to enhance the feature expression ability, enabling the model to more effectively capture the morphology and structure of welding defects.
[0080] The second pooling layer:
[0081] Perform a pooling operation on the output of the deep feature fusion layer to reduce the data dimension, retain the main features at the same time, and improve the computational efficiency.
[0082] The feature abstract representation layer:
[0083] Perform global average pooling (GAP) or other dimensionality reduction strategies on the pooled deep feature map to extract global context information, further compress the feature representation, and improve the computational efficiency.
[0084] The third pooling layer:
[0085] Perform a pooling operation again to remove redundant information, ensure that only the most representative defect features are retained, and prepare for the subsequent classification task.
[0086] The feature high-level representation layer:
[0087] Further refine the high-level semantic features through non-linear transformation (such as ReLU) and feature compression (such as 1×1 convolution), so that different types of welding defects can be more accurately distinguished.
[0088] The pooling layer:
[0089] Further reduce the feature dimension, improve the computational efficiency, and make the classification task more robust.
[0090] The first fully connected layer, the second fully connected layer, the third fully connected layer:
[0091] After flattening the pooled high-level features, sequentially pass through multiple fully connected layers to learn the high-dimensional mapping relationship, improve the classification performance, and enable the model to better understand the complex patterns of defects.
[0092] The Softmax layer:
[0093] The final output of the fully connected layer calculates the probability distribution of each category through the Softmax layer, and finally outputs the defect category to which the welded image belongs, realizing automatic defect recognition.
[0094] S3: Use the training samples in S1 to train the CNN image recognition and classification model in S2 to obtain a trained CNN image recognition and classification model.
[0095] Iteratively train until the network converges to obtain a trained CNN image recognition and classification model. In this application, the experimental equipment in training uses a single NVIDIA V100 32G, and the deep learning framework is PyTorch. During the training process, it is trained through the Adam optimizer, and the initial learning rate is set to 3×10 -4 , and then gradually decreases to 2×10 through exponential decay -7 .
[0096] The CNN image recognition and classification model uses the Cross-Entropy Loss function as the objective function. The cross-entropy loss function is a loss function commonly used in multi-class classification tasks and can effectively measure the difference between the predicted output of the model and the true label. In the welding defect recognition task, the output of the model is the probability distribution of each defect category, and the cross-entropy loss function guides the model to gradually optimize the parameters by calculating the matching degree between the predicted probability and the true label.
[0097] Let the true class label of each sample in the training set be y, and the output of the model be the probability distribution p of the class. If y is the true label vector encoded in One-hot, then the cross-entropy loss function is defined as:
[0098]
[0099] where N is the number of batch samples, C is the number of classification categories, and y ij represents the true label value of the i-th sample in the j-th class (One-hot encoded as 0 or 1); p ij represents the predicted probability that the i-th sample belongs to the j-th class, and the calculation method is:
[0100]
[0101] where z ij is the network output before the Softmax activation function, that is, the logit value of the model.
[0102] The goal of the cross-entropy loss function is to minimize the difference between the predicted distribution p of the model and the true distribution y. When the predicted probability p of the model ij gets closer to the label value y of the true class ij , that is, pij → 1, the corresponding loss value -log(pi j ) → 0. Conversely, when p ij → 0, the loss value tends to infinity, strongly penalizing the incorrect classification result.
[0103] Through the Backpropagation algorithm, the model updates the parameters using the Adam optimizer. The Adam optimizer combines the advantages of momentum gradient descent and RMSProp, and its parameter update formula is as follows:
[0104]
[0105] where, θ t represents the model parameters at the t-th iteration; η represents the learning rate; m t and v t are the first-order momentum estimate and second-order momentum estimate of the gradient respectively; ε is a small constant used to avoid the case of a zero denominator.
[0106] In this application, the gradual decay of the learning rate enables the training process to converge quickly, and at the same time stabilize near the optimal point in the later stage, avoiding oscillations caused by excessive parameter updates.
[0107] Using the cross-entropy loss function can effectively optimize the classification model, enabling the model to maximize the prediction probability of the correct class and minimize the prediction probability of the incorrect class during the training process. In the welding defect classification task, the cross-entropy loss function can guide the model to focus on the most important features and improve the classification accuracy.
[0108] This application effectively prevents the model from overfitting to the training data by introducing the regularization technique Dropout and the learning rate decay strategy, combined with the cross-entropy loss function. The mathematical form of regularization can be expressed as:
[0109] L total = L + λ·||θ|| 2
[0110] where, λ is the weight of the regularization strength, and ||θ|| 2 is the L2 norm of the model parameters.
[0111] In the inference stage, the model outputs the probability distribution of each class through the Softmax layer. The probability value p ij represents the confidence of the model that the sample belongs to the j-th class.
[0112] S4: Input the welding image to be classified and recognized into the trained CNN image recognition and classification model, and through model inference, obtain the defect category to which the welding image belongs.
[0113] The welding image to be classified and recognized is used as the input of the trained CNN image recognition and classification model. Through model inference, the classification of the defect type is obtained. During the model training process of this application, it is optimized through the cross-entropy loss function. Finally, the performance of the model is evaluated by calculating multiple evaluation indicators such as the classification accuracy, precision, recall rate, and F1-score of the model on the validation set and the test set. Through these indicators, the performance of the model in the welding defect classification task can be comprehensively evaluated to ensure that the model can achieve efficient and accurate defect recognition effects in practical applications.
[0114] This application can effectively improve the defect recognition accuracy, optimize the feature extraction process, and ensure the real-time detection ability to meet the requirements of efficient and precise welding quality control in industrial sites.
[0115] This application also provides an embodiment of a welding defect classification system based on deep learning for implementing the welding defect classification method based on deep learning described in the above embodiment, which includes:
[0116] A preprocessing module for collecting welding images and using them as training samples in the training set, and preprocessing the welding images in the training set;
[0117] A model construction module for constructing a CNN image recognition and classification model with feature fusion;
[0118] A model training module for training the CNN image recognition and classification model with training samples to obtain a trained CNN image recognition and classification model;
[0119] A defect classification module for inputting the welding image to be classified and recognized into the trained CNN image recognition and classification model, and obtaining the defect category to which the welding image belongs through model inference.
[0120] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit them. Although this application has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: modifications or equivalent replacements can still be made to the specific implementation manners of this application, and any modification or equivalent replacement that does not deviate from the spirit and scope of this application shall be covered by the protection scope of the claims of this application.
Claims
1. A welding defect classification method based on deep learning, characterized in that: include: Step 1: Collect welding images and use them as training samples in the training set, and preprocess the welding images in the training set; Step 2: Construct a CNN image recognition and classification model with feature fusion; Step 3: Use the training samples in step 1 to train the CNN image recognition and classification model in step 2 to obtain a trained CNN image recognition and classification model; Step 4: Input the welding image to be classified and identified into the trained CNN image recognition and classification model, and obtain the defect category to which the welding image belongs through model reasoning.
2. The welding defect classification method based on deep learning according to claim 1 is characterized in that: The step 2 comprises: The feature-fused CNN image recognition and classification model includes a data feature fusion layer, a first pooling layer, a deep feature fusion layer, a second pooling layer, a feature abstract representation layer, a third pooling layer, a feature high-level representation layer, a fourth pooling layer, a first fully connected layer, a second fully connected layer, a third fully connected layer and a Softmax layer connected in sequence; Data feature fusion layer: After the original welding image is input, multiple parallel convolution operations are performed to extract features of different scales. By integrating the features of different channels, the model's ability to express defect areas is enhanced. The network not only extracts deep convolution features, but also strengthens the main features of welding defects, so that subsequent layers can more accurately identify and classify different types of welding defects. Features of different scales include edges and textures. First pooling layer: Perform maximum pooling on the feature map generated by the data feature fusion layer to reduce the spatial dimension of the feature map; Deep feature fusion layer: The pooled feature maps are further fused to integrate information from different channels, and the cross-layer connection or channel attention mechanism is used to enhance the feature expression capability, so that the model can capture the morphology and structure of welding defects; Second pooling layer: Pooling operation is performed on the output of the deep feature fusion layer while retaining the main features; Feature abstract representation layer: Perform global average pooling or other dimensionality reduction strategies on the pooled deep feature map to extract global context information and further compress the feature representation; The third pooling layer: Perform the pooling operation again to remove redundant information and ensure that only the most representative defect features are retained; Feature high-level representation layer: High-level semantic features are further refined through nonlinear transformation and feature compression, so that different types of welding defects can be distinguished more accurately; Fourth pooling layer: Further reduce the feature dimension; The first fully connected layer, the second fully connected layer and the third fully connected layer: The high-level features after flattening and pooling are sequentially passed through multiple fully connected layers to learn high-dimensional mapping relationships to improve classification performance; Softmax layer: The final output of the third fully connected layer calculates the probability distribution of each category through the Softmax layer, and finally outputs the defect category to which the welding image belongs, realizing automatic defect recognition.
3. The welding defect classification method based on deep learning according to claim 1 is characterized in that: The step 3 comprises: The CNN image recognition and classification model uses the cross entropy loss function as the objective function. In the welding defect recognition task, the output of the CNN image recognition and classification model is the probability distribution of each defect category. The cross entropy loss function guides the CNN image recognition and classification model to gradually optimize the parameters by calculating the matching degree between the predicted probability and the true label. Regularization is performed based on the optimized parameters so that the network finally converges to obtain a trained CNN image recognition and classification model.
4. The welding defect classification method based on deep learning according to claim 3 is characterized in that: The cross entropy loss function is defined as: Assume that the true category label of each training sample in the training set is y, and the output of the CNN image recognition and classification model is the probability distribution p of the category; if y is the true label vector encoded by One-hot, then the cross entropy loss function is defined as: Where N is the number of batch samples, C is the number of classification categories, and y ij represents the true label value of the i-th training sample in the j-th category; p ij It represents the predicted probability that the i-th sample is classified as the j-th welding defect. The category labels include porosity, slag, and weld penetration. The calculation method is: Among them, z ij is the network output before the Softmax activation function, i.e., the logit value of the i-th sample in the target category j, z ik is the logit value of the ith sample in any category k.
5. The welding defect classification method based on deep learning according to claim 4 is characterized in that: The goal of the cross entropy loss function is to minimize the difference between the predicted distribution p of the CNN image recognition and classification model and the true distribution y; when the predicted probability p of the CNN image recognition and classification model ij The closer to the true category label value y ij , that is, p ij →1, the corresponding loss value is -log(pi j )→0; on the contrary, when p ij →0, the loss value tends to infinity.
6. The welding defect classification method based on deep learning according to claim 3 is characterized in that: The CNN image recognition and classification model optimization parameters include: Through the back propagation algorithm, the CNN image recognition and classification model uses the Adam optimizer to update the parameters, and its parameter update formula is: Among them, θ t represents the model parameters of the tth iteration; θ t+1 represents the model parameters after the tth iteration; η represents the learning rate; m t and v t are the first-order momentum estimate and the second-order momentum estimate of the gradient respectively; ε is a constant.
7. The welding defect classification method based on deep learning according to claim 6 is characterized in that: The regularization processing based on the optimized parameters includes: The regularized expression is: Among them, λ is the weight of regularization strength, ||θ|| 2 is the L2 norm of the model parameters, L total is the total loss function and L is the cross entropy loss function.
8. The welding defect classification method based on deep learning according to claim 1 is characterized in that: The step 4 includes: after the welding image to be classified is input into the trained CNN image recognition and classification model, the extracted features are normalized through the Softmax classification layer, and the probability distribution of the sample belonging to each defect category is output, where the probability value p ij It represents the predicted probability that the i-th sample is classified as the j-th welding defect, and the category corresponding to the maximum probability value is selected as the final defect classification result.
9. A welding defect classification system based on deep learning, used to implement the welding defect classification method based on deep learning according to any one of claims 1 to 8, characterized in that: include: A preprocessing module is used to collect welding images and use them as training samples in a training set, and to preprocess the welding images in the training set; Model building module, used to build feature fusion CNN image recognition and classification model; A model training module is used to train the CNN image recognition and classification model using training samples to obtain a trained CNN image recognition and classification model; The defect classification module is used to input the welding image to be classified and identified into the trained CNN image recognition and classification model, and obtain the defect category to which the welding image belongs through model reasoning.
Citation Information
Patent Citations
Fine-grained image classification method based on attention transfer mechanism
CN110598029A
Industrial welding image defect detection method based on target detection
CN111681231A
Small sample image defect target detection method based on self-supervised pre-training
CN116994047A
Weld defect identification method based on visual Transform
CN119313639A
Welding defect image preprocessing method based on multi-scale feature fusion
CN120236173A
Cited By
State detection and online learning method for laser welding manufacturing
CN120877020A
A state detection and online learning method for laser welding manufacturing
CN120877020B
Feature extraction-based foreign matter invasion detection method and system in rail transit clearance
CN121582597A
Laser welding defect identification method and device, electronic equipment and storage medium
CN121600304A
Laser welding defect identification method and device, electronic equipment and storage medium
CN121600304B