A lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion

By generating adversarial networks to augment the dataset and combining it with improved feature extraction and attention mechanisms of the YOLOv4 model, the problems of large dataset labeling requirements and insufficient feature extraction in lithium battery electrode surface defect detection are solved, achieving efficient and accurate defect detection.

CN118628492BActive Publication Date: 2024-11-12INSPUR WORLDWIDE SERVICES LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411102598.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2024-11-12
Estimated Expiration
2044-08-13

AI Technical Summary

Technical Problem

Existing technologies for detecting defects on the surface of lithium battery electrodes suffer from problems such as large requirements for dataset annotation and the inability of feature extraction modules to effectively extract multi-scale features, resulting in insufficient detection accuracy.

Method used

A lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion is adopted. The dataset is expanded by generative adversarial network, and the improved backbone feature extraction network and target detection head network of YOLOv4 model are combined. Multi-scale feature fusion and attention mechanism are used to enhance feature extraction, and Adam optimizer and focal loss function are used for training.

Benefits of technology

It achieves efficient and accurate detection of defects on the surface of lithium battery electrodes, improves the network's detection accuracy and ability to identify minute defects, and is suitable for real-time detection of lithium battery electrode surfaces.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118628492B_ABST
    Figure CN118628492B_ABST
Patent Text Reader

Abstract

A lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion relates to the field of defect detection technology. The improved generative adversarial network can effectively expand the data set with insufficient data such as lithium battery electrode defects, which is convenient for subsequent model training. The backbone feature extraction module embedded with the attention mechanism can strengthen the key features of the target area and improve the detection accuracy of the network. The proposed feature extraction module embedded with the multi-scale feature fusion strategy can retain multi-scale feature information, improve the fusion ability of shallow detail features and high-level semantic information, and enhance the extraction of tiny defect features. It can achieve more accurate and efficient detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of defect detection technology, and in particular to a lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion. Background Art

[0002] As a mature energy storage device, lithium battery has the characteristics of high energy density, long cycle life, high safety and low pollution, and is widely used in various fields. The production process of lithium battery electrodes is complex and easily affected by environmental, equipment, labor and other factors, resulting in defects such as metal leakage, holes, scratches, bubbles and so on on the electrode surface. These defects seriously affect battery performance, resulting in reduced battery capacity and service life, and even causing serious safety accidents such as fire and explosion. Therefore, efficient electrode surface defect detection technology has become a key issue that needs to be solved urgently to restrict the development of the lithium battery industry.

[0003] The Chinese invention patent with application number CN202410035046.0 proposes a Transformer-based electrode double-sided defect detection method and detection device, including the following steps: Step 1, image acquisition and preprocessing to obtain a defect image; the acquired electrode double-sided defect image is processed by grayscale threshold, and the defect image is cropped into multiple block images; Step 2, define the defect category and annotate the image; define the semantic label ID corresponding to the defect type, and semantically annotate the cropped defect image according to the defect category to obtain an annotated image; Step 3, image division, divide the defect image and the corresponding annotated image into a training set, a validation set, and a test set in a ratio of 8:1:1. ; Step 4, construct a Transformer defect segmentation network model: the Transformer defect segmentation network model includes an encoder divided into four Transformer sub-modules and based on a self-attention mechanism and a feedforward network, a decoder divided into four decoding sub-modules and using 1×1Conv convolution and upsample upsampling, and an IoU loss function; Step 5, model training, the original image is scaled and normalized and then input into the Transformer defect segmentation network model for training to obtain the optimal network weight parameters; Step 6, defect detection, the newly collected electrode image is input into the trained and optimized model, and the defect information of the electrode image is output.

[0004] The disadvantages of this technology are: 1. The data set that this technology relies on requires a large number of labeled samples, but the data set for lithium battery electrode surface defects is small, and the data of each sample in the data set needs to be manually labeled. 2. The feature extraction module of this technology cannot solve the problem of complex texture, variable defect morphology, and a high proportion of small defects such as lithium battery electrode surface defects, and it is impossible to obtain a high-precision defect detection model.

