Battery CT image defect detection method based on improved YOLOv8

By improving the YOLOv8 network model, using two-dimensional Gabor filtering and dual attention mechanisms to extract and fuse features of battery CT images, combined with lightweight convolution modules, the problem of low detection accuracy of battery CT images is solved and automated defect location is achieved. and type discrimination, suitable for industrial automation detection.

CN118587158AActive Publication Date: 2024-09-03ZHEJIANG UNIV

Patent Information

Application Number
CN202410621569.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-20
Publication Date
2024-09-03
Estimated Expiration
2044-05-20

AI Technical Summary

Technical Problem

Existing battery CT image inspection methods cannot achieve automated defect location and qualitative identification, resulting in low judgment accuracy and unable to meet the needs of automated inspection in industrial scenarios.

Method used

The improved YOLOv8 network model is used to perform feature extraction and feature fusion on CT images through two-dimensional Gabor filtering, combined with a dual attention mechanism and a lightweight convolution shuffling module to replace ordinary convolutional layers to improve detection accuracy and model size.

Benefits of technology

It realizes automated defect detection of battery CT images, improves the precision and accuracy of defect detection, can automatically detect defect locations and types, distinguish battery defects from electrode background, and is suitable for industrial real-time detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587158A
    Figure CN118587158A
Patent Text Reader

Abstract

The invention discloses a battery CT image defect detection method based on improved YOLOv8, and the method comprises the steps: obtaining a defect image in a battery through CT scanning equipment, and dividing the defect image into a training set, a verification set and a test set; performing feature extraction and feature fusion on the battery CT image through two-dimensional Gabor filtering; in combination with a double attention mechanism, replacing a common convolutional layer with a lightweight convolutional shuffling module to obtain an improved network model; inputting the training set into the network model for training to obtain a trained target detection model; and performing performance evaluation on the model through the test set to obtain a battery internal defect detection result. According to the method, the YOLOv8 network is improved, and the Gabor feature extraction and fusion algorithm is combined, so that the detection precision of the CT image of the internal defect of the battery can be effectively improved, the parameter quantity of the model is reduced, and the portability is improved while the internal defect of the battery is accurately detected by the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image detection, and in particular relates to a battery CT image defect detection method based on improved YOLOv8. Background Art

[0002] Lithium-ion batteries are devices that convert and store energy based on electrochemical reactions. They are mainly composed of four parts: positive electrode, negative electrode, electrolyte and diaphragm. Internal structural defects of batteries often occur where the electrode sheets are densely stacked. Common internal defects include electrode breakage, internal impurities, electrode wrinkles, etc. These defects may cause battery performance degradation, capacity reduction, charge and discharge performance deterioration, and even cause safety problems. At present, defect detection methods for new energy vehicle batteries mainly include manual inspection, physical performance testing and non-destructive testing.

[0003] As the most common type of non-destructive testing, CT testing can obtain images of the internal structure of the battery and reconstruct the battery in three dimensions, thereby accurately detecting the internal defects of the battery. Compared with manual anatomical testing and physical performance testing, CT testing uses the attenuation law of X-rays in materials for non-contact measurement and will not cause damage to the object being tested; compared with ultrasonic testing, CT scanning can intuitively detect and locate structural defects inside the battery, with the advantages of high accuracy and high speed.

[0004] CT scanning is based on the attenuation and absorption characteristics of radiation in the object being tested. It uses an X-ray source to emit X-rays with a certain energy and intensity, and scans the object being tested from multiple directions by rotating the X-ray source at a small angle. In the process of penetrating the object being tested, the X-rays will attenuate due to absorption and scattering. The intensity of the X-rays after penetrating the object is captured by the detector, thus forming a series of two-dimensional images. Different materials inside the object being tested will show different grayscale values ​​in the two-dimensional images. The components with higher density absorb X-rays more strongly, so they show higher grayscale values ​​in the image.

[0005] However, due to the structural particularity of batteries and the complexity of defect formation, the current CT detection method still has some problems and challenges. At present, the qualitative identification method of battery CT images is still limited to manual judgment after acquiring the image. Even if machine learning is used for assistance, most of the methods are still based on manual features plus classifiers. The processing of CT images has only reached the level of size measurement and grayscale value identification, and it is impossible to achieve automated analysis of internal defects.

[0006] In summary, for battery internal defect detection, CT detection is a non-destructive detection method that combines accuracy and real-time performance, and can intuitively reflect the defects inside the battery. However, there is still a lack of suitable methods for positioning and qualitative identification of battery defect CT images. The judgment accuracy of existing methods is low and cannot meet the needs of automated detection in industrial scenarios. Therefore, how to provide an automated method for positioning and qualitative identification of battery internal defect CT images, thereby improving the accuracy of battery internal defect detection, is a technical problem that needs to be solved urgently by technicians in this field. Summary of the invention

