Visual inspection method for welding quality of lithium battery pole
By constructing a visual detection model, using the STDCNet network and the pyramid pooling module to extract features, and combining data expansion and loss function adjustment, the problems of low accuracy and insufficient generalization capabilities in the welding quality detection of lithium battery pole are solved, and efficient and accurate detection results are achieved.
Patent Information
- Application Number
- CN202510187112.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-20
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2045-02-20
AI Technical Summary
The prior art has problems in the quality inspection of electrode column welding of lithium batteries with low detection accuracy, insufficient generalization adaptability, slow detection speed, and large samples required.
A visual detection method is adopted, including obtaining the electrode column welding images and pixel-level annotated images of lithium battery, building a sample set, and extracting features through the STDCNet network, designing a pyramid pooling module and attention fusion module, combining data expansion and loss function adjustment, and training a visual detection model to achieve high-precision detection.
It improves the accuracy and speed of electrode column welding quality detection of lithium battery, enhances the generalization adaptability of detection, reduces the dependence on sample number, and achieves more efficient and accurate defect identification.
Smart Images

Figure CN119672023A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of welding defect detection, and in particular to a visual detection method for the welding quality of a lithium battery pole. Background Art
[0002] As a high-energy-density energy storage device, lithium batteries play a vital role in new energy vehicles, portable electronic devices, and large-scale energy storage systems. As a key link in the lithium battery assembly process, lithium battery pole welding is directly related to the safety, reliability, and electrical performance of the battery. The quality of lithium battery welding not only affects the stability of the battery's electrical connection, but also determines the battery's sealing and thermal stability during the cyclic charge and discharge process, which in turn affects the service life and safety of the entire battery system.
[0003] In the manufacturing process of lithium batteries, the welding process of the pole (usually the metal part where the positive and negative electrodes are connected) faces many challenges. Minor defects in the welding area, such as incomplete fusion, pores, cracks, etc., may become the risk source of internal short circuit or leakage of the battery. Therefore, strict non-destructive testing of the pole welding quality is crucial to ensure that each battery can meet the established quality standards and safety requirements.
[0004] Traditionally, the inspection of lithium battery pole welding quality relies on manual visual inspection, but this method is greatly affected by the experience, fatigue and subjective judgment of the inspectors, making it difficult to achieve high-precision and high-efficiency defect identification. In view of this, the use of advanced visual inspection technology, especially vision-based automatic inspection methods, has become an inevitable trend to improve inspection efficiency and accuracy.
[0005] However, due to the reflection characteristics of the material, welding sparks and the complexity of the surrounding light, the original images of the lithium battery pole welding parts often have problems such as low contrast and blurred details, which brings great difficulties to quality inspection and defect identification.
[0006] To address this problem, existing detection technologies, such as defect detection methods based on multi-thresholds and support vector machines, and defect detection methods based on convolutional neural networks, can detect welding quality and welding defects to a certain extent, but they have limitations in practical applications. For example, although multi-threshold methods can highlight certain features, they often need to set different thresholds for different defects, and the parameters are difficult to adjust. In addition, the generalization ability of the same defect under different light source conditions is very weak, making it difficult to apply in practice. Most defect detection methods based on convolutional neural networks generally lose a lot of image details due to excessive downsampling for large-resolution images of industrial cameras in practice (generally 500W pixels to 5000W pixels), resulting in insufficient detection capabilities and long detection time. In addition, there is also the limitation of requiring a large number of defective samples.
[0007] Therefore, in order to solve the above problems, a visual inspection method for the welding quality of lithium battery poles is provided. Summary of the invention
[0008] The purpose of the present invention is to overcome the existing defects and provide a visual inspection method for the welding quality of lithium battery poles, which solves the shortcomings of the prior art such as low inspection accuracy, insufficient generalization adaptability, slow inspection speed and large number of samples required.
[0009] The technical solution to achieve the above purpose is: A method for visually inspecting the welding quality of a lithium battery pole, comprising: Step S1, obtaining a lithium battery pole welding image and a pixel-level annotated image corresponding to each welding image to form a sample set, wherein 80% of the samples are selected as a training sample set train, and the remaining samples are selected as a test sample set val; Step S2, preprocessing the training sample set train; Step S3, building a visual inspection model; Step S4, training the constructed visual detection model, saving the training weight file of the visual detection model, and generating the visual detection model; Step S5, inputting the lithium battery pole welding images to be tested into the trained visual inspection model to obtain a segmentation result map, and processing the segmentation result map to obtain a semantic segmentation region result map; Step S6, post-processing the obtained semantic segmentation region result map, processing the internal mixing and filtering of too small pixels in the segmentation, and obtaining the final semantic segmentation type region result map.
[0010] Preferably, in step S2, preprocessing the training sample set train includes: Calculate the frequency of the training sample set train category And normalized to frequency: ; ; In the formula, is the class number, For the sample, is the pixel distribution of the statistical sample, is the set of corresponding pixel numbers of all types, is the set converted into frequency; Calculate the reverse frequency of the training sample set train : ; Set the reverse frequency to the given parameter Perform Softmax normalization and smoothing weights: ; In the formula, is the coefficient that affects the smoothness of weight distribution, is the normalized and smoothed weight set; Based on the above parameters, calculate the parameters , calculate the minimum width of the labeled samples and height , calculate the number of categories in the labeled samples, including background cls: , multiple types of ; Among them, the calculation parameters The formula is as follows: ; In the formula, For Category The frequency, is the total number of categories, is the maximum value among all category frequencies; First Magnify 10000 times and round up to maintain a certain accuracy, then restore to the original scale and limit the minimum value to 0.001, and then get the parameter ; Calculate the mean and standard deviation of the image channels in the dataset, perform mixed augmentation such as flipping, random rotation, random scaling, saturation, and random Gaussian noise on the images in the training sample set train, and automatically generate corresponding annotations. Merge the processed images with train into the training dataset train1.
[0011] Preferably, in step S3, constructing a visual detection model includes: The backbone network that extracts features through the STDCNet network; The feature maps are pooled at different scales through the pyramid pooling module, and then the pooled features are spliced or fused, including: The pyramid pooling module contains three global average pooling operations, with corresponding pooling kernel sizes of 1×1, 2×2, and 4×4. The convolution operation uses a 1×1 convolution kernel, the number of output channels is less than the number of input channels, the upsampled features are added, and a 3×3 convolution operation is used to generate fine features; Design a decoder where the three layers of the network gradually increase the spatial size of the feature map while gradually reducing the number of feature channels; Design an attention fusion module and use the channel attention mechanism to generate a weight matrix , and multiply the input features by the weight matrix, and obtain the fused feature map after weighting, that is: ; ; In the formula, For AvgPool( ),MaxPool( ),AvgPool( ),MaxPool( ) The concatenation of feature maps, is the convolution operation, For Upsampling of is the feature map of the convolutional layer, It is the high-order semantic feature map after the corresponding pyramid pooling module operation and the high-order semantic feature map after the attention fusion module; Design loss function, considering that the majority of lithium battery welding images are negative samples, loss function Designed for: The binary cross entropy loss is modified to a multi-category loss with weighted types: ; In the formula, is the total number of categories, For the Class target distribution, is the first Probability of class; Furthermore, in order to deal with the excessive background proportion of lithium battery pole welding images, which belongs to the extremely unbalanced samples, in order to reduce the proportion of background pixels in the calculation and further reduce the amount of calculation, only the loss of part of the samples is calculated. The loss adjustment is: ; ; ; In the formula, Pixel The predicted probability of belonging to the target class, is the total number of pixels in the image; Considering the imbalance between samples, the loss function Using Lovaszloss: ; In the formula, Preprocess the training sample set train to obtain the task type cls, is a normalization constant, indicating the category The total number of pixels, For Category The effective pixel set, For Category The IoU gradient changes, For Category The sorting error of The final loss function is calculated as: ; In the formula, for Hyperparameters of Evaluation indicators are designed. There are huge sample imbalance and small target problems in the lithium battery pole welding image dataset. The indicators use a mixed indicator of t= 0.4*mIOU and 0.6*DICE to obtain a visual inspection model.
[0012] Preferably, in step S4, training the constructed visual inspection includes: Use the welding images and their corresponding label images in the training sample set train1 after data expansion; The preprocessing uses the mean and standard deviation of the image channels in the dataset for normalization, and adopts the stochastic gradient descent method, learning rate warm-up, and iterative training respectively; During the iterative training process, each iteration After that, the trained visual detection model is used to verify the test sample set val; When the index is greater than When the time comes, the training is stopped and the visual detection model parameters are saved, thereby completing the training of the visual detection model; in, Save cycles for model evaluation, For reference accuracy.
[0013] Preferably, in step S6, the segmentation internal mixing and too small pixel filtering are processed as follows: According to the distribution of types detected in the pole welding image, the segmentation result image is expanded and closed using kernels of two sizes; Region growing is used to expand the remaining small regions, and label propagation is used to smooth region boundaries and eliminate confusion between labels.
[0014] The beneficial effects of the present invention are: 1) In the process of data preprocessing, the present invention automatically expands the data, automatically generates corresponding annotations, and automatically calculates the distribution of the data set, including weights and the number of pixels participating in the loss function calculation. The clarity, contrast and chromaticity of the images in some training sample sets are randomly changed to expand the sample size, which helps to improve the generalization performance of the segmentation network. 2) In the process of visual detection model design, the backbone network of feature extraction uses the STDCNet backbone network. Compared with the commonly used Resnet or HRnet, the network has a lower computational complexity and can effectively extract spatial and temporal information, thereby improving the feature representation capability, and actually verifies that the segmentation result of the lithium electrode column welding image has not been reduced; in the decoder part, the feature map is pyramid pooled, and then the pooled features are spliced or fused, which deepens the fusion of semantic information at different scales to obtain more comprehensive semantic information. Compared with most spatial pyramid fusions, only average pooling and maximum pooling are used to further reduce the amount of calculation. A 1×1 convolution layer and an activation function are used on the spliced feature map to reduce the number of channels of the feature map and increase nonlinear transformation. This can further reduce the amount of calculation and improve the ability to express features. The lightweight decoder gradually increases the spatial size of the feature map while gradually reducing the number of feature channels, reducing the redundancy of the decoder. The attention module fuses the feature map of low-level semantic information with the feature map of high-level semantic information, allowing the module to calculate the weights of the two feature maps, and then add them together. The effect is better than most methods that directly add the feature maps. 3) The present invention processes the semantic segmentation map obtained on the test image to filter out internal confusion and too small pixels, fills the holes in the semantic segmentation map using morphological erosion and morphological dilation operations, smoothes the region boundaries with label propagation and eliminates confusion between labels, and finally uses a polygon chain approximation algorithm to simplify the visualization of the results of pole welding inspection of large objects; 4) Through a series of processing, the present invention makes it possible to greatly reduce manual intervention and improve the stability of the method by automatically calculating the statistics of the image data set, which makes the method easier to use in actual scenarios. In summary, the present invention not only meets the requirements of lithium battery welding quality inspection and has a high defect detection accuracy, but also has a fast detection speed and is easy to apply and expand in lithium battery pole welding quality inspection. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 It is a flow chart of a method for visually inspecting the welding quality of a lithium battery pole according to the present invention; Figure 2 It is a structural diagram of the visual detection model design in the present invention; Figure 3 is a structural diagram of the channel attention module in the visual detection model of the present invention; Figure 4 It is another structural diagram of the channel attention module in the visual detection model of the present invention. DETAILED DESCRIPTION
[0016] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. In the description of the present invention, it should be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside" and the like indicate directions or positional relationships based on the directions or positional relationships shown in the accompanying drawings, which are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as a limitation on the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance.
[0017] The present invention will be further described below in conjunction with the accompanying drawings.
[0018] like Figure 1 As shown, a visual inspection method for the welding quality of a lithium battery pole includes: Step S1, obtaining lithium battery pole welding images and pixel-level annotated images corresponding to each welding image to form a sample set, wherein 80% of the samples are selected as a training sample set train, and the remaining samples are selected as a test sample set val.
[0019] Step S2: preprocessing the training sample set train.
[0020] In the embodiment, preprocessing the training sample set train includes: Calculate the frequency of the training sample set train category And normalized to frequency: ; ; In the formula, is the class number, For the sample, is the pixel distribution of the statistical sample, is the set of corresponding pixel numbers of all types, is the set converted into frequency; Calculate the reverse frequency of the training sample set train : ; Set the reverse frequency to the given parameter Perform Softmax normalization and smoothing weights: ; In the formula, is the coefficient that affects the smoothness of weight distribution, is the normalized and smoothed weight set; Based on the above parameters, calculate the parameters , calculate the minimum width of the labeled samples and height , calculate the number of categories in the labeled samples, including background cls: , multiple types of ; Among them, the calculation parameters The formula is as follows: ; In the formula, For Category The frequency, is the total number of categories, is the maximum value among all category frequencies; First Magnify 10000 times and round up to maintain a certain accuracy, then restore to the original scale and limit the minimum value to 0.001, and then get the parameter ; Calculate the mean and standard deviation of the image channels in the dataset, perform mixed augmentation such as flipping, random rotation, random scaling, saturation, and random Gaussian noise on the images in the training sample set train, and automatically generate corresponding annotations. Merge the processed images with train into the training dataset train1.
[0021] Step S3, build a visual inspection model, such as Figure 2 shown.
[0022] In the embodiment, constructing a visual detection model includes: According to manual setting parameters , whether to use automatic calculation, automatic calculation based on the minimum width and height, and The original image is preprocessed before entering the network and the image is reduced by a certain proportion. and As a parameter, it limits the degree of reduction to ensure that the smallest annotation type can be detected; The backbone network of feature extraction is the STDCNet network. The weights pre-trained on the dataset are used for initialization and adjusted on the private lithium battery pole welding images as the backbone network of the model to extract features. In the lithium battery pole welding, there are small types such as tin slag and welding height. The network is used to extract features to avoid excessive loss of detailed information. The feature maps are pooled at different scales through the pyramid pooling module, and then the pooled features are spliced or fused, including: The pyramid pooling module contains three global average pooling operations, with corresponding pooling kernel sizes of 1×1, 2×2, and 4×4. The convolution operation uses a 1×1 convolution kernel, the number of output channels is less than the number of input channels, the upsampled features are added, and a 3×3 convolution operation is used to generate fine features; Design a decoder where the three-layer network gradually increases the spatial size of the feature map while gradually reducing the number of feature channels, further improving computational efficiency. Design attention fusion module, such as Figure 3 , 4 As shown, using the channel attention mechanism, a weight matrix is generated , and multiply the input features by the weight matrix, and obtain the fused feature map after weighting, that is: ; ; In the formula, For AvgPool( ),MaxPool( ),AvgPool( ),MaxPool( ) The concatenation of feature maps, is the convolution operation, For Upsampling of is the feature map of the convolutional layer, It is the high-order semantic feature map after the corresponding pyramid pooling module operation and the high-order semantic feature map after the attention fusion module; Design loss function, considering that the majority of lithium battery welding images are negative samples (background or pixels that do not need to be detected), loss function Designed for: The binary cross entropy loss is modified to a multi-category loss with weighted types: ; In the formula, is the total number of categories, For the Class target distribution, is the first Probability of class; Furthermore, in order to deal with the excessive background proportion of lithium battery pole welding images, which belongs to the extremely unbalanced samples, in order to reduce the proportion of background pixels in the calculation and further reduce the amount of calculation, only the loss of part of the samples is calculated. The loss adjustment is: ; ; ; In the formula, Pixel The predicted probability of belonging to the target class, is the total number of pixels in the image; Considering the imbalance between samples, the loss function Using Lovaszloss: ; In the formula, Preprocess the training sample set train to obtain the task type cls, is a normalization constant, indicating the category The total number of pixels, For Category The effective pixel set, For Category The IoU gradient changes, For Category The sorting error of The final loss function is calculated as: ; In the formula, for Hyperparameters of Evaluation indicators are designed. There are huge sample imbalance and small target problems in the lithium battery pole welding image dataset. The indicators use a mixed indicator of t= 0.4*mIOU and 0.6*DICE to obtain a visual inspection model.
[0023] Step S4, training the constructed visual detection model, saving the training weight file of the visual detection model, and generating the visual detection model.
[0024] In an embodiment, training the constructed visual inspection includes: Use the welding images and their corresponding label images in the training sample set train1 after data expansion; The preprocessing uses the mean and standard deviation of the image channels in the dataset for normalization, and adopts the stochastic gradient descent method, learning rate warm-up, and iterative training respectively; During the iterative training process, each iteration After that, the trained visual detection model is used to verify the test sample set val; When the index is greater than When the time comes, the training is stopped and the visual detection model parameters are saved, thereby completing the training of the visual detection model; in, Save cycles for model evaluation, For reference accuracy.
[0025] Step S5, inputting the lithium battery pole welding images to be tested into the trained visual inspection model to obtain a segmentation result map, and processing the segmentation result map to obtain a semantic segmentation area result map.
[0026] Step S6, post-processing the obtained semantic segmentation region result map, processing the internal mixing and filtering of too small pixels in the segmentation, and obtaining the final semantic segmentation type region result map.
[0027] In the embodiment, the processing of segmentation internal mixing and filtering of too small pixels is performed as follows: According to the distribution of types detected in the pole welding image, the segmentation result image is expanded and closed using kernels of two sizes; There are two kernel sizes: ; ; Region growing is used to expand the remaining small regions, and label propagation is used to smooth region boundaries and eliminate confusion between labels.
[0028] Multithreading extracts segmentation maps of different categories, with threads for each category being ,Since some inspection items in the lithium battery pole welding image, such as welding smoke, missing welding, and false welding area, are large, the original contour points are large, which is not conducive to the final visualization rendering of the method and the transmission and storage of data. An improved polygon chain approximation algorithm based on Douglas-Peucker is implemented in the paper to simplify polygons or polyline chains, reduce the number of contour points, and keep the original shape as much as possible.
[0029] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions described in the above embodiments may still be modified, or some or all of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for visual inspection of lithium battery pole welding quality, characterized in that: include: Step S1, obtaining a lithium battery pole welding image and a pixel-level annotated image corresponding to each welding image to form a sample set, wherein 80% of the samples are selected as a training sample set train, and the remaining samples are selected as a test sample set val; Step S2, preprocessing the training sample set train; Step S3, building a visual inspection model; Step S4, training the constructed visual detection model, saving the training weight file of the visual detection model, and generating the visual detection model; Step S5, inputting the lithium battery pole welding images to be tested into the trained visual inspection model to obtain a segmentation result map, and processing the segmentation result map to obtain a semantic segmentation region result map; Step S6, post-processing the obtained semantic segmentation region result map, processing the internal mixing and filtering of too small pixels in the segmentation, and obtaining the final semantic segmentation type region result map.
2. A method for visually inspecting the welding quality of a lithium battery pole according to claim 1, characterized in that: In step S2, the training sample set train is preprocessed, including: Calculate the frequency of the training sample set train category And normalized to frequency: ; ; In the formula, is the class number, For the sample, is the pixel distribution of the statistical sample, is the set of corresponding pixel numbers of all types, is the set converted into frequency; Calculate the reverse frequency of the training sample set train : ; Set the reverse frequency to the given parameter Perform Softmax normalization and smoothing weights: ; In the formula, is the coefficient that affects the smoothness of weight distribution, is the normalized and smoothed weight set; Based on the above parameters, calculate the parameters , calculate the minimum width of the labeled samples and height , calculate the number of categories in the labeled samples, including background cls: , multiple types of ; Among them, the calculation parameters The formula is as follows: ; In the formula, For Category The frequency, is the total number of categories, is the maximum value among all category frequencies; First Magnify 10000 times and round up to maintain a certain accuracy, then restore to the original scale and limit the minimum value to 0.001, and then get the parameter ; Calculate the mean and standard deviation of the image channels in the dataset, perform mixed augmentation such as flipping, random rotation, random scaling, saturation, and random Gaussian noise on the images in the training sample set train, and automatically generate corresponding annotations. Merge the processed images with train into the training dataset train1.
3. A method for visually inspecting the welding quality of a lithium battery pole according to claim 2, characterized in that: In step S3, constructing a visual detection model includes: The backbone network that extracts features through the STDCNet network; The feature maps are pooled at different scales through the pyramid pooling module, and then the pooled features are spliced or fused, including: The pyramid pooling module contains three global average pooling operations, with corresponding pooling kernel sizes of 1×1, 2×2, and 4×4. The convolution operation uses a 1×1 convolution kernel, the number of output channels is less than the number of input channels, the upsampled features are added, and a 3×3 convolution operation is used to generate fine features; Design a decoder where the three layers of the network gradually increase the spatial size of the feature map while gradually reducing the number of feature channels; Design an attention fusion module and use the channel attention mechanism to generate a weight matrix , and multiply the input features by the weight matrix, and obtain the fused feature map after weighting, that is: ; ; In the formula, For AvgPool( ),MaxPool( ),AvgPool( ),MaxPool( ) The concatenation of feature maps, is the convolution operation, For Upsampling of is the feature map of the convolutional layer, It is the high-order semantic feature map after the corresponding pyramid pooling module operation and the high-order semantic feature map after the attention fusion module; Design loss function, considering that the majority of lithium battery welding images are negative samples, loss function Designed for: The binary cross entropy loss is modified to a multi-category loss with weighted types: ; In the formula, is the total number of categories, For the Class target distribution, is the first Probability of class; Furthermore, in order to deal with the excessive background proportion of lithium battery pole welding images, which belongs to the extremely unbalanced samples, in order to reduce the proportion of background pixels in the calculation and further reduce the amount of calculation, only the loss of part of the samples is calculated. The loss adjustment is: ; ; ; In the formula, Pixel The predicted probability of belonging to the target class, is the total number of pixels in the image; Considering the imbalance between samples, the loss function Using Lovaszloss: ; In the formula, Preprocess the training sample set train to obtain the task type cls, is a normalization constant, indicating the category The total number of pixels, For Category The effective pixel set, For Category The IoU gradient changes, For Category The sorting error of The final loss function is calculated as: ; In the formula, for Hyperparameters of Evaluation indicators are designed. There are huge sample imbalance and small target problems in the lithium battery pole welding image dataset. The indicators use a mixed indicator of t= 0.4*mIOU and 0.6*DICE to obtain a visual inspection model.
4. A method for visually inspecting the welding quality of a lithium battery pole according to claim 3, characterized in that: In step S4, training the constructed visual inspection includes: Use the welding images and their corresponding label images in the training sample set train1 after data expansion; The preprocessing uses the mean and standard deviation of the image channels in the dataset for normalization, and adopts the stochastic gradient descent method, learning rate warm-up, and iterative training respectively; During the iterative training process, each iteration After that, the trained visual detection model is used to verify the test sample set val; When the index is greater than When the time comes, the training is stopped and the visual detection model parameters are saved, thereby completing the training of the visual detection model; in, Save cycles for model evaluation, For reference accuracy.
5. The visual inspection method for the welding quality of a lithium battery pole according to claim 1, characterized in that: In step S6, the segmentation internal mixing and too small pixel filtering are processed as follows: According to the distribution of types detected in the pole welding image, the segmentation result image is expanded and closed using kernels of two sizes; Region growing is used to expand the remaining small regions, and label propagation is used to smooth region boundaries and eliminate confusion between labels.
Citation Information
Patent Citations
New energy lithium battery surface defect detection method based on adaptive deep learning
CN111105405A
Lithium battery module busbar weld appearance detection algorithm and system
CN114298964A
Image searching method for intelligent mobile terminal
CN117218336A