[0005] The Chinese invention patent with application number CN202211552287.X proposes a lithium battery pole piece fold defect detection method based on YOLOv7, including the following steps: Step 1, collect fold sample set images and use annotation tools to annotate the image fold area to generate an annotation text file corresponding to the image; use image processing technology to enhance the image and output the enhanced fold defect image; Step 2, reparameterize the model, split a module into multiple identical or different module branches during training, and integrate multiple branch modules into completely equivalent modules during reasoning; then scale the model and use the above model to perform fold defect image detection. Scaling to obtain a fold defect image of the same size; establishing an extended efficient layer aggregation network, using group convolution through the extended efficient layer aggregation network to increase the cardinality of added features, and combining features of different groups by reordering and merging cardinality; step 3, establishing a YOLOv7 model, using the battery cell X-RAY fold image data set for training, and finally obtaining a YOLOv7 algorithm model after training; step 4, loading the fold defect image to be processed, normalizing the image and then passing it to the YOLOv7 model; the YOLOv7 model performs non-maximum suppression and confidence threshold screening to obtain the final result; drawing the fold defect information on the fold defect image.

[0006] The disadvantages of this technology are: 1. This technology only uses a single YOLOv7 as a defect detection model, ignoring the advantages of the attention mechanism. The key features of the target area in the surface defect image of the lithium battery electrode cannot be strengthened, which is not conducive to the improvement of subsequent network detection accuracy. 2. The features extracted by this technology are relatively simple, ignoring the technical advantages of multi-scale feature information for improving network detection accuracy, and it is impossible to obtain a high-precision defect detection model. Summary of the invention

[0007] In order to overcome the shortcomings of the above technologies, the present invention provides a lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion to achieve efficient and accurate detection of surface defects of lithium battery electrodes.

[0008] The technical solution adopted by the present invention to overcome the technical problems is:

[0009] A lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion, comprising:

[0010] S1. Collecting the surface of lithium battery electrodes A group of images of different electrode defect states, Group images are , ;

[0011] S2. Group Image Perform preprocessing to obtain the denoised image ;

[0012] S3. Denoised image Perform data annotation and obtain the first An initial dataset of lithium battery electrode surface defects ;

[0013] S4. Establish an improved generative adversarial network consisting of a generator and a discriminator;

[0014] S5. An initial dataset of lithium battery electrode surface defects Input into the generator of the improved generative adversarial network and output the image ;

[0015] S6. Image Input into the discriminator of the improved generative adversarial network and output the image;

[0016] S7. Establish a lithium battery electrode defect detection model based on attention mechanism and multi-scale feature fusion, and use the lithium battery electrode defect detection model to obtain prediction results ;

[0017] S8. Train a lithium battery electrode defect detection model based on attention mechanism and multi-scale feature fusion to obtain an optimized lithium battery electrode defect detection model based on attention mechanism and multi-scale feature fusion.

[0018] Further, step S1 includes the following steps:

[0019] S1-1. Photographing the surface of lithium battery electrodes using a high-resolution industrial-grade CCD camera A set of images of different electrode defect states;

[0020] S1-2. The resolution of the captured image is scaled to 416×416, and the image is obtained .

[0021] Furthermore, the electrode defect states in step S1-1 include: lithium battery electrode scratch defects, lithium battery metal leakage defects, and lithium battery electrode hole defects.

[0022] Further, step S2 includes the following steps:

[0023] S2-1. Use the non-local mean filtering function CV2.fastNIMeansDenoising() in Python to Group Image Perform denoising to obtain the denoised image .

[0024] Further, step S3 includes the following steps:

[0025] S3-1. Use the labeling software LabelImg to label the denoised image The electrode defects are marked with a rectangular frame, and the marking information includes the horizontal coordinate of the center point of the rectangular frame, the vertical coordinate of the center point of the rectangular frame, the height of the rectangular frame, and the width of the rectangular frame. After the marking is completed, the first An initial dataset of lithium battery electrode surface defects .

[0026] Further, step S5 includes the following steps:

[0027] S5-1. The generator of the improved generative adversarial network is composed of a fully connected layer, a first BN layer, a first ReLU function, a first upsampling unit, a second upsampling unit, a third upsampling unit, a multi-scale attention feature extraction unit, a first residual block, a second residual block, a first convolutional layer with a convolution kernel size of 3×3, a second BN layer, a second ReLU function, a second convolutional layer with a convolution kernel size of 3×3, and a tanh activation function.

[0028] S5-2. An initial dataset of lithium battery electrode surface defects It is input into the fully connected layer, the first BN layer, and the first ReLU function of the generator in sequence, and the feature map is output. ;