[0007] The purpose of the present invention is to provide a battery CT image defect detection method based on improved YOLOv8 in view of the deficiencies of the prior art. The present invention extracts and fuses features of battery CT images through two-dimensional Gabor filtering; combines the dual attention mechanism and uses a lightweight convolution shuffle module to replace the ordinary convolution layer, which can effectively improve the defect detection accuracy and detection model size of battery CT images; the present invention can automatically detect defect locations, automatically identify defect types, and accurately distinguish battery defects from electrode backgrounds.

[0008] The object of the present invention is achieved through the following technical scheme: a battery CT image defect detection method based on improved YOLOv8, comprising the following steps:

[0009] (1) Using CT scanning equipment to obtain CT images containing internal defects of the battery to construct an image dataset, and divide it into a training set, a validation set, and a test set;

[0010] (2) extracting features from the CT image in the image data set through a two-dimensional Gabor filter, and fusing the extracted features to obtain a fused feature map corresponding to the current CT image;

[0011] (3) The YOLOv8 network model is improved by combining the dual attention mechanism module and the lightweight convolution shuffle module to obtain the improved YOLOv8 network model;

[0012] (4) Input the training set after two-dimensional Gabor filter feature extraction and feature fusion into the improved YOLOv8 network model for training, and adjust the parameters of the improved YOLOv8 network model according to the CIoU loss function to obtain the trained YOLOv8 network model;

[0013] (5) The test set after two-dimensional Gabor filter feature extraction and feature fusion is input into the trained YOLOv8 network model, and the type of defect image corresponding to each CT image in the test set and a txt file containing the center coordinates of the defect image prediction box and the length and width of the rectangular box are output to obtain the defect detection results of each CT image in the test set.

[0014] Furthermore, the internal defects of the battery include electrode breakage, electrode wrinkles, internal foreign matter and burrs.

[0015] Furthermore, the step (2) includes the following sub-steps:

[0016] (2.1) Adjust the CT image f(x, y) in the image data set to a grayscale image, where x and y represent the horizontal and vertical coordinates of the CT image, respectively;

[0017] (2.2) constructing a two-dimensional Gabor filter; wherein the two-dimensional Gabor filter includes a size of K, a wavelength of λ, and a phase shift of Two Gabor filter kernels with shape aspect ratio γ and parallel stripes with directions θ of 0° and 90° respectively, and the standard deviation of the two-dimensional Gabor filter in the x-axis of the time domain is σ;

[0018] (2.3) transforming the coordinates of the CT image f(x, y) adjusted to a grayscale image by a coordinate transformation equation to obtain a CT image f′(x′, y′) after coordinate adjustment, wherein x′ and y′ represent the horizontal coordinate and the vertical coordinate of the CT image after coordinate adjustment, respectively;

[0019] (2.4) inputting the coordinate-adjusted CT image f′(x′, y′) into a two-dimensional Gabor filter, and using a 0° Gabor filter kernel and a 90° Gabor filter kernel to perform step-by-step feature extraction on the coordinate-adjusted CT image in turn to obtain a first image feature and a second image feature;

[0020] (2.5) The first image feature and the second image feature are fused by feature splicing to obtain a fused feature map corresponding to the current CT image.

[0021] Furthermore, the coordinate transformation equation is expressed as:

[0022] x′=xcosθ+ysinθ (1)

[0023] y′=-xsinθ+ycosθ (2)

[0024] Among them, θ represents the direction of the parallel stripes of the Gabor filter kernel;

[0025] The calculation formula of the two-dimensional Gabor filter is:

[0026]

[0027] Among them, the coordinates x and y are transformed to obtain the coordinates x′ and y′, and λ is the filter wavelength. is the phase offset, γ is the shape aspect ratio, σ is the standard deviation of the two-dimensional Gabor filter in the time domain x-axis, and θ is the direction of the parallel stripes.

[0028] Furthermore, the step (3) includes the following sub-steps:

[0029] (3.1) After the last C2f layer in the backbone network of the YOLOv8 network model and before the SPPF module, a dual attention mechanism module is added to obtain an improved backbone network;

[0030] (3.2) All CBS modules in the feature fusion module of the YOLOv8 network model are replaced with lightweight convolutional shuffle modules to obtain an improved feature fusion module;

[0031] (3.3) An improved YOLOv8 network model is constructed based on the improved backbone network, the improved feature fusion module and the detection head of the YOLOv8 network model.

[0032] Furthermore, the dual attention mechanism module includes a channel attention module and a spatial attention module. The dual attention mechanism module takes the input feature map F∈R C×H×W After the channel attention module, the channel attention map M is obtained c ∈R C×1×1 , and then map the channel attention to M c ∈R C×1×1 And the input feature map F∈R C×H×W Perform element-by-element multiplication to obtain the feature map after channel processing; then input the feature map after channel processing into the spatial attention module to obtain the spatial attention map M s ∈R 1×H×W , and then map the spatial attention to M s ∈R 1×H×W Multiply the feature map after channel processing element by element to obtain the reconstructed feature map; where H is the height, W is the width, and C is the number of channels.

