A lightweight method for solar cell defect detection based on data enhancement
Through the combination of ACGAN network and lightweight VGG19 network, false fault samples and enhanced data sets are generated, which solves the overfitting problem caused by lack of data in solar cell defect detection and realizes efficient detection on mobile devices.
Patent Information
- Application Number
- CN202210495408.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-07
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2042-05-07
AI Technical Summary
The prior art is difficult to achieve accurate, fast and efficient detection in solar cell defect detection due to lack of data in model overfitting, and the application of deep learning models on mobile devices is limited.
The data enhancement method based on ACGAN network is used to generate false fault samples, combined with the SE attention module and the lightweight improved VGG19 network, reducing model parameters and improving detection efficiency.
It alleviates the overfitting problem, shortens the model training and detection time, improves the defect detection efficiency, and makes the deep learning model suitable for mobile devices.
Smart Images

Figure CN114818501B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a lightweight method, in particular to a lightweight method for solar cell defect detection based on data enhancement, and belongs to the technical field of solar cell defect detection. Background Art
[0002] With the development of solar power generation technology, the requirements for solar cell and component inspection are getting higher and higher. This is because even tiny defects in solar cells will have an adverse effect on them and even affect their lifespan. Therefore, it is particularly important to accurately, sensitively, quickly and efficiently inspect them when they are working.
[0003] At present, the mainstream method of using images to realize fault detection is deep learning, but the effect of applying it to solar cells is not satisfactory. The main reason is the lack of defect data of solar cells, which will cause network overfitting and substandard model performance. The quality of fault sample data determines the detection upper limit of the detection model. Since it is difficult to collect fault pictures in the actual operation of the equipment, the obtained fault picture data is relatively small. If conventional methods are used to solve the problem, such as flipping, cutting, amplifying, translating, or adding corresponding noise to the pictures, only less information can be obtained by processing the pictures, and the problem cannot be solved well. Generative adversarial networks can only generate pictures that are as real as possible, and often ignore the truly critical local information. In addition, the use of large amounts of data for training often requires high-performance computers. How to make deep learning models suitable for mobile devices has also been a hot topic in recent years. Summary of the invention
[0004] The object of the present invention is to provide a lightweight method for solar cell defect detection based on data enhancement to solve the problems raised in the above background technology.
[0005] To achieve the above object, the present invention provides the following technical solution: a lightweight method for solar cell defect detection based on data enhancement, comprising the following steps:
[0006] S1: Screen the collected fault pictures of the battery cells to obtain true fault samples; and manually label the types of the pictures;
[0007] S2: Build an improved ACGAN network, use the generator to generate fake fault samples and corresponding categories based on randomly generated noise data and type information; then input the fake fault samples and real pictures into the discriminant network, and the discriminant network determines the true and false. The following actions are repeated, and the generator network and the discriminant network are trained in turn;
[0008] S3: Use the trained model to generate images only using the generator to expand the dataset;
[0009] S4: The VGG19 network structure is lightened and the input layer and fully connected layer are adjusted as needed. In addition, each standard convolutional layer in the middle of the network is split into two and modified into a combination of a depth convolution and a point convolution.
[0010] As a preferred technical solution of the present invention, in step S2, an SE attention module is introduced into the generator, the input variable is a random vector composed of random noise and classification variables, and then the output tensor is obtained through multi-layer deconvolution operations, and finally the image is generated through the tanh activation layer. The generator with an attention block extracts more obvious fault features. Nine residual blocks are added before the last convolution layer of the generator, so that the generator can obtain high-level features of the image. In order to make the generator pay more attention to the tiny areas of the image, an SE block is added to the accumulation layer of each residual block, so that the generator pays more attention to the defective part and reduces the noise of irrelevant information.
[0011] As a preferred technical solution of the present invention, in step S4, the VGG19 network structure is light-weighted, including inputting a 224*224 single-channel image into the network; first convolving it with a 3*3*1 convolution kernel;
[0012] The convolution layer in the original VGG19 network is split into depth convolution and point-by-point convolution; this can reduce the number of parameters while ensuring that the input and output sizes of the layer remain unchanged. In order to speed up the convergence of the model, the improved algorithm adds a BN layer before the activation function of each convolution layer to optimize the network. The input image size is 224*224 and the number of channels is 1;
[0013] The first layer: convolutional layer, 3*3*1, 64, 224*224*64;
[0014] The second layer: convolutional layer, 3*3*1 / 1*1*64,64, 224*224*64;
[0015] Maximum pooling layer: 112*112*128;
[0016] The third layer: convolutional layer, 3*3*1, 64 / 1*1*64, 128, 112*112*128;
[0017] The fourth layer: convolutional layer, 3*3*1, 128 / 1*1*128, 128, 112*112*128;
[0018] Maximum pooling layer: 56*56*256;
[0019] Fifth layer: convolutional layer, 3*3*1, 128 / 1*1*128, 256; 56*56*256;
[0020] The sixth layer: convolutional layer, 3*3*1, 256 / 1*1*256, 256; 56*56*256;
[0021] The seventh layer: convolution layer, 3*3*1, 256 / 1*1*256, 256; 56*56*256;
[0022] The eighth layer: convolutional layer, 3*3*1, 256 / 1*1*256, 256; 56*56*256;
[0023] Maximum pooling layer: 28*28*512;
[0024] Ninth layer: convolutional layer, 3*3*1, 256 / 1*1*256, 512; 28*28*512;
[0025] The tenth layer: convolutional layer, 3*3*1, 512 / 1*1*512, 512; 28*28*512;
[0026] Eleventh layer: convolutional layer, 3*3*1, 512 / 1*1*512, 512;: 28*28*512;
[0027] The twelfth layer (convolutional layer, 3*3*1, 512 / 1*1*512, 512; 28*28*512;
[0028] Maximum pooling layer: 14*14*512
[0029] Thirteenth layer: convolutional layer, 3*3*1, 512 / 1*1*512, 512; 14*14*512;
[0030] The 14th layer: convolutional layer, 3*3*1, 512 / 1*1*512, 512; 14*14*512;
[0031] The fifteenth layer: convolutional layer, 3*3*1, 512 / 1*1*512, 512; 14*14*512;
[0032] The 16th layer: convolutional layer, 3*3*1, 512 / 1*1*512, 512; 14*14*512;
[0033] Maximum pooling layer: 7*7*512;
[0034] Seventeenth layer: fully connected layer; 1*1*1024;
[0035] The 18th layer: fully connected layer, 1*1*512;
[0036] Nineteenth layer: fully connected layer, 1*1*4;
[0037] Softmax function;
[0038] Features are extracted through continuous convolution and pooling, and classification can be achieved through fully connected layers and softmax functions.
[0039] Compared with the prior art, the present invention has the following beneficial effects:
[0040] 1. The present invention uses the data enhancement algorithm based on the ACGAN network to expand the data set and alleviate the overfitting problem caused by insufficient training data. In addition, in order to solve the problems of large model storage space, long training and detection time, and low detection efficiency caused by the over-depth of the convolutional neural network and too many training parameters, this patent proposes to optimize the convolutional neural network structure, perform lightweight processing, reduce network training parameters, compress the model, shorten the model training and defect detection time, and improve the defect detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 ACGAN network flow chart of the present invention;
[0042] Figure 2 A network model diagram for generating the present invention;
[0043] Figure 3 It is a discriminant network model diagram of the present invention;
[0044] Figure 4 It is the improved VGG19 structure of the present invention;
[0045] Figure 5 This is a lightweight model structure for defect detection of solar cells based on the ACGAN network of the present invention. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] See also Figure 1 The present invention provides a lightweight method for defect detection of solar cells based on data enhancement.
[0048] Step 1: The SE attention module is introduced into the generator. The input variable is a random vector composed of random noise and classification variables. After multiple layers (6 layers in the present invention) of deconvolution operations, the output tensor is obtained, and finally the image is generated through the tanh activation layer. The generator with attention blocks extracts more obvious fault features. Therefore, the present invention adds 9 residual blocks before the last convolution layer of the generator so that the generator can obtain high-level features of the image. In order to make the generator pay more attention to the tiny areas of the image, an SE block is added to the accumulation layer of each residual block, so that the generator pays more attention to the defective part and reduces the noise of irrelevant information.
[0049] Step 2: Input the fake image just generated by the generator into the discriminant network, and input the real image into the discriminator. The discriminator consists of sequentially stacked convolution layers. The input image is convolved to obtain a feature vector. Each convolution layer contains a LeakyRelu and normalization. Then it is flattened and finally converted into the probability of a real or fake image using the sigmoid function. And determine what class the image belongs to.
[0050] Step 3: Define the loss function. True or false judgment loss:
[0051]
[0052] Where x represents the real data P data (x) is the real data obtained by sampling, and z represents the data obtained from the Gaussian distribution p z (z) The d-dimensional noise vector obtained by sampling.
[0053] Definition of category loss: The goal of this invention is to input a given category label c, and the generator generates a picture X of the corresponding category fake , real picture X real Given the training data, the classification loss is as follows:
[0054] L c =E[logP(C=c|X real )]+E[logP(C=c|X fake )] (2)
[0055] Overall Loss: The overall loss of the final generator and discriminator is defined as formula (3), (4).
[0056] L G =L s +L c (3)
[0057] L D =-L s +L c (4)
[0058] Step 4: Feed the result of step 2 back to the generator, and repeat steps 1 and 2 to train the discriminant network and the generator network one by one. Ideally, the training should stop when the discriminator cannot correctly identify the image and the generated image feels realistic enough. In this way, we can get enough data sets, effectively expand the training set, and reduce the risk of overfitting the model.
[0059] Step 5: Select VGG19 as the basic network and make lightweight improvements to it, reduce the number of parameters in the network model, save storage space, and shorten the defect detection time, thereby promoting the application of related algorithms in actual industrial production. The original VGG19 structure contains 16 convolutional layers, 3 fully connected layers, and 5 pooling layers. The pooling layer does not involve weights, and there are 19 weight layers in total. Although the structure is relatively simple, the number of weights contained is quite large. Figure 4 As shown in the figure, according to the requirements of this example, we first need to adjust the input layer and the fully connected layer. Our training data is a single-channel image of 224*224; therefore, the convolution kernel size of the first convolution layer is changed from the original 3×3×3 to 3×3×1, and the number of nodes in the last fully connected layer is adjusted from 1000 to 4 to represent four categories. At the same time, the number of nodes in the first and second fully connected layers is changed to 1024 and 512 to ensure smoother propagation between fully connected layers and reduce the number of weights required for transmission between fully connected layers.
[0060] More importantly, each standard convolution layer in the original network is divided into two. One convolution kernel of channel-by-channel convolution (DepthwiseConvolution) is responsible for one channel, and one channel is convolved by only one convolution kernel. For a 5×5 pixel, three-channel color input image (shape is 5×5×3), Depthwise Convolution first undergoes the first convolution operation, and DW is performed entirely in a two-dimensional plane. The number of convolution kernels is the same as the number of channels in the previous layer (channels and convolution kernels correspond one to one). Therefore, a three-channel image generates 3 feature maps after operation (if there is the same padding, the size is the same as the input layer, which is 5×5).
[0061] After Depthwise Convolution is completed, the number of feature maps is the same as the number of channels in the input layer, and the feature map cannot be expanded. Moreover, this operation performs convolution operations on each channel of the input layer independently, and does not effectively utilize the feature information of different channels at the same spatial position. Therefore, pointwise convolution is required to combine these feature maps to generate a new feature map. The operation of Pointwise Convolution is very similar to the conventional convolution operation. The size of its convolution kernel is 1×1×M, where M is the number of channels in the previous layer. Therefore, the convolution operation here will perform a weighted combination of the maps of the previous step in the depth direction to generate a new feature map. There are as many output feature maps as there are convolution kernels.
[0062] This can ensure that the input and output sizes of the layer remain unchanged while reducing the number of parameters. In order to speed up the convergence of the model, the improved algorithm adds a BN layer before the activation function of each convolutional layer to optimize the network.
[0063] The input image size is 224*224 and the number of channels is 1;
[0064] The first layer (convolutional layer, 3*3*1, 64): 224*224*64;
[0065] The second layer (convolutional layer, 3*3*1 / 1*1*64,64): 224*224*64;
[0066] Maximum pooling layer: 112*112*128;
[0067] The third layer (convolutional layer, 3*3*1, 64 / 1*1*64, 128): 112*112*128;
[0068] The fourth layer (convolutional layer, 3*3*1, 128 / 1*1*128, 128): 112*112*128;
[0069] Maximum pooling layer: 56*56*256;
[0070] The fifth layer (convolutional layer, 3*3*1, 128 / 1*1*128, 256): 56*56*256;
[0071] The sixth layer (convolutional layer, 3*3*1, 256 / 1*1*256, 256): 56*56*256;
[0072] The seventh layer (convolutional layer, 3*3*1, 256 / 1*1*256, 256): 56*56*256;
[0073] The eighth layer (convolutional layer, 3*3*1, 256 / 1*1*256, 256): 56*56*256;
[0074] Maximum pooling layer: 28*28*512;
[0075] The ninth layer (convolutional layer, 3*3*1, 256 / 1*1*256, 512): 28*28*512;
[0076] The tenth layer (convolutional layer, 3*3*1, 512 / 1*1*512, 512): 28*28*512;
[0077] Eleventh layer (convolutional layer, 3*3*1, 512 / 1*1*512, 512): 28*28*512;
[0078] The twelfth layer (convolutional layer, 3*3*1, 512 / 1*1*512, 512): 28*28*512;
[0079] Maximum pooling layer: 14*14*512
[0080] The 13th layer (convolutional layer, 3*3*1, 512 / 1*1*512, 512): 14*14*512;
[0081] The fourteenth layer (convolutional layer, 3*3*1, 512 / 1*1*512, 512): 14*14*512;
[0082] The fifteenth layer (convolutional layer, 3*3*1, 512 / 1*1*512, 512): 14*14*512;
[0083] The sixteenth layer (convolutional layer, 3*3*1, 512 / 1*1*512, 512): 14*14*512;
[0084] Maximum pooling layer: 7*7*512;
[0085] The seventeenth layer (fully connected layer): 1*1*1024;
[0086] The 18th layer (fully connected layer): 1*1*512;
[0087] The nineteenth layer (fully connected layer): 1*1*4;
[0088] Softmax function.
[0089] Features are extracted through continuous convolution and pooling, and classification can be achieved through fully connected layers and softmax functions.
[0090] The generator and discriminator in the original GAN theory are not neural networks, they only need to fit the corresponding generation and discrimination functions. The principle of the generative adversarial network is that the generator generates images and the discriminator discriminates images, and the two compete with each other to achieve a dynamic balance. However, since the noise of the generative adversarial network is random, it is impossible to obtain images of specified categories. It is necessary to specify and train a generative model for each class, which is troublesome and the workload is too large. Therefore, the ACGAN network was proposed, which connects random labels and categories. In simple terms, the input of ordinary GAN is an N-dimensional normally distributed random number, and ACGAN will add a label to this random number. It uses the Embedding layer to convert positive integers (index values) into a dense vector of fixed size, and multiply this dense vector with the N-dimensional normally distributed random number to obtain a labeled random number. At the same time, ACGAN brings deep convolutional networks into GAN with labels, which can generate higher quality pictures.
[0091] Specific implementation:
[0092] 1. This experiment is conducted on a hardware platform with Intel i7-7700HQ CPU and 8G memory GTX1060ti GPU;
[0093] 2. Install the window10 operating system on the computer, install the Anaconda software library, install the tensorflow1.13 deep learning framework, install CUDA version 10.0, cudnn acceleration package version 7.6.5 as the software environment, and use the python language;
[0094] 3. Use activate tensorflow to open the deep learning development environment;
[0095] 4. Prepare the data set. The data set used in the present invention comes from a field photo shoot, which is taken and collected by a surface defect detector. It is manually sorted to become a labeled data set, and some non-compliant pictures are manually removed. After preprocessing, the data set consists of 891 pictures.
[0096] 5. Build the structure of the generative adversarial network, define the input data size, define the initialization method of each layer, and define the loss function of the discriminant network and the generative network;
[0097] 6. Initialize the parameters of each link, first train the generator, and use random noise and classification variables to generate a pseudo image;
[0098] 7. Stop the activity of the generator and input the generated fake pictures and real pictures into the discriminator to distinguish the real and fake as much as possible;
[0099] 8. After the discriminator has distinguished clearly, stop the discrimination activity and train the generator again to produce another fake image;
[0100] 9. Select an optimization strategy to optimize the model. After multiple cycles of updating, the discriminator can no longer distinguish between real and fake images, so stop training.
[0101] 10. Generate images using the trained model to expand the dataset;
[0102] 11. Build the VGG19 network model, adjust the size of the data set to 224*224, and initialize the parameters;
[0103] Finally, defect classification is completed.
[0104] In the description of the present invention, it is necessary to understand that the indicated orientation or positional relationship is based on the orientation or positional relationship shown in the accompanying drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.
[0105] In the present invention, unless otherwise clearly stipulated and limited, for example, it can be a fixed connection, a detachable connection, or an integrated one; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. Unless otherwise clearly defined, for ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances.
[0106] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A lightweight method for solar cell defect detection based on data enhancement, It is characterized in that The following steps are involved: S1: Screen the collected fault pictures of the battery cells to obtain true fault samples; and manually label the types of the pictures; S2: Build an improved ACGAN network, use the generator to generate fake fault samples and corresponding categories based on randomly generated noise data and type information; then input the fake fault samples and real pictures into the discriminant network, and the discriminant network determines the true and false. The following actions are repeated, and the generator network and the discriminant network are trained in turn; S3: Use the trained model to generate images only using the generator to expand the dataset; S4: Improve the VGG19 network structure to be lightweight, adjust the input layer and fully connected layer as needed, and in addition, split each standard convolution layer in the middle of the network into two, modifying it into a combination of a depth convolution and a point convolution; In step S2, the SE attention module is introduced into the generator, the input variable is a random vector composed of random noise and classification variables, and then the output tensor is obtained through multi-layer deconvolution operations, and finally the image is generated through the tanh activation layer. The generator with attention blocks extracts more obvious fault features. Nine residual blocks are added before the last convolution layer of the generator, so that the generator can obtain high-level features of the image. In order to make the generator pay more attention to the tiny area of the image, an SE block is added to the accumulation layer of each residual block, so that the generator pays more attention to the defective part and reduces the noise of irrelevant information; In step S4, the VGG19 network structure is light-weighted, including inputting a 224*224 single-channel image into the network; first convolving it with a 3*3*1 convolution kernel; The convolution layer in the original VGG19 network is split into depth convolution and point-by-point convolution; this can reduce the number of parameters while ensuring that the input and output sizes of the layer remain unchanged. In order to speed up the convergence of the model, the improved algorithm adds a BN layer before the activation function of each convolution layer to optimize the network. The input image size is 224*224 and the number of channels is 1; The first layer: convolutional layer, 3*3*1, 64, 224*224*64; The second layer: convolutional layer, 3*3*1 / 1*1*64,64, 224*224*64; Maximum pooling layer: 112*112*128; The third layer: convolutional layer, 3*3*1, 64 / 1*1*64, 128, 112*112*128; The fourth layer: convolutional layer, 3*3*1, 128 / 1*1*128, 128, 112*112*128; Maximum pooling layer: 56*56*256; Fifth layer: convolutional layer, 3*3*1, 128 / 1*1*128, 256; 56*56*256; The sixth layer: convolutional layer, 3*3*1, 256 / 1*1*256, 256; 56*56*256; The seventh layer: convolution layer, 3*3*1, 256 / 1*1*256, 256; 56*56*256; The eighth layer: convolutional layer, 3*3*1, 256 / 1*1*256, 256; 56*56*256; Maximum pooling layer: 28*28*512; Ninth layer: convolutional layer, 3*3*1, 256 / 1*1*256, 512; 28*28*512; The tenth layer: convolutional layer, 3*3*1, 512 / 1*1*512, 512; 28*28*512; Eleventh layer: convolutional layer, 3*3*1, 512 / 1*1*512, 512; 28*28*512; The twelfth layer: convolutional layer, 3*3*1, 512 / 1*1*512, 512; 28*28*512; Maximum pooling layer: 14*14*512; Thirteenth layer: convolutional layer, 3*3*1, 512 / 1*1*512, 512; 14*14*512; The 14th layer: convolutional layer, 3*3*1, 512 / 1*1*512, 512; 14*14*512; The fifteenth layer: convolutional layer, 3*3*1, 512 / 1*1*512, 512; 14*14*512; The 16th layer: convolutional layer, 3*3*1, 512 / 1*1*512, 512; 14*14*512; Maximum pooling layer: 7*7*512; Seventeenth layer: fully connected layer; 1*1*1024; The 18th layer: fully connected layer, 1*1*512; Nineteenth layer: fully connected layer, 1*1*4; Softmax function; Features are extracted through continuous convolution and pooling, and classification can be achieved through fully connected layers and softmax functions.