[0029] S5-3. The first upsampling unit, the second upsampling unit, and the third upsampling unit of the generator are respectively composed of an upsampling layer, a convolution layer with a convolution kernel size of 3×3, a BN layer, and a ReLU function. Input into the first upsampling unit of the generator and output the feature map , the feature map Input into the second upsampling unit of the generator and output the feature map , the feature map Input into the third upsampling unit of the generator and output the feature map ;

[0030] S5-4. Feature map It is sequentially input into the multi-scale attention feature extraction unit, the first residual block, the second residual block, the first convolutional layer, the second BN layer, the second ReLU function, the second convolutional layer, and the tanh activation function of the generator, and the data set consisting of images is output;

[0031] S5-5. The multi-scale attention feature extraction unit of the generator consists of the first convolution layer with a convolution kernel size of 5×5, the second convolution layer with a convolution kernel size of 3×3, the global average pooling layer, the first fully connected layer, the ReLU function, the second fully connected layer, the Softmax function, and the reshape function. Input into the first convolutional layer of the multi-scale attention feature extraction unit, and output the feature map , the feature map Input into the second convolutional layer of the multi-scale attention feature extraction unit, and output the feature map , the feature map With feature map Perform concatenation to obtain feature maps , the feature map It is sequentially input into the global average pooling layer, the first fully connected layer, the ReLU function, the second fully connected layer, the Softmax function, and the reshape function of the multi-scale attention feature extraction unit to output the feature map. , the feature map With feature map Perform multiplication operation to obtain feature map ;

[0032] S5-6. Feature map The output is the first residual block of the generator, the second residual block, the first convolution layer with a convolution kernel size of 3×3, the second BN layer, the second ReLU function, the second convolution layer with a convolution kernel size of 3×3, and the tanh activation function. .

[0033] Further, step S6 includes the following steps:

[0034] S6-1. The discriminator of the improved generative adversarial network consists of a first branch, a second branch, a first convolution layer with a convolution kernel size of 3×3, a first LeakyReLU function, a second convolution layer with a convolution kernel size of 3×3, a second LeakyReLU function, a strided convolution layer with a convolution kernel size of 5×5, a BN layer, a third LeakyReLU function, a fully connected layer, and a Sigmoid function;

[0035] S6-2. An initial dataset of lithium battery electrode surface defects With image Perform fusion operation to obtain a complete lithium battery electrode surface defect dataset ;

[0036] S6-3. The first branch of the discriminator is composed of the maximum pooling layer, the first LeakyReLU function, the first convolution layer with a convolution kernel size of 3×3, the second LeakyReLU function, and the second convolution layer with a convolution kernel size of 3×3. The complete lithium battery electrode surface defect dataset After inputting into the first branch of the discriminator, the scale feature is output ;

[0037] S6-4. The second branch of the discriminator is composed of the first convolution layer with a convolution kernel size of 3×3, the first LeakyReLU function, the second convolution layer with a convolution kernel size of 3×3, the second LeakyReLU function, the third convolution layer with a convolution kernel size of 5×5, and the third LeakyReLU function. The complete lithium battery electrode surface defect dataset After being input into the second branch of the discriminator, the scale feature is output ;

[0038] S6-5. Scale features and scale characteristics Perform addition operation to obtain the aggregate feature map ;

[0039] S6-6. Aggregate feature map After being input into the first convolution layer of the discriminator, the first LeakyReLU function, the second convolution layer, the second LeakyReLU function, the strided convolution layer with a convolution kernel size of 5×5, the BN layer, and the third LeakyReLU function, the feature map is output. , the feature map After performing Flatten and Dropout operations in sequence, the feature map is obtained , the feature map Input into the fully connected layer and Sigmoid function of the discriminator in turn, and the output is the image category 0 or 1. When it is 0, it means the image is a real image, and 1 indicates an image To generate images.

[0040] Further, step S7 includes the following steps:

[0041] S7-1. The lithium battery electrode defect detection model consists of a backbone feature extraction network module, an enhanced feature extraction network module, and a target detection head network module;

[0042] S7-2. The backbone feature extraction network module of the lithium battery electrode defect detection model is composed of the backbone feature extraction network of the YOLOv4 model. An SE attention module is set between the CBM module and the Attn-CSP1 module of the backbone feature extraction network of the YOLOv4 model to integrate the complete lithium battery electrode surface defect dataset. Input into the backbone feature extraction network module, and output the surface defect features of the lithium battery electrode ;