[0033] Furthermore, the channel attention module includes an average pooling layer, a maximum pooling layer, a shared network generated by a multi-layer perceptron and a sigmoid activation function, and the input of the channel attention module is a feature map F∈R C×H×W First, after passing through the average pooling layer and the maximum pooling layer, two feature maps are obtained. Then the two feature maps are passed into the shared network, and the two features output by the shared network are summed element by element to obtain the merged feature vector, which is then activated by the sigmoid activation function to obtain the channel attention map M. c ∈R C×1×1 ;

[0034] The spatial attention module includes an average pooling layer, a maximum pooling layer, a convolution layer and a sigmoid activation function. The input of the spatial attention module is a feature map after channel processing. First, after passing through the average pooling layer and the maximum pooling layer, two feature maps are obtained. Then, the two feature maps are spliced ​​in the channel dimension. The spliced ​​feature map is convolved through a convolution layer, and finally activated by a sigmoid activation function to obtain a spatial attention map M. s ∈R 1×H×W .

[0035] Furthermore, the input of the lightweight convolution shuffle module is first downsampled through a convolution layer, and then a deep convolution layer is used to implement a convolution operation on a single channel, which is then applied to multiple channels. Next, the output result of the convolution layer and the output result of the deep convolution layer are spliced ​​to obtain a feature map after convolution splicing, and then a shuffle operation is performed to mix the features output by the dense convolution operation into the output of the lightweight convolution shuffle module with small computational complexity.

[0036] Furthermore, the improved backbone network includes two CBS modules, a C2f module, a CBS module, a C2f module, a CBS module, a C2f module, a CBS module, a C2f module, a dual attention mechanism module and an SPPF module connected in sequence; the improved feature fusion module includes an Unsample module, a C2f module, an Unsample module, a C2f module, a lightweight convolution shuffle module, a C2f module, a lightweight convolution shuffle module and a C2f module.

[0037] Furthermore, the CIoU loss function is calculated by the following formula:

[0038]

[0039] Among them, CIoU Loss represents the CIoU loss function value, IoU is the intersection over union ratio of the positioning box, b is the center point of the prediction box, and b gt is the center point of the real box, ρ 2 (b,b gt ) represents the center point b and the center point b gt The Euclidean distance between them, c represents the diagonal length of the smallest enclosing rectangle that can contain both the predicted box and the true box, α represents the weight of the positioning box, and υ is the coefficient for measuring the consistency of the aspect ratio of the positioning box;

[0040] The calculation formula of the intersection-over-union ratio of the positioning frame is:

[0041]

[0042] Among them, A represents the real box, B represents the predicted box, and the intersection over union (IoU) of the positioning box is used to characterize the positioning accuracy of the YOLOv8 network model;

[0043] The calculation formula of the coefficient of measuring the consistency of the aspect ratio of the positioning frame is:

[0044]

[0045] Among them, w / h is the aspect ratio of the prediction box, w gt / h gt is the aspect ratio of the real frame;

[0046] The calculation formula of the weight of the positioning box is:

[0047]

[0048] Among them, IoU is the intersection over union ratio between the real box A and the predicted box B.

[0049] Compared with the prior art, the present invention has the following beneficial effects:

[0050] (1) The present invention first uses Gabor filtering to extract features from the CT image of internal defects in the battery, and then fuses the 0° feature and 90° feature obtained by feature extraction, thereby enhancing the contrast between the defect and the electrode background and improving the accuracy of the model in detecting CT images of internal defects in the battery. Since there is no large grayscale value difference between the electrode wrinkles and the electrode background, the present invention can effectively distinguish between the electrode wrinkles and the electrode background through Gabor feature extraction, and the detection accuracy of the electrode wrinkle defect is most significantly improved.

[0051] (2) The present invention adds the CBAM module to the YOLOv8 network model. The CBAM module obtains channel correlation and spatial correlation, strengthens features with strong correlation, and suppresses features with weak correlation and unimportant features, thereby improving the detection accuracy of the model.

[0052] (3) In industrial scenarios, the detection of CT images of internal defects in batteries needs to be transplanted to specific equipment for real-time detection, so the portability of the model is crucial. The present invention replaces the ordinary convolutional layer with GSConv, which reduces the number of parameters while ensuring accuracy, thereby reducing the memory occupied by the model and having a certain degree of portability. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 It is a flow chart of the battery CT image defect detection method based on improved YOLOv8 of the present invention;

[0054] Figure 2Flow chart of two-dimensional Gabor filter feature extraction and feature fusion in an embodiment of the present invention;

[0055] Figure 3 A battery defect image after two-dimensional Gabor filter feature extraction and feature fusion processing in an embodiment of the present invention;

[0056] Figure 4 It is a structural diagram of the improved YOLOv8 network model constructed in an embodiment of the present invention;

[0057] Figure 5 A structural diagram of a dual attention mechanism module constructed in an embodiment of the present invention;

[0058] Figure 6 A structural diagram of a channel attention module constructed in an embodiment of the present invention;

[0059] Figure 7 A structural diagram of a spatial attention module constructed in an embodiment of the present invention;

[0060] Figure 8 4 is a structural diagram of a lightweight convolution shuffle module constructed in an embodiment of the present invention;

