Battery CT image defect data enhancement method based on lightweight generative adversarial network
By optimizing the generator structure through a lightweight generative adversarial network, the problems of insufficient samples and high computational resource consumption in battery CT image defect detection are solved, generating high-quality defect images, improving detection efficiency and accuracy, and making it suitable for resource-constrained industrial applications.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG UNIV
- Filing Date
- 2025-12-30
- Publication Date
- 2026-05-01
AI Technical Summary
Existing battery CT image defect detection methods suffer from insufficient samples, complex defect features, and high computational load on the generator network, resulting in low detection efficiency and difficulty in accurately identifying minute defects.
A lightweight generative adversarial network is adopted. By introducing high-frequency loss constraints, dynamic channel scaling mechanism and adaptive feature aggregation module, the generator structure is optimized to generate high-quality and diverse battery CT image defect data, and a dataset is constructed for training.
With a limited number of samples, it generates diverse and structurally clear defect images, enriches the training dataset, improves the generalization ability and accuracy of the detection model, reduces computational resource consumption, and is suitable for resource-constrained industrial environments.
Smart Images

Figure CN121962802A_ABST
Abstract
Description
A Battery CT Image Defect Data Augmentation Method Based on Lightweight Generative Adversarial Networks Technical Field
[0001] This invention belongs to the field of computer vision and image generation, and particularly relates to a method for enhancing defect data in battery CT images based on lightweight generative adversarial networks. Background Technology
[0002] With the increasing popularity of electric vehicles, the battery, as a core component, directly impacts the safety and lifespan of the entire vehicle. Even minute defects within the battery, such as electrode breakage and metal inclusions, can lead to battery failure or even safety incidents like fires. Therefore, accurately detecting these minute defects within the battery is of significant practical importance.
[0003] Traditional battery defect detection methods rely heavily on manual inspection and conventional image processing techniques, which are inefficient and easily affected by human factors. Furthermore, because internal battery defects are typically small and complex in shape, traditional methods struggle to accurately identify them in images, and the scarcity of defect samples leads to insufficient data when training deep learning models.
[0004] In recent years, automated defect detection methods based on deep learning have been widely used, especially the advantages of Generative Adversarial Networks (GANs) in image generation and enhancement. Through adversarial training between the generator and discriminator, GANs can generate samples similar to real data, thereby effectively expanding the training dataset and improving the robustness of defect detection models. However, existing GAN methods often face problems such as high computational resource consumption and low generation quality when processing high-resolution battery CT images.
[0005] To address this issue, an image generation method based on SinGAN has been proposed. SinGAN can generate high-resolution images with diversity using a small number of training samples. However, when processing battery CT images, SinGAN suffers from long training times due to the large number of parameters. Therefore, this invention proposes a lightweight generative adversarial network (GAN). By introducing high-frequency loss, a dynamic channel scaling mechanism, and an adaptive feature aggregation module, the generator structure is optimized, improving the quality of generated images and training efficiency while reducing computational resource consumption.
[0006] This invention aims to address the problem of insufficient samples in existing battery defect detection technologies by generating high-quality, diverse battery defect images with fewer samples using an improved generative adversarial network. Summary of the Invention
[0007] The purpose of this invention is to address the problems of insufficient samples, complex defect features, and high computational cost of generative networks in existing battery CT image defect detection methods. This invention provides a battery CT image defect data augmentation method based on a lightweight generative adversarial network (GAN). By improving the GAN structure and introducing high-frequency loss constraints, dynamic channel scaling mechanisms, and an adaptive feature aggregation module, this invention achieves high-quality generation and data augmentation of minute defects in battery CT images. This method can generate diverse and structurally clear defect images even with a limited number of samples, providing rich training data support for battery internal defect detection models.
[0008] The purpose of this invention is achieved through the following technical solution: A battery CT image defect data enhancement method based on a lightweight generative adversarial network, comprising the following steps: (1) acquiring a battery CT image sample set containing electrode fracture and metal inclusion defects as input images for training; (2) constructing a multi-scale pyramid structure based on a single-image generative adversarial network, and training the generator and discriminator layer by layer from low resolution to high resolution; (3) using the Sobel operator to extract the gradient features of the generated image and the original image, and calculating the mean square error of the gradient difference to obtain the high-frequency loss; (4) introducing a dynamic channel scaling mechanism in the pyramid structure, dynamically adjusting the number of convolution channels according to the current layer resolution, and compressing the number of channels in the low-resolution stage; (5) improving the generator, adding an adaptive feature aggregation module, extracting features in parallel through the main path and auxiliary path and fusing them to generate enhanced samples containing defect information; (6) adding the generated defect samples to the original samples to construct a dataset for subsequent battery CT defect detection.
[0009] Furthermore, in step (2), the multi-scale pyramid structure of the lightweight generative adversarial network includes 9 generators and 9 discriminators. The bottom layer input is a noisy image, and the output of each layer is upsampled and then input into the next layer generator for training, so as to realize image generation from coarse to fine.
[0010] Furthermore, the high-frequency loss calculation process in step (3) includes the following sub-steps: (3.1) processing the generated image With the original image Perform Sobel convolution operations on each and extract their gradient maps; (3.2) Calculate the gradient maps of both. and The mean square error between the two values is used as the high-frequency loss, and the formula for calculating the high-frequency loss is: (3.3) Incorporate high-frequency loss into the total loss function to guide generator training; the total loss function also includes adversarial loss and reconstruction loss, wherein adversarial loss is used to measure the performance gap between the generator and the discriminator, and reconstruction loss adjusts the input noise by measuring the difference between the generated image and the real image, so that the generator generates samples similar to the real image.
[0011] Furthermore, the dynamic channel scaling mechanism in step (4) is based on the pyramid level position. Calculate channel scaling factor The formula is: Where N is the total number of layers in the pyramid. Minimum channel compression ratio; number of channels According to the formula Calculations show that The minimum channel threshold is set to 16 to prevent over-compression. The baseline number of channels set for SinGAN.
[0012] Furthermore, the generator sets a lower channel capacity in the low-resolution stage to save computation, and retains the full channel capacity in the high-resolution stage to maintain image texture details.
[0013] Furthermore, in step (5), features are extracted and fused in parallel by the main path and the auxiliary path, which includes the following sub-steps: (5.1) The main path first fuses the input noise with the generated image from the previous layer, and then extracts features through a convolutional layer to obtain the main path features. (5.2) The auxiliary path first uses a convolutional layer to extract features from the generated image of the previous layer, then uses bilinear interpolation to spatially align the outputs of the two paths, and finally uses 1×1 convolution to align the channels to obtain the auxiliary path features. (5.3) After spatial and channel alignment, the two path outputs are fused according to learnable weights. Feature fusion is performed to obtain a fused feature map. Represented as: .
[0014] Furthermore, the main path consists of five convolutional layers, each consisting of a 3×3 convolutional structure adjusted by a dynamic channel scaling mechanism, a batch normalized layer, and a LeakyReLU activation function.
[0015] Furthermore, the auxiliary path consists of three convolutional layers, bilinear interpolation, and 1×1 convolutions; each convolutional layer in the auxiliary path consists of a 1×1 convolutional structure, a batch normalization layer, and a LeakyReLU activation function.
[0016] Furthermore, regarding the first Layer generator, initial number of channels for auxiliary paths Represented as: ;
[0017] in, This represents the number of channels in the current main path.
[0018] Furthermore, the fusion weights The initial value is 0.5. During training, it is adjusted according to the total loss function. gradient The update is performed using the following formula: Where η is the learning rate, and its initial value is set to 0.0005.
[0019] Compared with the prior art, the beneficial effects of the present invention are as follows: (1) The present invention effectively solves the problem of sample imbalance by using a battery CT image defect data enhancement method based on a lightweight generative adversarial network. By generating defect images with diversity and high quality, the number of defect samples in battery CT images can be significantly increased, enriching the training dataset and improving the generalization ability and accuracy of the defect detection model in practical applications.
[0020] (2) This invention introduces high-frequency loss constraints, which can effectively improve the generator's ability to generate small defects in battery CT images. By capturing high-frequency details, the generated images are clearer in terms of edge and texture features, which helps the defect detection model to accurately identify and locate small and complex defect areas.
[0021] (3) The present invention adopts a dynamic channel scaling mechanism to optimize the generator network in a lightweight manner. The number of convolution channels is adjusted according to the image level, which can effectively reduce the amount of computation and make the model suitable for resource-constrained industrial application environments, thus having stronger practicality.
[0022] (4) The present invention combines an adaptive feature aggregation module to further improve the quality of the generated image. Through a dual-path architecture of main path and auxiliary path, the main path is responsible for extracting spatial features, and the auxiliary path performs lightweight feature supplementation. Finally, after fusion, a high-quality defect image is generated, which helps to preserve the detailed information of the defect.
[0023] (5) The generative network of the present invention, while ensuring the quality of data augmentation, has better portability through structural optimization. By adopting a lightweight structure and modular design, the storage and computing requirements of the model can be reduced, which facilitates rapid deployment and real-time detection in industrial equipment, further improving the application scope and practical value of the model. Attached Figure Description
[0024] Figure 1 is a flowchart of the battery CT image defect data enhancement method based on lightweight generative adversarial network according to the present invention; Figure 2 is a structural diagram of the lightweight generative adversarial network constructed in the embodiment of the present invention; Figure 3 is a structural diagram of the adaptive feature aggregation module constructed in the embodiment of the present invention; Figure 4 is a battery internal defect image generated by the method of the present invention in the embodiment of the present invention. Detailed Implementation
[0025] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates 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 this application. Rather, they are merely examples of methods consistent with some aspects of this application as detailed in the appended claims. It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not intended to limit this application.
[0026] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0027] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "in response to determination," or "includes." Moreover, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process or method. Without further limitations, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0028] The present invention will now be described in detail with reference to the accompanying drawings. Unless otherwise specified, the features of the following embodiments and implementations can be combined with each other.
[0029] In this embodiment, the deep learning framework PyTorch was used for the experiment. The operating system used was Ubuntu 20.04, the programming language was Python 3.8.10, the GPU was an NVIDIA GeForce RTX 4090 with 24GB of GPU memory and CUDA version 11.3.
[0030] Referring to Figure 1, the battery CT image defect data enhancement method based on lightweight generative adversarial network of the present invention specifically includes the following steps: (1) acquiring a battery CT image sample set containing electrode fracture and metal inclusion defects as the input image for training; (2) constructing a multi-scale pyramid structure based on single-image generative adversarial network (SinGAN), and training the generator and discriminator layer by layer from low resolution to high resolution; further, the lightweight generative adversarial network is shown in Figure 2. The multi-scale pyramid structure of the lightweight generative adversarial network includes 9 generators and 9 discriminators. The bottom layer input is a noisy image, and the output of each layer is upsampled and input into the generator of the next layer for training, so as to realize image generation from coarse to fine. The bottom layer input of the pyramid is a noisy image. Output generator Generated image , will generate image Image obtained by downsampling from the original image Input to discriminator The process involves making a judgment. The generated image will then be processed. Combination Layer noise, input generator Output the results, and train the generator sequentially in this manner.
[0031] Furthermore, for the first Layer generator Image scale upsampling The resulting image, multiplied by a factor of 1, can be expressed as: (3) Use the Sobel operator to extract the gradient features of the generated image and the original image, and calculate the mean square error of the gradient difference to obtain the high-frequency loss; (3.1) For the generated image With the original image Perform Sobel convolution operations on each and extract their gradient maps; (3.2) Calculate the gradient maps of both. and The mean square error between the two values is used as the high-frequency loss, and the formula for calculating the high-frequency loss is: (3.3) Add the high-frequency loss to the total loss function to guide the generator training.
[0032] Furthermore, the total loss function Losses due to confrontation Reconstruction loss and high frequency loss The composition, and its calculation formula is: ;in, The weights represent the reconstruction loss. The weights represent the high-frequency loss. Adversarial loss measures the performance gap between the generator and the discriminator, while reconstruction loss adjusts the input noise by measuring the difference between the generated image and the real image, so that the generator can generate samples similar to the real image.
[0033] (4) Introduce a dynamic channel scaling mechanism in the pyramid structure to dynamically adjust the number of convolution channels according to the current layer resolution and compress the number of channels in the low-resolution stage. It is worth noting that the generator's output channel number is set to a lower channel capacity in the low-resolution stage to save computation, while the full channel capacity is retained in the high-resolution stage to maintain image texture details.
[0034] Furthermore, the dynamic channel scaling mechanism is based on the pyramid hierarchy position. Calculate channel scaling factor The formula is: Where N is the total number of layers in the pyramid. Minimum channel compression ratio; number of channels According to the formula Calculations show that The minimum channel threshold is set to 16 to prevent over-compression. The baseline number of channels set for SinGAN.
[0035] (5) Improve the generator by adding an adaptive feature aggregation module. Extract features in parallel through the main path and auxiliary path and fuse them to generate enhanced samples containing defect information; (5.1) The main path first fuses the input noise with the generated image from the previous layer, and then extracts features through a convolutional layer to obtain the main path features. (5.2) The auxiliary path first uses a convolutional layer to extract features from the generated image of the previous layer, then uses bilinear interpolation to spatially align the outputs of the two paths, and finally uses 1×1 convolution to align the channels to obtain the auxiliary path features. (5.3) After spatial and channel alignment, the two path outputs are fused according to learnable weights. Feature fusion is performed to obtain a fused feature map. Represented as: ;
[0036] Furthermore, the adaptive feature aggregation module, as shown in Figure 3, consists of five convolutional layers in the main path. Each convolutional layer in the main path comprises a 3×3 convolutional structure adjusted by a dynamic channel scaling mechanism, a batch normalization (BN) layer, and a LeakyReLU activation function. The auxiliary path consists of three convolutional layers, bilinear interpolation, and a 1×1 convolution. Each convolutional layer in the auxiliary path comprises a 1×1 convolutional structure, a batch normalization (BN) layer, and a LeakyReLU activation function.
[0037] Furthermore, the first Initial number of channels in the auxiliary path of the layer generator , can be represented as: ;
[0038] in, This represents the number of channels in the current main path.
[0039] Table 1 Number of channels per generator layer
[0040] Furthermore, the fusion weights The initial value is 0.5. During training, it is adjusted according to the total loss function. gradient The update is performed using the following formula: Where η is the learning rate, and its initial value is set to 0.0005.
[0041] (6) Add the generated defect samples to the original samples to build a dataset for subsequent battery CT defect detection.
[0042] Furthermore, the generated defect samples are shown in Figure 4. Two electrode fracture defects and two metal particle defects were selected as samples. The first and second rows of images are the input and generated images of electrode fracture, and the third and fourth rows of images are the input and generated images of metal particle defects. Compared with the input images, the defects in the output images have diversity, which can enhance the diversity of the original dataset.
[0043] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for enhancing battery CT image defect data based on lightweight generative adversarial networks, characterized in that, Includes the following steps: (1) Obtain a set of battery CT image samples containing electrode fractures and metal inclusion defects as input images for training; (2) Construct a multi-scale pyramid structure based on a single-image generative adversarial network, and train the generator and discriminator layer by layer from low resolution to high resolution; (3) Use the Sobel operator to extract the gradient features of the generated image and the original image, and calculate the mean square error of the gradient difference to obtain the high-frequency loss; (4) Introduce a dynamic channel scaling mechanism in the pyramid structure, dynamically adjust the number of convolution channels according to the current layer resolution, and compress the number of channels in the low-resolution stage; (5) Improve the generator, add an adaptive feature aggregation module, extract features in parallel through the main path and auxiliary path and fuse them to generate enhanced samples containing defect information; (6) Add the generated defect samples to the original samples to construct a dataset for subsequent battery CT defect detection.
2. The battery CT image defect data enhancement method based on lightweight generative adversarial networks according to claim 1, characterized in that, In step (2), the multi-scale pyramid structure of the lightweight generative adversarial network includes 9 generators and 9 discriminators. The bottom layer input is a noisy image, and the output of each layer is upsampled and then input into the next layer generator for training, so as to realize image generation from coarse to fine.
3. The battery CT image defect data enhancement method based on lightweight generative adversarial networks according to claim 1, characterized in that, The high-frequency loss calculation process in step (3) includes the following sub-steps: (3.1) For the generated image With the original image Perform Sobel convolution operations on each component and extract their gradient maps; (3.2) Calculate the gradient plots of both. and The mean square error between the two values is used as the high-frequency loss, and the formula for calculating the high-frequency loss is: (3.3) Incorporate high-frequency loss into the total loss function to guide generator training; the total loss function also includes adversarial loss and reconstruction loss, wherein adversarial loss is used to measure the performance gap between the generator and the discriminator, and reconstruction loss adjusts the input noise by measuring the difference between the generated image and the real image, so that the generator generates samples similar to the real image.
4. The battery CT image defect data enhancement method based on lightweight generative adversarial networks according to claim 1, characterized in that, The dynamic channel scaling mechanism in step (4) is based on the pyramid level position. Calculate channel scaling factor The formula is: Where N is the total number of layers in the pyramid. Minimum channel compression ratio; Number of channels According to the formula Calculations show that The minimum channel threshold is set to 16 to prevent over-compression. The baseline number of channels set for SinGAN.
5. The battery CT image defect data enhancement method based on lightweight generative adversarial networks according to claim 1, characterized in that, The generator sets a lower channel capacity in the low-resolution stage to save computation, and retains the full channel capacity in the high-resolution stage to maintain image texture details.
6. The battery CT image defect data enhancement method based on lightweight generative adversarial networks according to claim 1, characterized in that, In step (5), features are extracted and fused in parallel by the main path and the auxiliary path, which includes the following sub-steps: (5.1) The main path first fuses the input noise with the generated image from the previous layer, and then extracts features through a convolutional layer to obtain the main path features. (5.2) The auxiliary path first uses a convolutional layer to extract features from the generated image of the previous layer, then uses bilinear interpolation to spatially align the outputs of the two paths, and finally uses 1×1 convolution to align the channels to obtain the auxiliary path features. ; (5.3) After spatial and channel alignment, the two path outputs are fused according to the learnable weights. Feature fusion is performed to obtain a fused feature map. Represented as: 。 7. The battery CT image defect data enhancement method based on lightweight generative adversarial networks according to claim 6, characterized in that, The main path consists of five convolutional layers, each consisting of a 3×3 convolutional structure adjusted by a dynamic channel scaling mechanism, a batch normalized layer, and a LeakyReLU activation function.
8. The battery CT image defect data enhancement method based on lightweight generative adversarial networks according to claim 6, characterized in that, The auxiliary path consists of three convolutional layers, bilinear interpolation, and 1×1 convolutions; each convolutional layer in the auxiliary path consists of a 1×1 convolutional structure, a batch normalization layer, and a LeakyReLU activation function.
9. The battery CT image defect data enhancement method based on lightweight generative adversarial networks according to claim 6, characterized in that, Regarding the first Layer generator, initial number of channels for auxiliary paths Represented as: ;in, This represents the number of channels in the current main path.
10. The battery CT image defect data enhancement method based on lightweight generative adversarial networks according to claim 6, characterized in that, The fusion weight The initial value is 0.
5. During training, it is adjusted according to the total loss function. gradient The update is performed using the following formula: Where η is the learning rate, and its initial value is set to 0.0005.