[0043] S7-3. The enhanced feature extraction network module of the lithium battery electrode defect detection model is composed of the enhanced feature extraction network of the YOLOv4 model. The SPP module of the enhanced feature extraction network of the YOLOv4 model is replaced by the ASPP module, and the surface defect features of the lithium battery electrode are extracted. Input into the enhanced feature extraction network module, and output the feature representation after multi-scale feature fusion ;

[0044] S7-4. The target detection head network module of the lithium battery electrode defect detection model is composed of the head network of the YOLOv4 model, which represents the feature after fusion of multi-scale features. Input into the target detection head network module and output the prediction result .

[0045] Furthermore, in step S8, the Adam optimizer is used to train the lithium battery electrode defect detection model based on the attention mechanism and multi-scale feature fusion using the focal loss function to obtain an optimized lithium battery electrode defect detection model based on the attention mechanism and multi-scale feature fusion.

[0046] It also includes deploying the optimized lithium battery electrode defect detection model based on attention mechanism and multi-scale feature fusion to the background server.

[0047] The beneficial effects of the present invention are as follows: the improved generative adversarial network of the present invention can effectively expand the data set with insufficient data volume such as lithium battery electrode defects, which is convenient for subsequent model training. The backbone feature extraction module embedded with the attention mechanism of the present invention can strengthen the key features of the target area and improve the detection accuracy of the network. The feature extraction module embedded with the multi-scale feature fusion strategy proposed can retain multi-scale feature information, improve the fusion ability of shallow detail features and high-level semantic information, and enhance the extraction of tiny defect features. It can achieve more accurate and efficient detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 is a flow chart of the method of the present invention;

[0049] Figure 2A structural diagram of a generator of an improved generative adversarial network of the present invention;

[0050] Figure 3 It is a structural diagram of the multi-scale attention feature extraction unit of the present invention;

[0051] Figure 4 A structural diagram of the discriminator of the improved generative adversarial network of the present invention;

[0052] Figure 5 It is a structural schematic diagram of the lithium battery electrode defect detection model of the present invention. DETAILED DESCRIPTION

[0053] The following is combined with Figure 1 To Attachment Figure 5 The present invention is further described.

[0054] Aiming at the problem that the scale of lithium battery electrode defect image dataset is small, the lithium battery electrode has complex texture, variable defect morphology, and a high proportion of tiny defects, resulting in the inability of existing defect detection technology to achieve accurate and efficient detection of lithium battery electrode surface defects, the present invention proposes a lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion, including:

[0055] S1. Collecting the surface of lithium battery electrodes A group of images of different electrode defect states, Group images are , .

[0056] S2. Group Image Perform preprocessing to obtain the denoised image .

[0057] S3. Denoised image Perform data annotation and obtain the first An initial dataset of lithium battery electrode surface defects .

[0058] S4. Establish an improved generative adversarial network consisting of a generator and a discriminator.

[0059] S5. An initial dataset of lithium battery electrode surface defects Input into the generator of the improved generative adversarial network and output the image .

[0060] S6. Image Input into the discriminator of the improved generative adversarial network and output the image.

[0061] S7. Establish a lithium battery electrode defect detection model based on attention mechanism and multi-scale feature fusion, and use the lithium battery electrode defect detection model to obtain prediction results .

[0062] S8. Train a lithium battery electrode defect detection model based on attention mechanism and multi-scale feature fusion to obtain an optimized lithium battery electrode defect detection model based on attention mechanism and multi-scale feature fusion.

[0063] In one embodiment of the present invention, step S1 comprises the following steps:

[0064] S1-1. Adjust the light source angle and light intensity, and use a high-resolution industrial-grade CCD camera to photograph the surface of the lithium battery electrode. A group of images under different electrode defect states. Preferably, The value is 300.

[0065] S1-2. The resolution of the captured image is scaled to 416×416, and the image is obtained .

[0066] In one embodiment of the present invention, the electrode defect states in step S1-1 include: lithium battery electrode scratch defects, lithium battery metal leakage defects, and lithium battery electrode hole defects.

[0067] In one embodiment of the present invention, step S2 comprises the following steps:

[0068] S2-1. Use the non-local mean filtering function CV2.fastNIMeansDenoising() in Python to Group Image Perform denoising to obtain the denoised image .