[0061] Fig. 9 1. Detection effect diagram of four types of internal defects of batteries in an embodiment of the present invention;

[0062] Fig.10 This is a curve diagram showing the detection accuracy transformation of four types of battery internal defects when the IoU is 0.5 in an embodiment of the present invention. DETAILED DESCRIPTION

[0063] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims. It should be understood that the above general description and the detailed description that follows are merely exemplary and explanatory and cannot limit the present application.

[0064] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0065] It should be understood that, although the term first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of..." or "when..." or "in response to determination". Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process and method including a series of elements include not only those elements, but also include other elements not clearly listed, or also include elements inherent to such process and method. In the absence of more restrictions, the elements limited by the statement "including one..." do not exclude the existence of other identical elements in the process, method, article or equipment including the elements.

[0066] The present invention is described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the features of the following embodiments and implementations can be combined with each other.

[0067] In this embodiment, the battery model selected is a ternary lithium battery, the battery voltage is 3.7V, the capacity is 8000mAh, and the resolution of the selected CT machine is 2μm. The deep learning framework Pytorch is used for the experiment, the operating system used is Ubuntu20.04, the programming language is Python 3.8.10, the CPU is 7vCPU Intel(R)Xeon(R)CPU E5-2680 v4@2.40GHz, the GPU is TITAN Xp, and the GPU video memory is 12GB.

[0068] See also Figure 1 The battery CT image defect detection method based on improved YOLOv8 of the present invention specifically includes the following steps:

[0069] (1) A CT scanning device is used to obtain CT images containing internal defects of the battery to construct an image dataset, which is then divided into a training set, a validation set, and a test set.

[0070] Furthermore, the internal defects of the battery include, but are not limited to, common defects inside the battery such as electrode breakage, electrode wrinkles, internal foreign matter and burrs. The internal defects of the battery are concentrated in the electrode sheet area. For this area, a CT scanning device is used to obtain a CT image containing the internal defects of the battery to construct a data set.

[0071] (2) Figure 2As shown, the features of the CT image in the image data set are extracted through a two-dimensional Gabor filter, and the extracted features are fused to obtain a fused feature map corresponding to the current CT image.

[0072] (2.1) The CT image f(x, y) in the image dataset is adjusted to a grayscale image, where x and y represent the horizontal and vertical coordinates of the CT image, respectively.

[0073] (2.2) Construct a two-dimensional Gabor filter; wherein the two-dimensional Gabor filter includes a size of K, a wavelength of λ, and a phase shift of Two Gabor filter kernels with a shape aspect ratio of γ and parallel stripes with directions θ of 0° and 90° respectively, and a standard deviation of the two-dimensional Gabor filter in the time domain axis is σ.

[0074] (2.3) The coordinates of the CT image f(x, y) adjusted to a grayscale image are transformed by means of a coordinate transformation equation to obtain a CT image f′(x′, y′) after coordinate adjustment, wherein x′ and y′ represent the horizontal and vertical coordinates of the CT image after coordinate adjustment, respectively.

[0075] Furthermore, the coordinate transformation equation is expressed as:

[0076] x′=xcosθ+ysinθ (1)

[0077] y′=-xsinθ+ycosθ (2)

[0078] Where θ represents the direction of the parallel stripes of the Gabor filter kernel.

[0079] It should be understood that the coordinate-adjusted CT image f′(x′, y′) is in the form of a grayscale image.

[0080] (2.4) The coordinate-adjusted CT image f′(x′, y′) is input into a two-dimensional Gabor filter, and a 0° Gabor filter kernel and a 90° Gabor filter kernel are used to perform step-by-step feature extraction on the coordinate-adjusted CT image in turn to obtain a first image feature and a second image feature.

[0081] Furthermore, the calculation formula of the two-dimensional Gabor filter is:

[0082]

[0083] Among them, the coordinates x and y are transformed to obtain the coordinates x′ and y′, and λ is the filter wavelength. is the phase offset, γ is the shape aspect ratio, σ is the standard deviation of the two-dimensional Gabor filter in the time domain x-axis, and θ is the direction of the parallel stripes.

[0084] It should be noted that, according to the size K of the Gabor filter kernel, the size of the range of a single extraction can be determined to be K*K.

[0085] (2.5) The first image feature and the second image feature are fused by feature stitching to obtain a fused feature map corresponding to the current CT image. The fused feature map is a battery internal defect image that is clearly distinguishable from the electrode background.

[0086] For example, after step (2), Gabor filter feature extraction and feature fusion are performed on the internal defects of the battery, and the processing results of the four defects of the battery internal electrode fracture, electrode wrinkle, internal foreign matter, and burr are obtained as follows: Figure 3 As shown. Figure 3 It can be seen that in the original defect image, the distinction between defects and background is not obvious enough, and defect detection is difficult. The first image features extracted by the 0° and 90° Gabor filter kernels are fused with the second image features through feature splicing, so that the extracted darker features complement the brighter features, effectively suppressing the complex electrode background and enhancing the distinction between defects and background. The battery defect CT image obtained after two-dimensional Gabor filter feature extraction and feature fusion processing is the input of the subsequent improved YOLOv8 network model.

