A lithium battery defect detection method based on improved YOLOv4

By improving the YOLOv4 network model, adding hollow convolution and ECA-Net modules, and using conditional convolution, the problem of small target defect detection on the surface of lithium batteries in the prior art is solved, and higher detection accuracy and positioning accuracy are achieved, and the leakage detection rate is reduced.

CN114049313BActive Publication Date: 2025-02-28SHANGHAI DIANJI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111260837.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2025-02-28
Estimated Expiration
2041-10-28

AI Technical Summary

Technical Problem

The prior art is difficult to effectively detect small target defects on the surface of lithium batteries, and cannot achieve the balance between detection speed and accuracy, resulting in a high leakage detection rate.

Method used

Improve the YOLOv4 network model, expand the receptive field by adding hollow convolution to the backbone feature extraction network, and inserting a lightweight ECA-Net module into the neck network, to improve the receptive field and semantic information acquisition ability of the model, and at the same time use conditional convolution in the YOLO Head part.

Benefits of technology

The improved YOLOv4 model can more accurately identify four defects on the surface of lithium battery, the predicted bounding box is closer to the real defect area, and the segmentation is more complete, which improves detection accuracy and positioning accuracy, and reduces industrial leakage detection rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114049313B_ABST
    Figure CN114049313B_ABST
Patent Text Reader

Abstract

The present invention relates to a lithium battery defect detection method based on improved YOLOv4, comprising the steps of: 1) acquiring a lithium battery surface defect image; 2) marking the defect type and defect position of the acquired lithium battery surface defect image, generating a data set, preprocessing the data set, and dividing the processed data set into a training set and a test set; 3) improving the backbone feature extraction network of the YOLOv4 network model, adding a dilated convolution to expand the receptive field, acquiring an optimized improved YOLOv4 network model, and training the optimized improved YOLOv4 network model based on the training set; 4) using the trained improved YOLOv4 network model to test the surface defects of the lithium battery. Compared with the prior art, the present invention has the advantages of high detection accuracy and reduced missed detection rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of deep learning technology, and in particular to a lithium battery defect detection method based on improved YOLOv4. Background Art

[0002] Since the 20th century, with the technological development of the microelectronics industry, small electrical equipment has put forward higher requirements for power sources, and lithium batteries have gradually been widely used. However, as key materials for manufacturing lithium batteries, the tabs and pole pieces of lithium batteries are very prone to defects such as bubbles, indentations, and breakage during the production process, which has a great impact on the safety of lithium batteries and is related to personal safety. Since there are many production links that form defects and the reasons are different, the rate of missed detection of surface defects in lithium batteries is extremely high. Therefore, extracting various complex defects from images and more effectively realizing the detection of surface defects of lithium batteries is an important part of visual inspection.

[0003] In recent years, the target detection framework has become a research hotspot. The target detection algorithms based on deep learning are mainly divided into two categories: One-Stage and Two-Stage. One-Stage algorithms are represented by the YOLO series, SSD, etc., while Two-Stage algorithms are represented by R-CNN, Fast R-CNN, etc. Since the advent of YOLOv1, after continuous experiments and improvements, YOLOv4 can now well balance detection speed and accuracy, showing obvious advantages in the direction of small target detection, and is widely used in the direction of defect detection. However, there are currently few studies on the detection of lithium battery surface defects using deep learning methods. The research mainly focuses on using Opencv to preprocess images and threshold segmentation.

[0004] In actual detection, small target defects are easily blurred with the background color, so it is difficult for conventional algorithms to accurately extract the location and characteristics of lithium battery defects. Deep learning has flourished in recent years, and the model framework has been updated and iterated rapidly. However, due to hardware conditions, existing technologies cannot meet the needs of today's lithium battery defect detection, and speed and accuracy cannot be balanced. Summary of the invention

[0005] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a lithium battery defect detection method based on improved YOLOv4.

[0006] The purpose of the present invention can be achieved by the following technical solutions:

[0007] A lithium battery defect detection method based on improved YOLOv4, the method comprising the following steps:

[0008] S1: Acquire the surface defect image of lithium battery.

[0009] Furthermore, a high-precision industrial linear scanning camera is used to capture images of lithium battery surface defects.

[0010] S2: Label the defect type and defect location of the acquired lithium battery surface defect image, generate a data set, preprocess the data set, and divide the processed data set into a training set and a test set.