[0069] In one embodiment of the present invention, step S3 includes the following steps:

[0070] S3-1. Use the labeling software LabelImg to label the denoised image The electrode defects are marked with a rectangular frame, and the marking information includes the horizontal coordinate of the center point of the rectangular frame, the vertical coordinate of the center point of the rectangular frame, the height of the rectangular frame, and the width of the rectangular frame. After the marking is completed, the first An initial dataset of lithium battery electrode surface defects .

[0071] In one embodiment of the present invention, step S5 comprises the following steps:

[0072] S5-1. The generator of the improved generative adversarial network is composed of a fully connected layer, a first BN layer, a first ReLU function, a first upsampling unit, a second upsampling unit, a third upsampling unit, a multi-scale attention feature extraction unit, a first residual block, a second residual block, a first convolutional layer with a convolution kernel size of 3×3, a second BN layer, a second ReLU function, a second convolutional layer with a convolution kernel size of 3×3, and a tanh activation function.

[0073] S5-2. An initial dataset of lithium battery electrode surface defects It is input into the fully connected layer, the first BN layer, and the first ReLU function of the generator in sequence, and the feature map is output. .

[0074] S5-3. The first upsampling unit, the second upsampling unit, and the third upsampling unit of the generator are respectively composed of an upsampling layer, a convolution layer with a convolution kernel size of 3×3, a BN layer, and a ReLU function. Input into the first upsampling unit of the generator and output the feature map , the feature map Input into the second upsampling unit of the generator and output the feature map , the feature map Input into the third upsampling unit of the generator and output the feature map .

[0075] S5-4. Feature map The multi-scale attention feature extraction unit, the first residual block, the second residual block, the first convolution layer, the second BN layer, the second ReLU function, the second convolution layer, and the tanh activation function are sequentially input into the generator, and the image dataset is output. The multi-scale attention feature extraction unit can avoid the artifacts of different scales caused by the superposition of multiple deconvolutions.

[0076] S5-5. The multi-scale attention feature extraction unit of the generator consists of the first convolution layer with a convolution kernel size of 5×5, the second convolution layer with a convolution kernel size of 3×3, the global average pooling layer, the first fully connected layer, the ReLU function, the second fully connected layer, the Softmax function, and the reshape function. Input into the first convolutional layer of the multi-scale attention feature extraction unit, and output the feature map , the feature map Input into the second convolutional layer of the multi-scale attention feature extraction unit, and output the feature map , the feature map With feature map Perform concatenation to obtain feature maps , the feature map It is sequentially input into the global average pooling layer, the first fully connected layer, the ReLU function, the second fully connected layer, the Softmax function, and the reshape function of the multi-scale attention feature extraction unit to output the feature map. , the feature map With feature map Perform multiplication operation to obtain feature map .

[0077] S5-6. Feature map The output is the first residual block of the generator, the second residual block, the first convolution layer with a convolution kernel size of 3×3, the second BN layer, the second ReLU function, the second convolution layer with a convolution kernel size of 3×3, and the tanh activation function. By extracting multiple features through receptive fields of different sizes, and allowing the network to pay different attention to each channel feature, the network can learn important information in the feature map and ensure that the generator generates high-quality images.

[0078] In one embodiment of the present invention, step S6 includes the following steps:

[0079] S6-1. The discriminator of the improved generative adversarial network consists of a first branch, a second branch, a first convolutional layer with a convolution kernel size of 3×3, a first LeakyReLU function, a second convolutional layer with a convolution kernel size of 3×3, a second LeakyReLU function, a strided convolutional layer with a convolution kernel size of 5×5, a BN layer, a third LeakyReLU function, a fully connected layer, and a Sigmoid function.

[0080] S6-2. An initial dataset of lithium battery electrode surface defects With image Perform fusion operation to obtain a complete lithium battery electrode surface defect dataset .

[0081] S6-3. The first branch of the discriminator is composed of the maximum pooling layer, the first LeakyReLU function, the first convolution layer with a convolution kernel size of 3×3, the second LeakyReLU function, and the second convolution layer with a convolution kernel size of 3×3. The complete lithium battery electrode surface defect dataset After inputting into the first branch of the discriminator, the scale feature is output .