[0087] (3) The YOLOv8 network model is improved by combining the dual attention mechanism (Convolutional Block Attention Module, CBAM) module and the lightweight convolution shuffle (Group Shuffle Convolution, GSConv) module to obtain the improved YOLOv8 network model, whose structure is as follows: Figure 4 As shown, the accuracy of the YOLOv8 network model can be improved while reducing the number of parameters of the YOLOv8 network model.

[0088] (3.1) After the last C2f layer in the backbone network of the YOLOv8 network model and before the SPPF module, a CBAM module is added to obtain an improved backbone network.

[0089] It should be noted that the CBAM module can be used to extract the correlation between the channel attention and spatial attention of the feature map, thereby strengthening important features and suppressing unimportant features; and then connecting an SPPF module can ensure dimensional unity.

[0090] In this embodiment, the CBAM module includes a channel attention module and a spatial attention module, such as Figure 5 As shown, the CBAM module converts the input feature map F∈R C×H×WAfter the channel attention module, the channel attention map M is obtained c ∈R C×1×1 , and then map the channel attention to M c ∈R C×1×1 And the input feature map F∈R C×H×W Perform element-by-element multiplication to obtain the feature map after channel processing; then input the feature map after channel processing into the spatial attention module to obtain the spatial attention map M s ∈R 1 ×H×W , and then map the spatial attention to M s ∈R 1×H×W The reconstructed feature map is obtained by element-by-element multiplication with the feature map after channel processing, where H is the height, W is the width, and C is the number of channels.

[0091] The calculation process of the CBAM module can be summarized as follows:

[0092]

[0093]

[0094] Among them, F′ represents the feature map after channel processing, F″ represents the reconstructed feature map, Represents element-wise multiplication.

[0095] Furthermore, the channel attention module includes an average pooling layer, a maximum pooling layer, a shared network generated by a multilayer perceptron (MLP) and a sigmoid activation function, such as Figure 6 As shown, the input of the channel attention module is the feature map F∈R C×H×W First, after passing through the average pooling layer and the maximum pooling layer, two feature maps are obtained. Then the two feature maps are passed into the shared network, and the two features output by the shared network are summed element by element to obtain the merged feature vector, which is then activated by the sigmoid activation function with an activation size of R. C / r×1×1 , r represents the reduction rate, and the channel attention map M is obtained c ∈R C×1×1 .

[0096] The calculation method of the channel attention module can be expressed as:

[0097] M c (F)=σ(MLP(AvgPool(F))+MLP(MaxPool(F))) (6)

[0098] Among them, M c(F) is the channel attention map of the feature map F, σ is the sigmoid function, MLP represents the shared network, AvgPool represents the average pooling layer, and MaxPool represents the maximum pooling layer.

[0099] Furthermore, the spatial attention module includes an average pooling layer, a maximum pooling layer, a convolutional layer, and a sigmoid activation function, such as Figure 7 As shown in Figure 1, the input of the spatial attention module is the feature map after channel processing. First, after passing through the average pooling layer and the maximum pooling layer, two feature maps are obtained. Then, the two feature maps are spliced ​​in the channel dimension. The spliced ​​feature map is convolved through the convolution layer and finally activated by the sigmoid activation function to obtain the spatial attention map M. s ∈R 1×H×W .

[0100] The calculation method of the spatial attention module can be expressed as:

[0101] M s (F′)=σ(f 7×7 ([AvgPool(F′)+MaxPool(F′)])) (7)

[0102] Among them, M s (F′) is the spatial attention map of the feature map F′ after channel processing, f 7×7 It is a 7×7 convolution operation.

[0103] (3.2) Replace all CBS modules in the feature fusion (Neck) module of the YOLOv8 network model with GSConv modules to obtain the improved feature fusion module.

[0104] It should be noted that the role of Neck is to fuse the high-level features processed by Backbone features with the low-level features and transmit them to the detection head (Head) for detection.

[0105] In this embodiment, the structure of the GSConv module is as follows: Figure 8 As shown in the figure, the input of the GSConv module is first downsampled by the convolution (Conv) layer, and then a convolution operation is implemented on a single channel using the depthwise convolution (DWConv) layer, which is then applied to multiple channels. Next, the output of the convolution layer and the output of the depthwise convolution layer are concatenated to obtain a convolution-concatenated feature map, which is then shuffled so that the features output by the dense convolution operation are mixed into the output of the GSConv module with a small amount of computation.

[0106] It should be understood that the GSConv module effectively avoids the irrelevant cost of extracting channel correlation in the CBS module by focusing only on the deep convolutional layer of spatial correlation between channels, thereby reducing the number of parameters in the improved YOLOv8 network model.

[0107] (3.3) An improved YOLOv8 network model is constructed based on the improved backbone network, the improved feature fusion module and the detection head of the YOLOv8 network model.