[0011] Furthermore, Labelimg software is used to annotate the defect types and defect locations of the acquired lithium battery surface defect images to generate a data set.

[0012] The preprocessing of the dataset includes data enhancement operations including scale transformation, random flipping and contrast adjustment.

[0013] S3: Improve the backbone feature extraction network of the YOLOv4 network model, add dilated convolution to expand the receptive field, obtain the optimized improved YOLOv4 network model, and train the optimized improved YOLOv4 network model based on the training set.

[0014] The specific contents of the backbone feature extraction network for improving the YOLOv4 network model are as follows:

[0015] When segmenting the images of the training set, dilated convolution is injected instead of downsampling and upsampling operations. The distance between data is controlled by adjusting the expansion rate. The receptive field of the model is expanded without reducing the feature resolution. High-level semantic information is obtained by upsampling and feature maps are output.

[0016] The formula for the size of the convolution kernel after adjusting the dilation rate is:

[0017] K′=(D-1)×(K-1)+K

[0018] Where: K′ is the size of the equivalent convolution kernel; K is the convolution kernel of the dilated convolution; D is the dilation rate.

[0019] A lightweight ECA-Net module is inserted into the neck network of the improved YOLOv4 network model.

[0020] The ECA-Net module uses a fast one-dimensional convolution of size Q to obtain channel weights. Based on the aggregation characteristics of the given global average pooling layer, the value is adaptively adjusted through a function. Since the channel dimension is usually an exponent of 2, the expression is as follows:

[0021] C=Φ(Q)=2 (λ*Q-b)

[0022]

[0023] Where: C is the channel dimension, |x| odd is the nearest odd number, λ=2, b=1.

[0024] The YOLO Head part of the improved YOLOv4 network model is provided with conditional convolution, and in the Condconv layer, the convolution kernel is calculated as a function of the input example.

[0025] The expression of the output feature map is:

[0026]

[0027] Where: V out is the size of the output feature map; V in is the size of the input feature map; F is the size of the convolution kernel; P is the number of circles filled with the feature map; S is the step size of the convolution.

[0028] S4: Use the trained improved YOLOv4 network model to test the surface defects of lithium batteries.

[0029] The lithium battery defect detection method based on improved YOLOv4 provided by the present invention has at least the following beneficial effects compared with the prior art:

[0030] 1) Although the existing original YOLOv4 model can accurately detect various defects on the surface of lithium batteries, it cannot completely segment all defect areas, and is prone to missed detection in areas with similar defects. The model fails to identify damaged defects and has a high missed detection rate. The improved YOLOv4 model proposed in the present invention can not only effectively identify four defects, but also the bounding box predicted by the improved model is closer to the real defect area than the original model, and the segmentation is more complete, indicating that the improved YOLOv4 model of the present invention not only improves the detection accuracy, but also has more accurate positioning.

[0031] 2) Compared with traditional manual defect detection, defects with larger areas and higher contrast can still be detected by the naked eye, but small-area or similarly blurred defects are basically imperceptible to the naked eye; the present invention, under the high-precision camera of machine vision, through an improved defect detection model, can more effectively detect small damage, bubbles, indentations, and abnormal defects, thereby reducing the industrial missed detection rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 The four defects on the surface of the lithium battery in the embodiment are shown in the figure, wherein sub-figure (a) is a damage defect, sub-figure (b) is a bubble defect, sub-figure (c) is an indentation defect, and sub-figure (d) is an abnormal ear defect;

[0033] Figure 2 This is a schematic diagram of defect labeling based on Labelimg software in the embodiment;

[0034] Figure 3 Schematic diagram of the dilated convolution structure in the embodiment;

[0035] Figure 4 This is a schematic diagram of the ECA-Net structure in the embodiment;

[0036] Figure 5 It is the iterative process of network training in the embodiment;

[0037] Figure 6 Schematic diagram of model detection in the embodiment, wherein sub-figure (a) is a schematic diagram of original YOLOv4 model detection, and sub-figure (b) is a schematic diagram of improved YOLOv4 model detection;

[0038] Figure 7 Graph showing the experimental verification results of the defect detection method in the embodiment. DETAILED DESCRIPTION

[0039] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work should belong to the scope of protection of the present invention.

[0040] Example