[0082] S6-4. The second branch of the discriminator is composed of the first convolution layer with a convolution kernel size of 3×3, the first LeakyReLU function, the second convolution layer with a convolution kernel size of 3×3, the second LeakyReLU function, the third convolution layer with a convolution kernel size of 5×5, and the third LeakyReLU function. The complete lithium battery electrode surface defect dataset After being input into the second branch of the discriminator, the scale feature is output .

[0083] S6-5. Scale features and scale characteristics Perform addition operation to obtain the aggregate feature map .

[0084] S6-6. Aggregate feature map After being input into the first convolution layer of the discriminator, the first LeakyReLU function, the second convolution layer, the second LeakyReLU function, the strided convolution layer with a convolution kernel size of 5×5, the BN layer, and the third LeakyReLU function, the feature map is output. , the feature map After performing Flatten and Dropout operations in sequence, the feature map is obtained , the feature map Input into the fully connected layer and Sigmoid function of the discriminator in turn, and the output is the image category 0 or 1. When it is 0, it means the image is a real image, and 1 indicates an image To generate images.

[0085] The present invention aims at the problem that the defect morphology of the lithium battery electrode surface defect image data set is variable, the defect texture is not much different from the background, the length, height and width are different, and it is easily disturbed by the surrounding environment when extracting features, resulting in inaccurate defect detection. The present invention improves the YOLOv4 detection model by adding an attention mechanism module to improve the feature extraction ability of the network, enhancing the overall receptive field of the network, constructing a feature fusion method that is conducive to small target defect detection, and constructing a suitable loss function, thereby enhancing the learning ability of the network and improving the precision and accuracy of lithium battery electrode surface defect detection as a whole. Specifically, in one embodiment of the present invention, step S7 includes the following steps:

[0086] S7-1. The lithium battery electrode defect detection model consists of a backbone feature extraction network module, an enhanced feature extraction network module, and a target detection head network module.

[0087] S7-2. The backbone feature extraction network module of the lithium battery electrode defect detection model is composed of the backbone feature extraction network of the YOLOv4 model. An SE attention module is set between the CBM module and the Attn-CSP1 module of the backbone feature extraction network of the YOLOv4 model to integrate the complete lithium battery electrode surface defect dataset. Input into the backbone feature extraction network module, and output the surface defect features of the lithium battery electrode Although the traditional YOLOv4 can extract fine-grained and rich semantic information and increase the receptive field of the network, it will also cause the loss of feature information in small target areas. Therefore, the present invention introduces the SE attention mechanism to enhance the representation ability of the network and improves the model structure. The attention mechanism distinguishes the importance of different channels, highlights the key features contained in the shallow network, and weakens irrelevant information. The residual operation is then used to deeply extract features, and finally the output is merged to improve the algorithm's detectability for small defect targets.

[0088] S7-3. The enhanced feature extraction network module of the lithium battery electrode defect detection model is composed of the enhanced feature extraction network of the YOLOv4 model. The SP (spatial pyramid pooling) P module of the enhanced feature extraction network of the YOLOv4 model is replaced with the ASPP (cavity spatial pyramid pooling) module to extract the surface defect features of the lithium battery electrode. Input into the enhanced feature extraction network module, and output the feature representation after multi-scale feature fusion Compared with the traditional YOLOv4, the enhanced feature extraction network module of the present invention adopts the ASPP structure to replace the traditional SPP structure, which can retain more image detail information while increasing the receptive field of the convolution kernel, so as to obtain more complete local features and more accurate target positioning effects, and improve the network's ability to recognize tiny electrode defects.

[0089] S7-4. The target detection head network module of the lithium battery electrode defect detection model is composed of the head network of the YOLOv4 model, which represents the feature after fusion of multi-scale features. Input into the target detection head network module and output the prediction result .

[0090] In one embodiment of the present invention, in step S8, an Adam optimizer is used to train a lithium battery electrode defect detection model based on an attention mechanism and multi-scale feature fusion using a focal loss function to obtain an optimized lithium battery electrode defect detection model based on an attention mechanism and multi-scale feature fusion.

[0091] Table 1 Verification results

[0092]

[0093] The performance index verification results of the lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion of the present invention and the traditional detection model are shown in Table 1. It can be seen from the mAP and fps evaluation indicators that the method of the present invention has higher electrode defect detection accuracy.