[0108] like Figure 4 As shown in the figure, the improved backbone network includes two CBS modules, C2f modules, CBS modules, C2f modules, CBS modules, C2f modules, CBS modules, C2f modules, CBAM modules and SPPF modules connected in sequence; the improved feature fusion modules include Unsample modules, C2f modules, Unsample modules, C2f modules, GSConv modules, C2f modules, GSConv modules and C2f modules. Among them, the purpose of the Unsample module is to increase the dimension and enlarge the high-level small feature map to facilitate fusion with the low-level large feature map, and then detect it through the detection head of the YOLOv8 network model.

[0109] (4) The training set after two-dimensional Gabor filter feature extraction and feature fusion is input into the improved YOLOv8 network model for training, and the parameters of the improved YOLOv8 network model are adjusted according to the CIoU loss function to obtain the trained YOLOv8 network model.

[0110] Specifically, the fused feature map corresponding to the CT image in the training set after the two-dimensional Gabor filter feature extraction and feature fusion in step (2) is input into the improved YOLOv8 network model for iterative training, and the predicted defect image with the prediction box annotation and the txt file containing the center coordinates of the defect image prediction box and the length and width of the rectangular box are output. The CIoU loss function is calculated according to the output result and the corresponding label (i.e., the coordinates of the real box and its corresponding length and width of the rectangular box). The CIoU loss function value is minimized as the optimization goal, and the parameters of the improved YOLOv8 network model are adjusted until the CIoU loss function value is less than the preset loss threshold or the preset training rounds are reached, and the training is stopped to obtain a trained YOLOv8 network model.

[0111] Furthermore, the CIoU loss function is calculated as follows:

[0112]

[0113] Among them, CIoU Loss represents the CIoU loss function value, IoU is the intersection over union ratio of the positioning box, b is the center point of the prediction box, and bgt is the center point of the real box, ρ 2 (b,b gt ) represents the center point b and the center point b gt The Euclidean distance between them, c represents the diagonal length of the smallest enclosing rectangle that can contain both the predicted box and the true box, α represents the weight of the positioning box, and υ is the coefficient for measuring the consistency of the aspect ratio of the positioning box.

[0114] Furthermore, the calculation formula of the intersection-over-union ratio of the positioning box is:

[0115]

[0116] Among them, A represents the real box, B represents the predicted box, and the intersection over union (IoU) of the positioning box is used to characterize the positioning accuracy of the YOLOv8 network model.

[0117] Furthermore, the calculation formula of the coefficient for measuring the consistency of the aspect ratio of the positioning box is:

[0118]

[0119] Among them, w / h is the aspect ratio of the prediction box, w gt / h gt is the aspect ratio of the real frame.

[0120] Furthermore, the calculation formula of the weight of the positioning box is:

[0121]

[0122] Among them, IoU is the intersection over union ratio between the real box A and the predicted box B.

[0123] (5) The test set after two-dimensional Gabor filter feature extraction and feature fusion is input into the trained YOLOv8 network model, and the type of defect image corresponding to each CT image in the test set and a txt file containing the center coordinates of the defect image prediction box and the length and width of the rectangular box are output to obtain the defect detection results of each CT image in the test set.

[0124] Specifically, by inputting the test set into the final model, the detection results can be obtained, such as Fig. 9 As shown, the performance of the model can be judged. The model after detection outputs a detection image with defects selected by the prediction box, and the defect type is marked above the rectangular box. At the same time, a txt file containing the center coordinates of the defect prediction box and the length and width of the rectangular box is output according to each image. The defects after detection are selected by the rectangular box, and the type of defects is marked above the rectangular box. Among them, the mark ① is the electrode wrinkle defect, the mark ② is the electrode break defect, the mark ③ is the internal foreign matter defect, and the mark ④ is the burr defect. Fig. 9 shown.

[0125] Furthermore, after using the test set for prediction, the performance indicators of the YOLOv8 network model can be calculated to evaluate the performance of the YOLOv8 network model. The performance indicators of the YOLOv8 network model include accuracy, recall, precision, average precision and parameter quantity, and their calculation formulas are:

[0126]

[0127]

[0128]

[0129]

[0130] Among them, P is the precision, R is the recall, TP indicates the true value predicted by the model as positive, FP indicates the error value predicted by the model as positive, and FN indicates the error value predicted by the model as negative; AP is the accuracy, mAP is the average precision, n is the total number of samples in the test set, and i is the i-th sample in the test set.

[0131] It should be understood that the accuracy rate represents the ratio of the true value predicted by the model to all the positive results, and the recall rate represents the ratio of the number of correctly predicted positive samples to the total number of correctly predicted samples. For example, assuming that the image is tested for the defect of electrode wrinkles, TP means that the image does have electrode wrinkles and is detected, FP means that there are no electrode wrinkles in the image but the model considers it to be a defect after detection, and FN means that there is no defect in the image and it is detected that the image does not have a defect.

[0132] Exemplarily, the original YOLOv8 model is trained using a battery internal defect CT image dataset, and the training results are compared with those obtained by the improved YOLOv8 network model of the present invention. The comparison results are shown in Table 1.

[0133] Table 1: Comparison of training conditions of different models

[0134]