[0041] Although the existing original YOLOv4 model can accurately detect various defects on the surface of lithium batteries, it cannot completely segment all defect areas and is prone to missed detection in areas with similar defects, such as Figure 6 As shown in sub-figure (a), the model failed to identify the damage defect and had a high missed detection rate. The present invention relates to a lithium battery defect detection method based on improved YOLOv4, and the main improvements of the method are: 1. The traditional convolution in the YOLOv4 backbone network is replaced by a hole convolution, while ensuring that the amount of calculation does not increase, the receptive field is expanded, so that the network obtains higher-level semantic information and improves detection accuracy. 2. The channel attention mechanism ECA-Net is introduced into the feature pyramid network FPN, so that the model pays more attention to the learning of edge information of small target defects, further improving the detection effect. 3. Using conditional convolution instead of conventional convolution in classification and bounding box regression can not only improve the capacity of the model, but also maintain efficient reasoning. The specific technical scheme of the method of the present invention is as follows:

[0042] I. Surface defect detection

[0043] 1.1 Lithium battery defects

[0044] The surface defect images of lithium batteries are collected by high-precision industrial linear scanning cameras on site, such as CCD cameras. Lithium battery pole pieces are divided into two parts: the pole lug and the pole piece. Due to the limitations of the production process, there are usually multiple defects on the surface of the pole lug and the pole piece. According to the location and shape of the defects, four defect types are defined: breakage, bubbles, pole lug abnormalities and indentations. The specific defect types are as follows: Figure 1 shown.

[0045] 1.2 Defect Detection Process

[0046] The defect detection process of the present invention first collects lithium battery images, uses Labelimg software to annotate the defect type and defect location of the surface defects of the lithium battery images, and after generating a data set, divides it into a training set and a test set at a ratio of 8:2; secondly, improves the backbone feature extraction network of the YOLOv4 network model, adds a hole convolution to expand the receptive field, inserts a lightweight attention channel module into the neck network to adaptively select the one-dimensional convolution kernel size, reduces the complexity of the model, and fuses conditional convolution in classification and bounding box regression to improve the robustness of the model. Finally, the lithium battery surface defect model is trained and generated in the optimized YOLOv4 network model to test the lithium battery surface defects.

[0047] II. Experimental Procedure

[0048] 2.1 Data enhancement and sample preparation

[0049] The surface defect images of lithium batteries are collected using an industrial CCD camera. The preliminary data collection contains a total of 420 lithium battery defect images. Due to the small amount of original data, it is impossible to ensure that the number of samples for each defect meets the requirements, so data enhancement is performed. Data enhancement is to effectively avoid overfitting of test results by performing operations such as scaling, random flipping, and contrast adjustment on the original images, so as to make the model better adapt to new samples and enhance the generalization ability of the model. After data enhancement, the data set contains a total of 1,752 defective images, which contain one or more defects. 80% of the defective images are randomly selected for training, and the remaining 20% ​​of the images are used to make test sets. The experimental sample data are manually labeled using the labeling software labelimg (such as Figure 2 As shown), and generate the corresponding XML format file.

[0050] 2.2 Improving the network

[0051] 2.2.1 Dilated Convolution

[0052] Generally speaking, the image segmentation algorithm uses the pooling layer to compress the features and simplify the network complexity, while the convolution layer is mainly used to extract edge information and image features. Therefore, the process of shrinking and then enlarging the feature map causes the loss of image feature information. The present invention injects a hole convolution instead of downsampling and upsampling operations during image segmentation, thereby increasing the receptive field while ensuring that the size of the feature map remains unchanged. The output size of the feature map is shown in formula (1):

[0053]

[0054] Among them, V out is the size of the output feature map; V in is the size of the input feature map; F is the size of the convolution kernel; P is the number of circles filled with the feature map; S is the step size of the convolution.

[0055] In order to adapt to the data of larger defects on the surface of lithium batteries, the present invention adds dilated convolution on the basis of traditional convolution. Introducing dilated convolution in the feature transfer layer, the distance between data is controlled by adjusting the dilation rate, and the receptive field of the model is expanded without reducing the feature resolution, so that higher-level semantic information can be obtained during upsampling. The larger the dilation rate is set, the larger the corresponding convolution kernel size is, and the larger the feature extraction receptive field is. Figure 3 It can be seen that for the same 3×3 convolution, the receptive field can be expanded to 5×5 and 7×7.

[0056] The convolution kernel size with the dilation rate added is calculated as shown in formula (2):

[0057] K′=(D-1)×(K-1)+K (2)