[0094] In one embodiment of the present invention, the optimized lithium battery electrode defect detection model based on attention mechanism and multi-scale feature fusion is deployed to the background server. The real-time collected lithium battery image information is transmitted to the background server through the visual camera in the production process, and the real-time collected lithium battery image is input into the optimized lithium battery electrode defect detection model based on attention mechanism and multi-scale feature fusion to obtain the surface defect detection result of the lithium battery electrode. The above steps are repeated to finally realize the real-time detection of electrode defects in the lithium battery production process, and timely detect lithium batteries with electrode defects in the production process.

[0095] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion, characterized in that: include: S1. Collecting the surface of lithium battery electrodes A group of images of different electrode defect states, Group images are , ; S2. Group Image Perform preprocessing to obtain the denoised image ; S3. Denoised image Perform data annotation and obtain the first An initial dataset of lithium battery electrode surface defects ; S4. Establish an improved generative adversarial network consisting of a generator and a discriminator; S5. An initial dataset of lithium battery electrode surface defects Input into the generator of the improved generative adversarial network and output the image ; S6. Image Input into the discriminator of the improved generative adversarial network and output the image; S7. Establish a lithium battery electrode defect detection model based on attention mechanism and multi-scale feature fusion, and use the lithium battery electrode defect detection model to obtain prediction results ; S8. Train a lithium battery electrode defect detection model based on an attention mechanism and multi-scale feature fusion to obtain an optimized lithium battery electrode defect detection model based on an attention mechanism and multi-scale feature fusion; Step S5 includes the following steps: S5-1. The generator of the improved generative adversarial network is composed of a fully connected layer, a first BN layer, a first ReLU function, a first upsampling unit, a second upsampling unit, a third upsampling unit, a multi-scale attention feature extraction unit, a first residual block, a second residual block, a first convolutional layer with a convolution kernel size of 3×3, a second BN layer, a second ReLU function, a second convolutional layer with a convolution kernel size of 3×3, and a tanh activation function. S5-2. An initial dataset of lithium battery electrode surface defects It is input into the fully connected layer, the first BN layer, and the first ReLU function of the generator in sequence, and the feature map is output. ; S5-3. The first upsampling unit, the second upsampling unit, and the third upsampling unit of the generator are respectively composed of an upsampling layer, a convolution layer with a convolution kernel size of 3×3, a BN layer, and a ReLU function. Input into the first upsampling unit of the generator and output the feature map , the feature map Input into the second upsampling unit of the generator and output the feature map , the feature map Input into the third upsampling unit of the generator and output the feature map ; S5-4. Feature map It is sequentially input into the multi-scale attention feature extraction unit, the first residual block, the second residual block, the first convolutional layer, the second BN layer, the second ReLU function, the second convolutional layer, and the tanh activation function of the generator, and the data set consisting of images is output; S5-5. The multi-scale attention feature extraction unit of the generator consists of the first convolution layer with a convolution kernel size of 5×5, the second convolution layer with a convolution kernel size of 3×3, the global average pooling layer, the first fully connected layer, the ReLU function, the second fully connected layer, the Softmax function, and the reshape function. Input into the first convolutional layer of the multi-scale attention feature extraction unit, and output the feature map , the feature map Input into the second convolutional layer of the multi-scale attention feature extraction unit, and output the feature map , the feature map With feature map Perform concatenation to obtain feature maps , the feature map It is sequentially input into the global average pooling layer, the first fully connected layer, the ReLU function, the second fully connected layer, the Softmax function, and the reshape function of the multi-scale attention feature extraction unit to output the feature map. , the feature map With feature map Perform multiplication operation to obtain feature map ; S5-6. Feature map The output is the first residual block of the generator, the second residual block, the first convolution layer with a convolution kernel size of 3×3, the second BN layer, the second ReLU function, the second convolution layer with a convolution kernel size of 3×3, and the tanh activation function. ; Step S6 includes the following steps: S6-1. The discriminator of the improved generative adversarial network consists of a first branch, a second branch, a first convolution layer with a convolution kernel size of 3×3, a first LeakyReLU function, a second convolution layer with a convolution kernel size of 3×3, a second LeakyReLU function, a strided convolution layer with a convolution kernel size of 5×5, a BN layer, a third LeakyReLU function, a fully connected layer, and a Sigmoid function; S6-2. An initial dataset of lithium battery electrode surface defects With image Perform fusion operation to obtain a complete lithium battery electrode surface defect dataset ; S6-3. The first branch of the discriminator is composed of the maximum pooling layer, the first LeakyReLU function, the first convolution layer with a convolution kernel size of 3×3, the second LeakyReLU function, and the second convolution layer with a convolution kernel size of 3×3. The complete lithium battery electrode surface defect dataset After inputting into the first branch of the discriminator, the scale feature is output ; S6-4. The second branch of the discriminator is composed of the first convolution layer with a convolution kernel size of 3×3, the first LeakyReLU function, the second convolution layer with a convolution kernel size of 3×3, the second LeakyReLU function, the third convolution layer with a convolution kernel size of 5×5, and the third LeakyReLU function. The complete lithium battery electrode surface defect dataset After being input into the second branch of the discriminator, the scale feature is output ; S6-5. Scale features and scale characteristics Perform addition operation to obtain the aggregate feature map ; S6-6. Aggregate feature map After being input into the first convolution layer of the discriminator, the first LeakyReLU function, the second convolution layer, the second LeakyReLU function, the strided convolution layer with a convolution kernel size of 5×5, the BN layer, and the third LeakyReLU function, the feature map is output. , the feature map After performing Flatten and Dropout operations in sequence, the feature map is obtained , the feature map Input into the fully connected layer and Sigmoid function of the discriminator in turn, and the output is the image category 0 or 1. When it is 0, it means the image is a real image, and 1 indicates an image To generate images.