[0135] It can be seen from the experimental results that the improved YOLOv8 model described in the present invention has the best detection performance for battery defect CT images. When IoU is set to 0.5, mAP reaches 98.2%, and when IoU is set to 0.75, mAP reaches 90.2%. Based on the original YOLOv8 model, the improved YOLOv8 model described in the present invention has an average accuracy improvement of 4.1% when IoU is set to 0.75, and the number of parameters is reduced by 25,000. The detection accuracy of the four defects is improved, and the highest accuracy is improved by 8.5%. Therefore, compared with the original YOLOv8 model, the improved YOLOv8 model described in the present invention has a higher detection accuracy while having fewer parameters, which verifies the superiority of the improved YOLOv8 model described in the present invention.

[0136] After the YOLOv8 deep learning algorithm is improved by the method of the present invention, the detection accuracy of each defect when IoU is 0.5 is as follows Fig.10 As shown. The detection accuracy of each defect is above 96.9%. The defect categories are marked by labels, the specific categories of defects can be effectively detected, and the coordinates of the defects are recorded in txt files. Therefore, when the method described in the present invention is applied to the detection of four defects such as battery internal electrode fracture, electrode wrinkles, internal foreign matter, and burrs, the defects can be accurately framed in the picture and the categories of defects can be given, so that the main defects inside the battery can be effectively identified.

[0137] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A battery CT image defect detection method based on improved YOLOv8, characterized in that: The following steps are involved: (1) Using CT scanning equipment to obtain CT images containing internal defects of the battery to construct an image dataset, and divide it into a training set, a validation set, and a test set; (2) extracting features from the CT image in the image data set through a two-dimensional Gabor filter, and fusing the extracted features to obtain a fused feature map corresponding to the current CT image; (3) The YOLOv8 network model is improved by combining the dual attention mechanism module and the lightweight convolution shuffle module to obtain the improved YOLOv8 network model; (4) Input the training set after two-dimensional Gabor filter feature extraction and feature fusion into the improved YOLOv8 network model for training, and adjust the parameters of the improved YOLOv8 network model according to the CIoU loss function to obtain the trained YOLOv8 network model; (5) The test set after two-dimensional Gabor filter feature extraction and feature fusion is input into the trained YOLOv8 network model, and the type of defect image corresponding to each CT image in the test set and a txt file containing the center coordinates of the defect image prediction box and the length and width of the rectangular box are output to obtain the defect detection results of each CT image in the test set.

2. The battery CT image defect detection method based on improved YOLOv8 according to claim 1, characterized in that: The internal defects of the battery include electrode breakage, electrode wrinkles, internal foreign matter and burrs.

3. The battery CT image defect detection method based on improved YOLOv8 according to claim 1, characterized in that: The step (2) comprises the following sub-steps: (2.1) Adjust the CT image f(x, y) in the image data set to a grayscale image, where x and y represent the horizontal and vertical coordinates of the CT image, respectively; (2.2) constructing a two-dimensional Gabor filter; wherein the two-dimensional Gabor filter includes a size of K, a wavelength of λ, and a phase shift of Two Gabor filter kernels with shape aspect ratio γ and parallel stripes with directions θ of 0° and 90° respectively, and the standard deviation of the two-dimensional Gabor filter in the time domain x-axis is σ; (2.3) transforming the coordinates of the CT image f(x, y) adjusted to a grayscale image by a coordinate transformation equation to obtain a CT image f′(x′, y′) after coordinate adjustment, wherein x′ and y′ represent the horizontal coordinate and the vertical coordinate of the CT image after coordinate adjustment, respectively; (2.4) inputting the coordinate-adjusted CT image f′(x′, y′) into a two-dimensional Gabor filter, and using a 0° Gabor filter kernel and a 90° Gabor filter kernel to perform step-by-step feature extraction on the coordinate-adjusted CT image in turn to obtain a first image feature and a second image feature; (2.5) The first image feature and the second image feature are fused by feature splicing to obtain a fused feature map corresponding to the current CT image.

4. The battery CT image defect detection method based on improved YOLOv8 according to claim 3 is characterized in that: The coordinate transformation equation is expressed as: x ′ =xcosθ+ysinθ (1) y ′ =-xsinθ+ycosθ (2) among them, θ represents the direction of the parallel stripes of the Gabor filter kernel; The calculation formula of the two-dimensional Gabor filter is: Among them, the coordinates x and y are transformed to obtain the coordinate x ′ ,y ′ , λ is the filter wavelength, is the phase offset, γ is the shape aspect ratio, σ is the standard deviation of the two-dimensional Gabor filter in the time domain x-axis, and θ is the direction of the parallel stripes.

5. The battery CT image defect detection method based on improved YOLOv8 according to claim 1, characterized in that: The step (3) comprises the following sub-steps: (3.1) After the last C2f layer in the backbone network of the YOLOv8 network model and before the SPPF module, a dual attention mechanism module is added to obtain an improved backbone network; (3.2) All CBS modules in the feature fusion module of the YOLOv8 network model are replaced with lightweight convolutional shuffle modules to obtain an improved feature fusion module; (3.3) An improved YOLOv8 network model is constructed based on the improved backbone network, the improved feature fusion module and the detection head of the YOLOv8 network model.

