Appearance defect detection method and system for cylindrical lithium battery
Through the defect detection network based on ResNet, the problems of low detection efficiency and poor generalization ability of lithium battery surface defects are solved, high accuracy and real-time detection are achieved, and the detection needs of the lithium battery production line are met.
Patent Information
- Application Number
- CN202410717205.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-09-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing lithium battery surface defect detection methods have low efficiency and high cost, and traditional machine vision detection methods have poor generalization capabilities and complex calculations, making it difficult to meet real-time requirements.
A defect detection network based on ResNet is used and expanded by obtaining appearance defect image samples of cylindrical lithium batteries. A detection network including a convolution module, ResNet network module, multi-head attention module and fully connected layer is constructed for training and real-time detection.
The accuracy and robustness of surface defect detection of lithium batteries are improved, and real-time and comprehensive detection of various appearance defects of cylindrical lithium batteries is achieved.
Smart Images

Figure CN118587180A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of defect detection, and in particular relates to a method and system for detecting appearance defects of cylindrical lithium batteries. Background Art
[0002] In recent years, with the development and promotion of new energy electric vehicles, the demand for lithium batteries has also increased. The lithium battery industry has risen rapidly, and quality issues in lithium battery production and manufacturing have become a very important part, so lithium battery surface defect detection has become an indispensable step.
[0003] At present, lithium-ion batteries are classified into three types based on the packaging route: soft pack, square and cylindrical. The production process of cylindrical lithium-ion battery packs is mature, the heat dissipation area is large, and its heat dissipation performance is better than that of square batteries; cylindrical lithium batteries are easy to combine in various forms and are suitable for the full layout of electric vehicle space design. However, cylindrical lithium batteries are generally packaged in steel or aluminum shells, and a layer of plastic is added on the outer layer for packaging. During the production process, due to extrusion, collision, foreign matter inclusion, improper material handling and other reasons, it is easy to form concave or convex geometric defects on the surface; leakage and rust defects may occur in various parts of the battery.
[0004] The current methods for detecting surface defects of lithium batteries mainly include manual detection and machine vision detection methods. The main problem with manual detection is that under a large number of detection demands, manual detection is inefficient, time-consuming, and has extremely high labor costs. In addition, due to the limitations of manual detection, many surface defects are easily overlooked when their characteristics are not obvious, resulting in problems such as missed detection and false detection. As a non-contact detection method, optical detection technology based on machine vision has the advantages of fast detection speed, stable and objective results, and no secondary contamination of the object to be detected. However, traditional machine vision detection methods include image structure methods, frequency domain analysis methods, etc., but they all have their limitations. For example, the generalization ability of the image structure method is poor and it is only applicable to specific defect detection situations, while the frequency domain analysis method is complex and time-consuming to calculate, and is not suitable for situations with high real-time requirements. Summary of the invention
[0005] In order to solve the above problems existing in the prior art, the present invention provides a method and system for detecting appearance defects of cylindrical lithium batteries. The technical problem to be solved by the present invention is achieved through the following technical solutions:
[0006] One aspect of the present invention provides a method for detecting appearance defects of a cylindrical lithium battery, comprising:
[0007] S1: Acquire appearance defect image samples of cylindrical lithium batteries, and expand the appearance defect image samples to form a defect training data set;
[0008] S2: constructing a defect detection network based on ResNet and training the defect detection network using the defect training data set to obtain a trained defect detection network, wherein the defect detection network includes a convolution module, a ResNet network module, a multi-head attention module and a fully connected layer connected in sequence, the convolution module is used to obtain preliminary features of the input appearance defect image; the ResNet network module is used to perform residual calculation on the preliminary features, the multi-head attention module is used to capture the relationship between different preliminary features and extract important feature information, and the fully connected layer is used to classify according to the important feature information to obtain defect detection results;
[0009] S3: using an image acquisition module to obtain appearance images of the cylindrical lithium battery to be tested at various angles;
[0010] S4: Inputting the appearance image into the trained defect detection network to obtain a defect detection result.
[0011] In one embodiment of the present invention, the S1 includes:
[0012] S1.1: Collect multiple original defect image samples of the surface of cylindrical lithium batteries, mark the defect information in each original defect sample image, and obtain one or more marked points;
[0013] S1.2: Using one of the marked points as a rotation center point, rotating the other marked points in each of the original defect image samples by a preset angle with the rotation center point as the origin, to obtain a plurality of new defect image samples;
[0014] S1.3: The original defect image sample and the generated multiple new defect image samples are combined to form the defect training data set.
[0015] In one embodiment of the present invention, the S1.2 includes:
[0016] Taking a marked point in the current original defect image sample as the rotation center point, constructing a translation matrix according to the coordinates of the rotation center point; constructing a rotation matrix according to a preset rotation angle; obtaining the coordinates of other marked points after rotation according to the translation matrix, the rotation matrix and the coordinates of other marked points in the current original defect image sample, thereby forming a new defect image sample with new marked point coordinates; taking another marked point in the current original defect image sample as the rotation center point, repeating the rotation of other marked points on the current original defect image sample, and obtaining a new defect image sample generated with different marked points as rotation center points;
[0017] The process is repeated for each original defect image sample to obtain a new defect image sample based on each original defect image sample.
[0018] In one embodiment of the present invention, the step S1.2 further includes:
[0019] Check whether the coordinates of the marked points on the new defect image sample exceed the valid area of the cylindrical lithium battery contour in the image. If so, delete the corresponding marked points in the new defect image sample and incorporate the new defect image sample with the corresponding marked points deleted into the defect training data set; if not, directly incorporate the new defect image sample as new sample data into the defect training data set.
[0020] In one embodiment of the present invention, checking whether the coordinates of the marked points on the new defect image sample exceed the valid area of the cylindrical lithium battery contour in the image includes:
[0021] Performing image grayscale processing and bilateral filtering on the new defect image sample to remove noise in the image;
[0022] Perform edge detection on the grayscale image after bilateral filtering based on image gradient changes to obtain edge pixel points, and then obtain the edge contour of the cylindrical lithium battery in the image;
[0023] It is determined whether the coordinates of the marked points on the new defect image sample exceed the area range of the edge contour of the cylindrical lithium battery.
[0024] In one embodiment of the present invention, the convolution module includes a convolution layer, a batch normalization layer, a ReLU activation layer and a maximum pooling layer connected in sequence;
[0025] The ResNet network module takes the preliminary features obtained by the convolution module as input, and the ResNet network module includes a plurality of first residual blocks, a plurality of second residual blocks, a plurality of third residual blocks and a plurality of fourth residual blocks connected in sequence, each residual block has a different channel number dimension, and each residual block includes a convolution layer, a batch normalization layer, a ReLU activation layer, a Dropout layer, a convolution layer and a batch normalization layer connected in sequence.
[0026] In one embodiment of the present invention, the multi-head attention module is specifically used for:
[0027] The output features from the ResNet network module are respectively combined with the weight matrix W Q ,W K ,W V Multiply them to obtain the projections Q, K, and V of the output features in the three spaces; pass the projections Q, K, and V through different linear layers to obtain the mappings Q of different subspaces i ,K i ,V i , for each set of mappings Q i,K i ,V i Perform attention operations separately to obtain the output Z of each group i ; All output Z i They are spliced together and transformed linearly to obtain the final output result Z.
[0028] In one embodiment of the present invention, the loss function of the defect detection network is:
[0029]
[0030] Among them, y mn is an indicator variable. If the predicted label of the nth sample is the same as the true label, then y mn =1, otherwise y mn =0; p mn It represents the predicted probability that the nth sample belongs to the mth category, ∑ represents the summation operation, N represents the total number of training samples, and M represents the total number of label types.
[0031] In one embodiment of the present invention, S3 includes:
[0032] The cylindrical lithium batteries on the battery production line are collected in real time using an image acquisition module to obtain multiple frames of lithium battery images at different angles for each cylindrical lithium battery. The image acquisition module is a CCD camera.
[0033] Image segmentation processing is performed on each frame of lithium battery image to obtain multiple frames of lithium battery sub-images, wherein each frame of lithium battery sub-image only includes image information of a cylindrical lithium battery.
[0034] Another aspect of the present invention provides a cylindrical lithium battery appearance defect detection system, which is used to perform the appearance defect detection method described in any one of the above embodiments. The appearance defect detection system includes a training data set generation module, a network training module, an image acquisition module and a defect detection module, wherein:
[0035] The training data set generation module is used to obtain appearance defect image samples of cylindrical lithium batteries and expand the appearance defect image samples to form a defect training data set;
[0036] The network training module is used to construct a defect detection network based on ResNet and train the defect detection network using the defect training data set to obtain a trained defect detection network;
[0037] The image acquisition module is used to obtain the appearance images of the cylindrical lithium battery to be tested at various angles. The image acquisition module is a plurality of image acquisition terminal devices with different angles arranged on the battery production line;
[0038] The defect detection module is used to input the appearance image into the trained defect detection network to obtain a defect detection result.
[0039] Compared with the prior art, the present invention has the following beneficial effects:
[0040] 1. The present invention provides a method for detecting appearance defects of cylindrical lithium batteries. By expanding the original image samples, the number of training samples is expanded, and the overfitting phenomenon of the defect detection network model caused by insufficient training samples is avoided, so as to improve the detection effect of the target detection model. A defect detection network based on ResNet is adopted, and a multi-head attention module is added after the ResNet network module, which effectively improves the accuracy of defect detection and improves the robustness and real-time performance of lithium battery surface defect detection.
[0041] 2. The present invention uses an image acquisition module to perform real-time acquisition of cylindrical lithium batteries on a battery production line, photographs the cylindrical lithium batteries to be tested from different angles, and performs appearance defect detection on each part of the cylindrical lithium batteries. It can comprehensively detect a variety of appearance defects on different surfaces of cylindrical lithium batteries, thus completing the overall defect detection of cylindrical lithium batteries.
[0042] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 is a flow chart of a method for detecting appearance defects of a cylindrical lithium battery provided by an embodiment of the present invention;
[0044] Figure 2 is a module schematic diagram of a defect detection network provided by an embodiment of the present invention;
[0045] Figure 3 It is a schematic diagram of the connection relationship between a ResNet network module and a multi-head attention module provided by an embodiment of the present invention;
[0046] Figure 4 It is a module schematic diagram of a cylindrical lithium battery appearance defect detection system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0047] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of a cylindrical lithium battery appearance defect detection method and system proposed by the present invention in combination with the accompanying drawings and specific implementation methods.
[0048] The above and other technical contents, features and effects of the present invention are clearly presented in the following detailed description of the specific implementation modes in conjunction with the accompanying drawings. Through the description of the specific implementation modes, the technical means and effects adopted by the present invention to achieve the predetermined purpose can be more deeply and specifically understood. However, the attached drawings are only for reference and explanation purposes and are not used to limit the technical solutions of the present invention.
[0049] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants are intended to cover non-exclusive inclusion, so that an article or device including a series of elements includes not only those elements, but also other elements that are not explicitly listed. In the absence of more restrictions, the elements defined by the statement "including one..." do not exclude the existence of other identical elements in the article or device including the elements.
[0050] Embodiment 1
[0051] See also Figure 1 , Figure 1 1 is a flow chart of a method for detecting appearance defects of a cylindrical lithium battery provided by an embodiment of the present invention. The method for detecting appearance defects comprises:
[0052] S1: Obtain appearance defect image samples of cylindrical lithium batteries, and expand the appearance defect image samples to form a defect training data set.
[0053] Specifically, step S1 of this embodiment includes:
[0054] S1.1: Collect multiple original defect image samples of the surface of cylindrical lithium batteries, mark the defect information in each original defect sample image, and obtain one or more marked points.
[0055] The original defect image sample may be a large number of defect images of real cylindrical lithium batteries. The original defect image sample is subjected to image grayscale processing and bilateral filtering to remove noise in the image, and then the defect information in each original defect sample image is annotated. The defect information includes the defect position coordinates and the defect type, such as wear marks, scratches, depressions, protrusions, etc. An original defect image sample may include one defect or multiple defects, so each original defect sample image may have one or more annotation points.
[0056] S1.2: Using one of the marked points as the rotation center point, the other marked points in each original defect image sample are rotated by a preset angle with the rotation center point as the origin to obtain multiple new defect image samples.
[0057] Specifically, a marked point in the current original defect image sample is used as the rotation center point, and a translation matrix is constructed according to the coordinates of the rotation center point; a rotation matrix is constructed according to a preset rotation angle; the coordinates of other marked points after rotation are obtained according to the translation matrix, the rotation matrix and the coordinates of other marked points in the current original defect image sample, thereby forming a new defect image sample with new marked point coordinates; another marked point in the current original defect image sample is used as the rotation center point, and the rotation of other marked points is repeated on the current original defect image sample to obtain a new defect image sample generated with different marked points as the rotation center point; this operation is repeated for each original defect image sample to obtain a new defect image sample based on each original defect image sample.
[0058] In other words, for an original defect image sample with multiple annotation points, first, one of the annotation points is used as the rotation center point, and the other annotation points are simultaneously rotated by a preset angle on the image sample to obtain a new defect image sample with new annotation point coordinates; then, another annotation point is used as the rotation center point, and the other annotation points are simultaneously rotated by a preset angle on the image sample to obtain a new defect image sample with new annotation point coordinates; and so on, the other annotation points in the original defect image sample are rotated with each annotation point as the rotation center point, so as to obtain a group of new defect image samples with different defect positions.
[0059] In addition, for an original defect image sample with one annotation point, any pixel point in the original defect image is used as the rotation center point, and the annotation point is rotated on the image sample by a preset angle to obtain a new defect image sample with new annotation point coordinates; further, another pixel point can be reselected as the rotation center point, and the annotation point is rotated on the image sample by a preset angle to obtain a new defect image sample with new annotation point coordinates, thereby obtaining a group of new defect image samples with different defect positions to expand the number of original defect image samples.
[0060] Furthermore, after step S1.2, it also includes: checking whether the coordinates of the marked points on the new defect image sample exceed the effective area of the cylindrical lithium battery contour in the image; if so, deleting the corresponding marked points in the new defect image sample and incorporating the new defect image sample with the corresponding marked points deleted into the defect training data set; if not, directly incorporating the new defect image sample as new sample data into the defect training data set.
[0061] In this embodiment, checking whether the coordinates of the marked points on the new defective image sample exceed the effective area of the outline of the cylindrical lithium battery in the image specifically includes: performing image grayscale processing and bilateral filtering processing on the new defective image sample to remove noise in the image; using the Canny edge detection algorithm to perform edge detection on the grayscale image after bilateral filtering based on the image gradient change, find the edge pixel points, and thus obtain the edge outline of the cylindrical lithium battery in the image; judging whether the marked points on the new defective image sample exceed the area range of the edge outline of the cylindrical lithium battery according to the coordinates of the marked points on the new defective image sample and the coordinates of the edge outline of the cylindrical lithium battery.
[0062] In other words, when rotating according to the rotation center point, some defective annotation points originally located at the edge of the battery may fall outside the battery area. Therefore, it is necessary to determine whether the rotated annotation points are within the area of the cylindrical lithium battery edge contour, and delete the annotation points that are not within the area of the cylindrical lithium battery edge contour. In particular, for the original defective image sample with only one annotation point, if the coordinates of the annotation point on the new defective image sample after rotation fall outside the area of the cylindrical lithium battery edge contour, the new defective image sample is directly deleted.
[0063] S1.3: The original defect image samples and the generated multiple new defect image samples are combined to form a defect training data set, thereby expanding the data volume of the training data set, avoiding the phenomenon of overfitting of the defect detection network model caused by insufficient training samples, and improving the detection effect of the subsequent target detection model.
[0064] S2: Construct a defect detection network based on ResNet and use the defect training data set to train the defect detection network to obtain the trained defect detection network.
[0065] like Figure 2 As shown, the defect detection network of this embodiment includes a convolution module, a ResNet network module, a multi-head attention module and a fully connected layer connected in sequence, wherein the convolution module is used to obtain the preliminary features of the input cylindrical lithium battery appearance defect image; the ResNet network module is used to perform residual calculation on the preliminary features; the multi-head attention module is used to capture the relationship between different preliminary features and use the relationship to perform weighted calculation on different preliminary features to extract important feature information; the fully connected layer is used to classify according to the important feature information to obtain defect detection results.
[0066] In this embodiment, the convolution module includes a convolution layer, a batch normalization layer, a ReLU activation layer and a maximum pooling layer connected in sequence, wherein the number of convolution kernels of the convolution layer is 64, the convolution kernel size is 3, and the step size is 2.
[0067] The ResNet network module of this embodiment is a ResNet34 deep residual network, which uses the preliminary features obtained by the convolution module as input to obtain deeper data information. Figure 3 , Figure 3 It is a schematic diagram of a ResNet residual network module and a connection relationship with a multi-head attention module provided by an embodiment of the present invention. The ResNet network module includes a plurality of first residual blocks, a plurality of second residual blocks, a plurality of third residual blocks and a plurality of fourth residual blocks connected in sequence, each residual block has a different channel number dimension, and each residual block includes a convolutional layer, a batch normalization layer, a ReLU activation layer, a Dropout layer, a convolutional layer and a batch normalization layer connected in sequence.
[0068] ResNet (residual network) is easy to optimize and can improve accuracy by increasing the depth. Its internal residual block uses skip connections to alleviate the gradient vanishing problem caused by increasing the depth of deep neural networks.
[0069] Preferably, the ResNet network module of this embodiment includes 2 first residual blocks, 3 second residual blocks, 5 third residual blocks and 3 fourth residual blocks connected in sequence, the number of output channels of each first residual block is 64; the number of output channels of each second residual block is 128; the number of output channels of each third residual block is 256; the number of output channels of each fourth residual block is 512. The convolution kernel size of the convolution layer in each residual block is 3, and the step size is 2.
[0070] Continue to see Figure 3 The multi-head attention module of this embodiment can establish different projection information in multiple different projection spaces, project the input feature matrix into different spaces, obtain multiple output feature matrices and splice them together. Specifically, the data information from the ResNet network module is respectively combined with the weight matrix W Q ,W K ,W V Multiply them to get the projection Q, K, V of the data information in the three spaces; pass Q, K, V through different linear layers to get the mapping Q of different subspaces i ,K i ,V i , use the attention calculation unit to calculate each group Q i ,K i ,V i Perform attention operations separately to obtain the output Z of each group i ; All output Z i They are spliced together and transformed linearly to obtain the final output result Z.
[0071] Furthermore, a fully connected layer is set at the output end of the multi-head attention module to classify the feature vector obtained after feature extraction and obtain the defect detection result.
[0072] Specifically, the defect detection network is trained using the defect training data set to obtain the trained defect detection network, including:
[0073] S2.1: Input the training samples in the defect training data set generated in step S1 into the convolution module for preliminary feature extraction to obtain preliminary features of the training samples.
[0074] S2.2: Input the preliminary features extracted by the convolution module into the ResNet34 deep residual network. The four residual blocks in the ResNet34 deep residual convolution network can learn deeper target defect features. S2.3: Pass the deeper target defect features passed through the deep residual network ResNet34 into the multi-head attention module, and compare the data information from the deep residual network ResNet34 with the weight matrix W Q ,W K ,W V Multiply them to get the projection Q, K, V of the data information in the three spaces; pass Q, K, V through different linear layers to get the mapping Q of different subspaces i ,K i ,V i , use the attention calculation unit to calculate each group Q i ,K i ,V i Perform attention operations separately to obtain the output Z of each group i ; All output Z i They are concatenated together and transformed linearly to obtain the final output result Z. The multi-head attention mechanism allows each head to focus on different parts of the input, thereby capturing more complex feature dimension relationships and obtaining more accurate classification results.
[0075] S2.4: Input the feature vector Z extracted by the multi-head attention module into the fully connected layer for defect detection to obtain the predicted label;
[0076] S2.5: According to the predicted label and the corresponding true label (i.e., the marked point), the loss function of the current iteration number is calculated, and the parameters of the defect detection network are updated by the stochastic gradient descent algorithm to obtain the updated defect detection network; the cross entropy loss function is used to calculate the loss value L of the defect detection network loss , and then use the back propagation algorithm to pass L loss The parameters of the defect detection network are updated, where the loss function of the defect detection network is calculated as:
[0077]
[0078] Among them, y mn is an indicator variable. If the predicted label of the nth sample is the same as the true label, then y mn =1, otherwise y mn =0; p mn It represents the predicted probability that the nth sample belongs to the mth category, ∑ represents the summation operation, N represents the total number of training samples, and M represents the total number of label types.
[0079] S2.6: Determine whether the set maximum number of iterations has been reached. If so, obtain a trained defect detection network. If not, repeat step S2.1.
[0080] S3: Use the image acquisition module to obtain appearance images of the cylindrical lithium battery to be tested at various angles.
[0081] A high-speed CCD camera is used as an image acquisition module to perform real-time acquisition of cylindrical lithium batteries on the battery production line, and multiple frames of lithium battery images at different angles of each cylindrical lithium battery are obtained; each frame of the lithium battery image is segmented to obtain multiple frames of lithium battery sub-images, wherein each frame of the lithium battery sub-image contains only the image information of one cylindrical lithium battery.
[0082] Specifically, this embodiment may include multiple high-speed CCD cameras arranged at different positions of the production line to obtain multiple frames of lithium battery images at different angles for each cylindrical lithium battery. All high-speed CCD cameras are connected to the same image processing module, which is used to segment the collected images to ensure that each frame of lithium battery sub-image contains image information of only one cylindrical lithium battery, so as to eliminate interference of other factors on the detection results.
[0083] S4: Input the appearance image into the trained defect detection network to obtain the defect detection result.
[0084] Specifically, the appearance image to be tested processed by the image processing module is input into the trained defect detection network to obtain the defect detection result of the cylindrical lithium battery, that is, the location and type information of the defect is obtained.
[0085] The present invention provides a method for detecting appearance defects of cylindrical lithium batteries. The original image samples are expanded to increase the number of training samples, thereby avoiding the overfitting phenomenon of the defect detection network model caused by insufficient training samples, and improving the detection effect of the target detection model. A ResNet-based defect detection network is adopted, and a multi-head attention module is added after the ResNet network module, which effectively improves the accuracy of defect detection and improves the robustness and real-time performance of lithium battery surface defect detection.
[0086] In addition, the present invention uses an image acquisition module to perform real-time acquisition of cylindrical lithium batteries on the battery production line, photographs the cylindrical lithium batteries to be tested from different angles, and performs appearance defect detection on each part of the cylindrical lithium batteries respectively. It can comprehensively detect various appearance defects on different surfaces of the cylindrical lithium batteries and complete the overall defect detection of the cylindrical lithium batteries.
[0087] Embodiment 2
[0088] Based on the first embodiment, this embodiment provides a cylindrical lithium battery appearance defect detection system, such as Figure 4 As shown, the appearance defect detection system includes a training data set generation module 101, a network training module 102, an image acquisition module 103 and a defect detection module 104, wherein the training data set generation module 101 is used to obtain lithium battery appearance defect image samples and expand the image samples to form a defect training data set; the network training module 102 is used to construct a defect detection network based on deep learning and use the defect training data set to train the defect detection network to obtain a trained defect detection network; the image acquisition module 103 is used to obtain appearance images of the cylindrical lithium battery to be tested at various angles, and the image acquisition module is a plurality of image acquisition terminal devices with different angles arranged on the battery production line; the defect detection module 104 is used to input the appearance image into the trained deep learning network to obtain the defect detection result.
[0089] The defect detection network of this embodiment includes a convolution module, a ResNet network module, a multi-head attention module and a fully connected layer connected in sequence, wherein the convolution module is used to obtain the preliminary features of the input cylindrical lithium battery appearance defect image; the ResNet network module is used to perform residual calculations on the preliminary features; the multi-head attention module is used to capture the relationship between different preliminary features and use the relationship to perform weighted calculations on different preliminary features to extract important feature information; the fully connected layer is used to classify according to the important feature information to obtain defect detection results.
[0090] In the several embodiments provided by the present invention, it should be understood that the apparatus and method disclosed by the present invention can be implemented in other ways. For example, the apparatus embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation, for example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0091] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0092] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.
Claims
1. A method for detecting appearance defects of cylindrical lithium batteries, characterized in that: include: S1: Obtain appearance defect image samples of cylindrical lithium batteries, and expand the appearance defect image samples to form a defect training data set; S2: constructing a defect detection network based on ResNet and using the defect training data set to train the defect detection network to obtain a trained defect detection network, wherein the defect detection network includes a convolution module, a ResNet network module, a multi-head attention module and a fully connected layer connected in sequence, the convolution module is used to obtain preliminary features of the input appearance defect image; the ResNet network module is used to perform residual calculation on the preliminary features, the multi-head attention module is used to capture the relationship between different preliminary features and extract important feature information, and the fully connected layer is used to classify according to the important feature information to obtain defect detection results; S3: using an image acquisition module to obtain appearance images of the cylindrical lithium battery to be tested at various angles; S4: Inputting the appearance image into the trained defect detection network to obtain a defect detection result.
2. The method for detecting appearance defects of cylindrical lithium batteries according to claim 1, characterized in that: The S1 includes: S1.1: Collect multiple original defect image samples of the surface of cylindrical lithium batteries, mark the defect information in each original defect sample image, and obtain one or more marked points; S1.2: Using one of the marked points as a rotation center point, rotating the other marked points in each of the original defect image samples by a preset angle with the rotation center point as the origin, to obtain a plurality of new defect image samples; S1.3: The original defect image sample and the generated multiple new defect image samples are combined to form the defect training data set.
3. The method for detecting appearance defects of cylindrical lithium batteries according to claim 2, characterized in that: The S1.2 includes: Taking a marked point in the current original defect image sample as the rotation center point, constructing a translation matrix according to the coordinates of the rotation center point; constructing a rotation matrix according to a preset rotation angle; obtaining the coordinates of other marked points after rotation according to the translation matrix, the rotation matrix and the coordinates of other marked points in the current original defect image sample, thereby forming a new defect image sample with new marked point coordinates; taking another marked point in the current original defect image sample as the rotation center point, repeating the rotation of other marked points on the current original defect image sample, and obtaining a new defect image sample generated with different marked points as rotation center points; The process is repeated for each original defect image sample to obtain a new defect image sample based on each original defect image sample.
4. The method for detecting appearance defects of cylindrical lithium batteries according to claim 3, characterized in that: The S1.2 also includes: Check whether the coordinates of the marked points on the new defect image sample exceed the valid area of the cylindrical lithium battery contour in the image. If so, delete the corresponding marked points in the new defect image sample and incorporate the new defect image sample with the corresponding marked points deleted into the defect training data set; if not, directly incorporate the new defect image sample as new sample data into the defect training data set.
5. The method for detecting appearance defects of cylindrical lithium batteries according to claim 4, characterized in that: Checking whether the coordinates of the marked points on the new defect image sample exceed the valid area of the cylindrical lithium battery contour in the image includes: Performing image grayscale processing and bilateral filtering processing on the new defect image sample to remove noise in the image; Perform edge detection on the grayscale image after bilateral filtering based on image gradient changes to obtain edge pixel points, and then obtain the edge contour of the cylindrical lithium battery in the image; It is determined whether the coordinates of the marked points on the new defect image sample exceed the area range of the edge contour of the cylindrical lithium battery.
6. The method for detecting appearance defects of cylindrical lithium batteries according to claim 1, characterized in that: The convolution module includes a convolution layer, a batch normalization layer, a ReLU activation layer and a maximum pooling layer connected in sequence; The ResNet network module takes the preliminary features obtained by the convolution module as input, and the ResNet network module includes a plurality of first residual blocks, a plurality of second residual blocks, a plurality of third residual blocks and a plurality of fourth residual blocks connected in sequence, each residual block has a different channel number dimension, and each residual block includes a convolution layer, a batch normalization layer, a ReLU activation layer, a Dropout layer, a convolution layer and a batch normalization layer connected in sequence.
7. The method for detecting appearance defects of cylindrical lithium batteries according to claim 6, characterized in that: The multi-head attention module is specifically used for: The output features from the ResNet network module are respectively combined with the weight matrix W Q ,W K ,W V Multiply them to obtain the projections Q, K, and V of the output features in the three spaces; pass the projections Q, K, and V through different linear layers to obtain the mappings Q of different subspaces i ,K i ,V i , for each set of mappings Q i ,K i ,V i Perform attention operations separately to obtain the output Z of each group i ; All output Z i They are spliced together and transformed linearly to obtain the final output result Z.
8. The method for detecting appearance defects of cylindrical lithium batteries according to claim 7, characterized in that: The loss function of the defect detection network is: Among them, y mn is an indicator variable. If the predicted label of the nth sample is the same as the true label, then y mn =1, otherwise y mn =0; p mn It represents the predicted probability that the nth sample belongs to the mth category, ∑ represents the summation operation, N represents the total number of training samples, and M represents the total number of label types.
9. The method for detecting appearance defects of cylindrical lithium batteries according to claim 1, characterized in that: The S3 includes: The cylindrical lithium batteries on the battery production line are collected in real time using an image acquisition module to obtain multiple frames of lithium battery images at different angles for each cylindrical lithium battery. The image acquisition module is a CCD camera. Image segmentation processing is performed on each frame of lithium battery image to obtain multiple frames of lithium battery sub-images, wherein each frame of lithium battery sub-image only includes image information of a cylindrical lithium battery.
10. A cylindrical lithium battery appearance defect detection system, characterized in that: Used to perform the appearance defect detection method according to any one of claims 1 to 9, the appearance defect detection system comprises a training data set generation module, a network training module, an image acquisition module and a defect detection module, wherein: The training data set generation module is used to obtain appearance defect image samples of cylindrical lithium batteries and expand the appearance defect image samples to form a defect training data set; The network training module is used to construct a defect detection network based on ResNet and train the defect detection network using the defect training data set to obtain a trained defect detection network; The image acquisition module is used to obtain the appearance images of the cylindrical lithium battery to be tested at various angles. The image acquisition module is a plurality of image acquisition terminal devices with different angles arranged on the battery production line; The defect detection module is used to input the appearance image into the trained defect detection network to obtain a defect detection result.
Citation Information
Patent Citations
Semantic segmentation image sample expansion method and device and electronic equipment
CN113989592A
Aircraft skin defect identification system based on multi-scale adaptive SSD algorithm
CN115063725A
High-reflection metal surface defect detection method based on improved Faster RCNN
CN115482220A
Method and apparatus for detecting metal surface defects
WO2022160170A1