2. The lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion according to claim 1 is characterized in that: Step S1 includes the following steps: S1-1. Photographing the surface of lithium battery electrodes using a high-resolution industrial-grade CCD camera A set of images of different electrode defect states; S1-2. The resolution of the captured image is scaled to 416×416, and the image is obtained .

3. The lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion according to claim 2 is characterized in that: The electrode defect states in step S1-1 include: lithium battery electrode scratch defects, lithium battery metal leakage defects, and lithium battery electrode hole defects.

4. The lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion according to claim 1 is characterized in that: Step S2 includes the following steps: S2-1. Use the non-local mean filtering function CV2.fastNIMeansDenoising() in Python to Group Image Perform denoising to obtain the denoised image .

5. The lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion according to claim 3 is characterized in that: Step S3 includes the following steps: S3-1. Use the labeling software LabelImg to label the denoised image The electrode defects are marked with a rectangular frame, and the marking information includes the horizontal coordinate of the center point of the rectangular frame, the vertical coordinate of the center point of the rectangular frame, the height of the rectangular frame, and the width of the rectangular frame. After the marking is completed, the first An initial dataset of lithium battery electrode surface defects .

6. The lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion according to claim 1 is characterized in that: Step S7 includes the following steps: S7-1. The lithium battery electrode defect detection model consists of a backbone feature extraction network module, an enhanced feature extraction network module, and a target detection head network module; S7-2. The backbone feature extraction network module of the lithium battery electrode defect detection model is composed of the backbone feature extraction network of the YOLOv4 model. An SE attention module is set between the CBM module and the Attn-CSP1 module of the backbone feature extraction network of the YOLOv4 model to integrate the complete lithium battery electrode surface defect dataset. Input into the backbone feature extraction network module, and output the surface defect features of the lithium battery electrode ; S7-3. The enhanced feature extraction network module of the lithium battery electrode defect detection model is composed of the enhanced feature extraction network of the YOLOv4 model. The SPP module of the enhanced feature extraction network of the YOLOv4 model is replaced by the ASPP module, and the surface defect features of the lithium battery electrode are extracted. Input into the enhanced feature extraction network module, and output the feature representation after multi-scale feature fusion ; S7-4. The target detection head network module of the lithium battery electrode defect detection model is composed of the head network of the YOLOv4 model, which represents the feature after fusion of multi-scale features. Input into the target detection head network module and output the prediction result .

7. The lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion according to claim 1, characterized in that: In step S8, the Adam optimizer is used to train the lithium battery electrode defect detection model based on the attention mechanism and multi-scale feature fusion using the focal loss function to obtain an optimized lithium battery electrode defect detection model based on the attention mechanism and multi-scale feature fusion.

8. The lithium battery electrode defect detection method based on attention mechanism and multi-scale feature fusion according to claim 7 is characterized in that: It also includes deploying the optimized lithium battery electrode defect detection model based on attention mechanism and multi-scale feature fusion to the background server.