6. The battery CT image defect detection method based on improved YOLOv8 according to claim 5, characterized in that: The dual attention mechanism module includes a channel attention module and a spatial attention module. The dual attention mechanism module takes the input feature map F∈R C×H×W After the channel attention module, the channel attention map M is obtained c ∈R C×1×1 , and then map the channel attention to M c ∈R C×1×1 And the input feature map F∈R C×H×W Perform element-by-element multiplication to obtain the feature map after channel processing; then input the feature map after channel processing into the spatial attention module to obtain the spatial attention map M s ∈R 1×H×W , and then map the spatial attention to M s ∈R 1×H×W Multiply the feature map after channel processing element by element to obtain the reconstructed feature map; where H is the height, W is the width, and C is the number of channels.

7. The battery CT image defect detection method based on improved YOLOv8 according to claim 6, characterized in that: The channel attention module includes an average pooling layer, a maximum pooling layer, a shared network generated by a multi-layer perceptron and a sigmoid activation function. The input of the channel attention module is the feature map F∈R C×H×W First, after passing through the average pooling layer and the maximum pooling layer, two feature maps are obtained. Then the two feature maps are passed into the shared network, and the two features output by the shared network are summed element by element to obtain the merged feature vector, which is then activated by the sigmoid activation function to obtain the channel attention map M. c ∈R C×1×1 ; The spatial attention module includes an average pooling layer, a maximum pooling layer, a convolution layer and a sigmoid activation function. The input of the spatial attention module is a feature map after channel processing. First, after passing through the average pooling layer and the maximum pooling layer, two feature maps are obtained. Then, the two feature maps are spliced ​​in the channel dimension. The spliced ​​feature map is convolved through a convolution layer, and finally activated by a sigmoid activation function to obtain a spatial attention map M. s ∈R 1×H×W .

8. The battery CT image defect detection method based on improved YOLOv8 according to claim 5, characterized in that: The input of the lightweight convolution shuffle module is first downsampled through the convolution layer, and then a deep convolution layer is used to implement a convolution operation on a single channel, which is then applied to multiple channels. Next, the output result of the convolution layer and the output result of the deep convolution layer are spliced ​​to obtain a convolution-joined feature map, and then a shuffle operation is performed to mix the features output by the dense convolution operation into the output of the lightweight convolution shuffle module with a small amount of computation.

9. The battery CT image defect detection method based on improved YOLOv8 according to claim 5, characterized in that: The improved backbone network includes two CBS modules, a C2f module, a CBS module, a C2f module, a CBS module, a C2f module, a CBS module, a C2f module, a dual attention mechanism module and an SPPF module connected in sequence; the improved feature fusion module includes an Unsample module, a C2f module, an Unsample module, a C2f module, a lightweight convolution shuffle module, a C2f module, a lightweight convolution shuffle module and a C2f module.

10. The battery CT image defect detection method based on improved YOLOv8 according to claim 1, characterized in that: The CIoU loss function is calculated by the following formula: Among them, CIoU Loss represents the CIoU loss function value, IoU is the intersection over union ratio of the positioning box, b is the center point of the prediction box, and b gt is the center point of the real box, ρ 2 (b,b gt ) represents the center point b and the center point b gt The Euclidean distance between them, c represents the diagonal length of the smallest enclosing rectangle that can contain both the predicted box and the true box, α represents the weight of the positioning box, and υ is the coefficient for measuring the consistency of the aspect ratio of the positioning box; The calculation formula of the intersection-and-union ratio of the positioning frame is: Among them, A represents the real box, B represents the predicted box, and the intersection over union (IoU) of the positioning box is used to characterize the positioning accuracy of the YOLOv8 network model; The calculation formula of the coefficient of measuring the consistency of the aspect ratio of the positioning frame is: Among them, w / h is the aspect ratio of the prediction box, w gt / h gt is the aspect ratio of the real frame; The calculation formula of the weight of the positioning box is: Among them, IoU is the intersection over union ratio between the real box A and the predicted box B.

Citation Information

Patent Citations

  • Lightweight target detection method and system based on YOLOv8 improvement

    CN116740538A

  • Visual SLAM method and system based on lightweight target detection network

    CN116740539A

  • Gabor feature fused YOLOv3 aviation composite material surface defect target detection method

    CN116823741A

  • System and method for detecting surface defects of lithium battery pole piece

    CN116934762A

  • Vehicle door surface defect detection method based on improved YOLOv8 network

    CN117173096A

Cited By

  • Thin film capacitor electrode defect detection method, device, equipment and medium

    CN119151920A

  • CT flaw detection auxiliary method and equipment based on instance segmentation model and storage medium

    CN119417833A

  • Lithium battery surface defect detection method based on deep learning multi-channel fusion

    CN119478486A

  • Automobile power battery collision test device and system thereof

    CN119555322A

  • An automotive power battery collision test device and its system

    CN119555322B