[0058] Wherein, K′ is the size of the equivalent convolution kernel; K is the convolution kernel of the dilated convolution; and D is the dilation ratio. Since the sizes of defect targets to be detected by the present invention vary greatly, the dilation ratio is adjusted to 2. The addition of dilated convolution better improves the detection effect of targets of different sizes.

[0059] 2.2.2 ECA-Net

[0060] The attention mechanism is one of the effective means to enhance the depth of neural networks. This paper inserts a lightweight ECA-Net module into the neck network of the original YOLOv4 model. This module can adaptively select the size of the one-dimensional convolution kernel and maintain the dimension during local cross-channel interaction to achieve performance improvement. Its structure is as follows Figure 4As shown. By giving the aggregation characteristics of the global average pooling layer (GAP), the ECA module uses a fast one-dimensional convolution of size Q to obtain the channel weights, and adjusts the values ​​adaptively through the function. In the mapping relationship, the simplest is a linear relationship, such as Φ(Q) = λ*Qb. However, the relationship characterized by a linear function is too limited. On the other hand, the channel dimension C (that is, the number of filters) is usually an exponent of 2. Therefore, we introduce a possible solution by expanding the linear function Φ(Q) = λ*Qb to a nonlinear function. The formula is as follows:

[0061] C=Φ(Q)=2 (λ*Q-b) (3)

[0062]

[0063] Where |x| odd Represents the odd number closest to x. In the present invention, we set λ=2 and b=1 respectively. Obviously, by mapping Ψ, the high-dimensional channel has a longer interaction distance, while the low-dimensional channel has a shorter interaction distance through nonlinear mapping. The ECA-Net module is flexible and lightweight, and can significantly improve the performance of various lightweight neural networks, especially in the MobileNet series. At the same time, ECA-Net also demonstrates good robustness in real-time object detection and image segmentation tasks.

[0064] 2.2.3 Conditional Convolution

[0065] At present, the improvement of model size and capacity has greatly optimized the performance of convolutional neural networks. However, the increase in model size has further increased the computational complexity and the difficulty of deploying excellent models. In order to more effectively improve the model capacity, the present invention adds conditional convolution to the YOLO Head part, so that expert knowledge only needs to be integrated once, so that the model maintains efficient reasoning. In conventional convolutional layers, the same convolution kernel is used for all input examples. In the Condconv layer, the convolution kernel is calculated as a function of the input example, which can be obtained by formulas (5) and (6):

[0066] output(x)=σ((α1·W1+…+α n ·W n )*x) (5)

[0067] r(x)=Sigmoid((x)R) (6)

[0068] Among them, r(x) is an intermediate quantity; x is the output of the previous layer, n is the number of experts in this layer, and σ is the activation function. The instance-related routing weight α is calculated from the layer input through three steps i =r i(x): Global average pooling (GAP), fully connected layers, and sigmoid activation. R is the learned weight matrix that maps the pooled input to n expert weights, α i =r i is a sample-dependent weighting parameter. Before the convolution operation, i (x) Calculate the coefficient α of each expert i , and then through linear combination, finally convolved with the input x. The present invention selects the parameter 1 according to the input of the convolution layer.

[0069] 2.3 Network Training

[0070] After calibrating the experimental sample images of four types of defects, namely breakage, bubbles, tab anomalies and indentations, the corresponding xml format tag files were generated. A deep learning model was built based on the YOLOv4 architecture, and the number of samples in a batch of training samples was set to batch = 16, the momentum parameter momentum = 0.9, the weight decay regularization term decay = 0.0005, and the maximum number of iterations max batches = 2500. Figure 5 This is the real-time change of the loss function value during the experimental sample training process as the number of iterations increases. Figure 5 It can be seen that the loss value tends to be stable when the number of iterations reaches 2500, with good convergence. The final loss function value of the improved YOLOv4 model is significantly lower than that of the original model.

[0071] 2.4 Beneficial effects

[0072] 2.4.1 Comparison of two defect detection methods

[0073] Although the original YOLOv4 model can accurately detect various defects on the surface of lithium batteries, it cannot completely segment all defect areas and is prone to missed detection in areas with similar defects, such as Figure 6 As shown in sub-figure (a), the model failed to identify the damage defect and had a high missed detection rate. The improved YOLOv4 model proposed in the present invention can not only effectively identify the four defects, but also the bounding box predicted by the improved model is closer to the real defect area than the original model, and the segmentation is more complete. This shows that the improved YOLOv4 model not only improves the detection accuracy, but also has more accurate positioning. Figure 6 As shown in sub-figure (b).

[0074] Compared with traditional manual defect detection, defects with larger areas and higher contrast can still be detected by the naked eye, but small or similarly blurred defects are basically imperceptible to the naked eye. Under the high-precision camera of machine vision, through the above defect detection model, small damage, bubbles, indentations, and abnormal defects can be more effectively detected, reducing the industrial missed detection rate.

[0075] 2.4.2 Detection results obtained using the defect detection model

[0076] like Figure 7 As shown, an industrial camera is used to collect defect images of lithium battery pole pieces, and the improved YOLOv4 defect detection model of the present invention is used to detect the defective part, so that the defect type and location can be obtained more accurately.

[0077] According to the detection results, the defect detection system proposed by the present invention can effectively detect the positions of four physical defects and can identify the complex contours of the defects.

[0078] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person familiar with the technical field can easily think of various equivalent modifications or substitutions within the technical scope disclosed by the present invention, and these modifications or substitutions should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A lithium battery defect detection method based on improved YOLOv4, characterized in that: The following steps are involved: 1) Obtaining images of lithium battery surface defects; 2) Annotate the defect type and defect location of the acquired lithium battery surface defect images, generate a data set, preprocess the data set, and divide the processed data set into a training set and a test set; 3) Improve the backbone feature extraction network of the YOLOv4 network model, add dilated convolution to expand the receptive field, obtain the optimized improved YOLOv4 network model, and train the optimized improved YOLOv4 network model based on the training set; 4) Use the trained improved YOLOv4 network model to test the surface defects of lithium batteries; In step 3), the specific content of the backbone feature extraction network of the improved YOLOv4 network model is: When segmenting the images of the training set, a dilated convolution is injected to replace the downsampling and upsampling operations. The distance between the data is controlled by adjusting the expansion rate. The receptive field of the model is expanded without reducing the feature resolution. The high-level semantic information is obtained by upsampling and the feature map is output. The YOLO Head part of the improved YOLOv4 network model is provided with conditional convolution, and in the Condconv layer, the convolution kernel is calculated as a function of the input example.

2. The lithium battery defect detection method based on improved YOLOv4 according to claim 1, characterized in that: In step 1), a high-precision industrial linear scanning camera is used to capture images of surface defects of lithium batteries.

3. The lithium battery defect detection method based on improved YOLOv4 according to claim 1, characterized in that: In step 2), Labelimg software is used to annotate the defect type and defect location of the acquired lithium battery surface defect image to generate a data set.

4. The lithium battery defect detection method based on improved YOLOv4 according to claim 3, characterized in that: The preprocessing of the dataset includes data enhancement operations including scale transformation, random flipping and contrast adjustment.

5. The lithium battery defect detection method based on improved YOLOv4 according to claim 1, characterized in that: The formula for the size of the convolution kernel after adjusting the dilation rate is: K ′ =(D-1)×(K-1)+K Where: K ′ is the size of the equivalent convolution kernel; K is the convolution kernel of the dilated convolution; and D is the dilation rate.

6. The lithium battery defect detection method based on improved YOLOv4 according to claim 1, characterized in that: A lightweight ECA-Net module is inserted into the neck network of the improved YOLOv4 network model.

7. The lithium battery defect detection method based on improved YOLOv4 according to claim 6, characterized in that: The ECA-Net module uses a fast one-dimensional convolution of size Q to obtain channel weights. Based on the aggregation characteristics of the given global average pooling layer, the value is adaptively adjusted through a function. Since the channel dimension is usually an exponent of 2, the expression is as follows: C=Φ(Q)=2 (2*Q-b) Where: C is the channel dimension, |x| odd is the nearest odd number, λ=2, b=1.

8. The lithium battery defect detection method based on improved YOLOv4 according to claim 1, characterized in that: The expression of the output feature map is: Where: V out is the size of the output feature map; V in is the size of the input feature map; F is the size of the convolution kernel; P is the number of circles filled with the feature map; S is the step size of the convolution.

Citation Information

Patent Citations

  • Smoking recognition method, device and equipment for logistics warehouse and storage medium

    CN112287768A

  • Lithium battery diaphragm defect machine vision detection method based on deep learning

    CN112950547A