CN111476307B - Lithium battery surface defect detection method based on depth field adaptation - Google Patents

Lithium battery surface defect detection method based on depth field adaptation Download PDF

Info

Publication number
CN111476307B
CN111476307B CN202010282872.7A CN202010282872A CN111476307B CN 111476307 B CN111476307 B CN 111476307B CN 202010282872 A CN202010282872 A CN 202010282872A CN 111476307 B CN111476307 B CN 111476307B
Authority
CN
China
Prior art keywords
domain
model
classifier
adaptation
feature
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010282872.7A
Other languages
Chinese (zh)
Other versions
CN111476307A (en
Inventor
刘坤
焦广成
张建华
刘铁旭
陈海永
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hebei University of Technology
Original Assignee
Hebei University of Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hebei University of Technology filed Critical Hebei University of Technology
Priority to CN202010282872.7A priority Critical patent/CN111476307B/en
Publication of CN111476307A publication Critical patent/CN111476307A/en
Application granted granted Critical
Publication of CN111476307B publication Critical patent/CN111476307B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/8851Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • G01N21/8851Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
    • G01N2021/8887Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges based on image processing techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02EREDUCTION OF GREENHOUSE GAS [GHG] EMISSIONS, RELATED TO ENERGY GENERATION, TRANSMISSION OR DISTRIBUTION
    • Y02E60/00Enabling technologies; Technologies with a potential or indirect contribution to GHG emissions mitigation
    • Y02E60/10Energy storage using batteries

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Mathematical Physics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Signal Processing (AREA)
  • Chemical & Material Sciences (AREA)
  • Analytical Chemistry (AREA)
  • Biochemistry (AREA)
  • Immunology (AREA)
  • Pathology (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides a method for detecting surface defects of a lithium battery based on depth field adaptation, which designs an adaptation layer based on statistics such as maximum mean difference MMD and KL divergence in a classifier, and designs a field discriminator after feature extraction for counterdiscriminating which field the extracted features come from. On one hand, the two-way complementary mechanism can enable the extracted two-domain public features to be more sufficient, and on the other hand, the statistic-based adaptation layer design can enable the target domain data to participate in the training of the classifier, so that the model has better generalization capability on the target domain. The model designs a simple and effective multi-scale feature fusion strategy in the feature extraction network, and can have a good identification effect on small defects. The method has high-efficiency detection effect, relieves the dependence of deep learning on the tag data, and the trained model has better generalization capability on the target domain data.

Description

Lithium battery surface defect detection method based on depth field adaptation
Technical Field
The invention relates to the technical field of machine vision, and particularly provides a lithium battery surface defect detection method based on depth field adaptation.
Background
Currently, lithium ion batteries are increasingly widely used, such as mobile phones, notebooks, electric automobiles, and the like, and form a huge industrial group. But some defects generated during the production process seriously affect the life span and safety factor of the lithium battery. Such as edge banding, creasing, pole piece scoring, foil exposure, particles, perforations, dark spots, foreign matter, surface dents, stains, bulges, code spraying deformation, and the like. The traditional method for battery defect detection is manual measurement and judgment. However, the battery detection result is affected by subjective intention, emotion, visual fatigue and other artificial factors of the detection personnel, so that the condition of missed detection and false detection occurs. The machine vision detection system can overcome the defect of manual detection, so that the detection result is standard and quantifiable, and the automation degree of the whole production system is improved; not only saving the labor cost, but also avoiding the errors caused by the manual statistics data.
Recently, a great number of students at home and abroad apply deep learning technology to surface defect detection of lithium batteries, wherein Zhou Jiahe et al (Zhou Jiahe, jiuyuan) utilize convolutional neural network to detect electrode defects of lithium batteries [ J ]. Electronic measurement technology, 2019 (19) provide a lithium battery electrode defect detection method taking Convolutional Neural Network (CNN) as a core, and the characteristic extracted by CNN of a complete area image of a battery electrode is sent to a support vector SVM machine to give a final prediction detection result. This method requires a lot of training data with labels, and labeling of the data requires a lot of manpower and material costs. The deep field adaptation technique can alleviate the dependence of the deep learning model on the tag data. The deep domain adaptation method is a representative branch of deep migration learning, which uses a labeled dataset similar to the dataset to be detected as the source domain, and the dataset to be detected as the target domain (the target domain data may not need to be labeled).
The existing depth field adaptation method cannot be directly applied to surface defect detection of lithium batteries, and the recognition rate is not ideal.
Disclosure of Invention
The invention aims to solve the defects in the prior art, and designs a lithium battery surface defect detection method based on depth field adaptation.
In order to achieve the above purpose, the invention adopts the following technical scheme:
a lithium battery surface defect detection method based on depth field adaptation, the depth field adaptation model design of the method comprises:
the feature extractor is constructed based on a convolutional neural network and is used for automatically extracting effective features from the input image;
the classifier is composed of a sub-module which is formed by a full-connection layer and used for accurately classifying the characteristics;
the field discriminator is a sub-module formed by the full connection layer and used for carrying out second class discrimination on the characteristics from a source domain or a target domain;
the model is connected with a field discriminator behind the feature extractor and connected with a classifier in parallel; designing an adaptation layer in the classifier, wherein the adaptation layer refers to the maximum mean value difference (MMD) and KL divergence as measurement criteria, calculating the difference of the two domain feature distribution of a source domain and a target domain, and minimizing the difference value to update model parameters; the image data of the source domain are the surface defect data of the lithium battery collected on different production lines or the defect images collected by collecting systems of different factories; the target field is an image of a defect acquired on a production line to be inspected.
The adaptation layer introduces the Maximum Mean Difference (MMD) and KL divergence as statistics to calculate the difference of the two-domain feature distribution, and the adaptation layer self-adaptation loss function L con Is of formula (1):
L con =MMD(S,T)+λD KL (p||q) (1)
wherein MMD (S, T) is a calculation formula of MMD, wherein S, T respectively represents a source domain and a target domain; d (D) KL (p||q) is a calculation formula of KL divergence, wherein p represents an original distribution, and q represents a simple distribution used for approximating p; lambda is the balance systemNumber calculated from formula (2):
Figure BDA0002447372760000021
wherein i is the number of steps of the current training, and N is the total number of training steps.
In the training process of the depth field adaptation model, the data flow paths of the source field and the target field are different, and the total loss function comprises three items:
Figure BDA0002447372760000023
where α, β are balance parameters, the update rule for each loss in back propagation is:
Figure BDA0002447372760000022
wherein μ represents a learning rate, θ represents a corresponding module parameter, f represents a feature extractor, c represents a classifier, and d represents a domain discriminator; l is a cross entropy loss function, d s ,d t Domain labels that are source and target domains;
during back propagation, the adaptive loss function L con Updating parameters before the adaptation layer of the feature extractor F and the classifier; resistance loss function
Figure BDA0002447372760000024
The parameters of the feature extractor F and the domain discriminator D are updated; classification loss function L c For updating the parameters of the feature extractor F and of the whole classifier C.
The feature extractor of the depth field adaptation model is based on a VGG-16 network and comprises five groups of convolution operations, each group of convolution operations consists of two or three convolution layers, a batch normalization layer and a pooling layer which follow the corresponding convolution layers, and a feature map of 512 channels which are sampled 32 times is finally output after the five groups of convolution operations; a multi-scale feature fusion strategy is fused in the feature extraction process, wherein a branch is added after the output feature graphs of the third group and the fourth group of convolution operations, convolution operation and pooling operation are carried out on each branch, three branches are added for the output of the fifth group of convolution operations of VGG-16, the final output feature graph of each branch is 4*4, the output feature graphs of the three branches are stretched, one-dimensional vectors are stretched, and then the one-dimensional vectors are spliced together to form a one-dimensional vector of 4 x 3, and the one-dimensional vector is the feature vector after fusion. All convolution kernels of the VGG-16 network have the size of 3 multiplied by 3, the step length of 1, the pooling window size of 2 multiplied by 2, and the step length of 2; the convolution kernel size of the branch after the third group of convolution operation is 3*3, the step length is 2, the pooling window size is 2 x 2, and the step length is 2; the convolution kernel size 3*3 of the fourth set of subsequent branches has a step size of 1 and a pooling window size of 2 x 2, step size 2.
The method for detecting the surface defects of the lithium battery comprises the following specific steps:
step 1: source domain and destination domain data preparation:
the source domain data is similar to the target domain data but different from the target domain data and has a common tag space, the source domain data is to be marked, and the target domain data does not need to be marked;
step 2: design of depth field adaptation model:
the depth domain adaptation model comprises a feature extractor, a classifier which is composed of a full-connection layer and is used for accurately classifying the features, and a domain discriminator which is composed of a full-connection layer and is used for carrying out a second class discrimination on whether the features come from a source domain or a target domain,
the model is connected with a field discriminator behind the feature extractor and connected with a classifier in parallel; designing an adaptation layer in the classifier, wherein the adaptation layer refers to the maximum mean value difference MMD and KL divergence as measurement criteria, calculating the difference of the two domain feature distribution of a source domain and a target domain, and minimizing the difference value to update model parameters;
step 3: training of a model:
1) Cutting or scaling the source domain data and the target domain data into uniform sizes, adjusting the sizes of the pictures to 128 x 128, and manufacturing a small batch n of data formats which are suitable for the input of the depth domain adaptation model to form a data set;
2) The source domain data and the target domain data are simultaneously input into a depth domain adaptation model, and in a forward propagation stage, the source domain data are fed into the model in small batches n and are divided into two branches after passing through a feature extractor, one branch enters a classifier, and an output end is arranged at the adaptation layer and the last layer of the classifier; the other branch enters the domain discriminator and flows out from the last layer of the domain discriminator;
the target domain data stream is also fed into the model in small batch m, and is divided into two branches after passing through the feature extractor, one branch enters the classifier and flows out through the adaptive layer, and the last layer of the classifier is not passed at the moment; the other branch flows out through the domain discriminator, m=n;
3) Calculation of the loss function:
the data streams of the source domain and the target domain calculate an adaptive loss function L at the output of the adaptation layer con The source domain data stream calculates a classification cross entropy loss function L at the classifier output c The data streams of the source domain and the target domain calculate a two-class cross entropy loss function at the output end of the domain discriminator
Figure BDA0002447372760000031
I.e. the antagonism loss function;
4) The loss function back propagates the update parameters, the total loss function is the formula (7), and the update rule of the model parameters is (8);
Figure BDA0002447372760000032
Figure BDA0002447372760000041
5) Repeating the steps 2) -4), completing one period of training of the model when the whole training data set participates in training once, and circularly training until the total loss function converges, and completing the training of the model;
step 4: after the model is trained, storing the model, and transplanting the model into a server of a detection system on a lithium battery production line, wherein the model on the production line only needs a trained feature extractor and classifier, and an adaptation layer and a field discriminator need to be removed in a test stage;
step 5: on-line testing stage:
and (3) inputting the on-line acquired lithium battery surface image into the depth field adaptation model detection grafted in the step (4) and used for the production line, so as to realize detection and identification of the lithium battery surface defects.
The surface defect types of the lithium battery are 7 types of surface dents, stains, surface bulges, folds, pole piece scratches, particles and dark spots, the identification accuracy rate of the pole piece scratches, the surface dents and the surface bulges is not lower than 85%, and the identification accuracy rate of other defects is not lower than 90%.
Compared with the prior art, the invention has the beneficial effects that:
the method is most critical in that an unsupervised depth field adaptation model is applied to the detection of the surface defects of the lithium battery, has the efficient detection effect of a deep learning technology, relieves the dependence of the deep learning on tag data, does not need a large amount of training data with tags on the premise of ensuring the identification accuracy and the real-time performance, reduces the labor cost, and has better generalization capability on the target field data by the trained model, and the performance is far better than that of the traditional machine vision and the general field adaptation method.
The depth field adaptation model of the present invention comprises three parts: a feature extractor based on a deep convolutional neural network, a classifier based on a fully connected layer and a domain arbiter. Different from other depth domain models, the depth domain adaptation model in the invention combines two characteristic distribution alignment modes of taking statistics as a measurement criterion and domain countermeasure discrimination to realize domain alignment. The model designs an adaptation layer in a classifier, the adaptation layer refers to the Maximum Mean Difference (MMD) and KL divergence as measurement criteria, and the difference of two-domain distribution is calculated. And minimize this value to update the model parameters. On the other hand, the model is connected in parallel with a classifier after the feature extractor, and the classifier is connected in parallel with a domain discriminator, and the discriminator performs a second class discrimination on whether the input feature distribution is from the source domain or the target domain. The feature extractor updates the parameters based on the most confusing of the discriminator results, and the discriminator updates the parameters based on the most accurate determination of the source of the feature, in which game the final convergence result is that the feature passing through the feature extractor cannot be determined by the powerful discriminator, and the feature is the domain unchanged. On one hand, the two-way complementary mechanism can enable the extracted two-domain public features to be more sufficient, and on the other hand, the statistic-based adaptation layer design can enable the target domain data to participate in the training of the classifier, so that the model has better generalization capability on the target domain.
According to the invention, the two characteristic distribution alignment modes of taking statistics as a measurement criterion and domain countermeasure discrimination are combined in the design of the depth domain adaptation model to realize domain alignment, so that on one hand, the alignment degree of two domains is enhanced, on the other hand, the data of the target domain can participate in the training of the classifier (calculating the characteristics of MMD and KL which both need the data of the target domain), the generalization capability on the target domain is strong, and the recognition rate of surface defects is improved.
Aiming at the defects of some tiny scratches and dents on the surface of a lithium battery, dark spots, particles and the like on a battery substrate, a simple convolutional neural network is difficult to extract effective features of the tiny targets, and for this purpose, a multi-scale feature fusion strategy is integrated in a feature extraction process by a depth model designed in the invention so as to solve the problem that the defects of the small targets are difficult to identify, and a simple and effective multi-scale feature fusion strategy is added, so that feature map information of different scales and receptive fields can be effectively integrated, and the comprehensive extraction capacity of basic geometric features and high-grade semantic features (the high-grade semantic features are macroscopic features such as defect types, and the basic geometric features are fine structural information such as outlines, textures and edges of the defects) is improved. The method has good recognition effect on the tiny defects which are difficult to detect, avoids the construction of a complex network structure, reduces the processing capacity of a computer, realizes light weight and has lower calculation cost.
Drawings
FIG. 1 is a diagram of a model for detecting surface defects of a lithium battery based on depth field adaptation;
FIG. 2 is a schematic diagram of a disclosed multi-scale feature fusion strategy;
FIG. 3 is a flow chart of detecting defects on the surface of a lithium battery based on depth field adaptation;
reference numerals: 1. source domain data; 2. target domain data; 3. a convolution layer; 4. grouping one layer (BN); 5. pooling layers; 6. a full connection layer; 7. an adaptation layer; 8. a source domain data stream; 9. a target domain data stream; 10. fused feature vectors; 11. a feature extractor; 12. a classifier; 13. a domain discriminator; 14. a third set of feature graphs output by convolution operation; 15. a fourth set of feature graphs output by convolution operation; 16. a fifth set of feature graphs output by convolution operations; 17. a convolution operation; 18. pooling operation; 19. and (5) stretching operation.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
As shown in fig. 1, the invention relates to a depth field adaptation-based lithium battery surface defect detection model, which comprises three sub-modules: feature extractor, classifier and domain arbiter. The model is an all-new domain adaptation model for realizing distribution alignment by combining a minimized statistic and a countermeasure discrimination method.
The feature extractor is a submodule which is built by using a convolutional neural network and is used for extracting effective features of an input sample. The feature extractor was developed on the basis of VGG-16, which contains five sets of convolution operations. Each group of convolution operation consists of two or three convolution layers 3, a batch normalization layer 4 and a pooling layer 5, wherein all convolution kernels are 3×3 in size, step sizes are 1, pooling window sizes are 2×2, and step sizes are 2.
The input original image is calculated and extracted feature layer by layer, and the feature map of 512 channels which is sampled 32 times is finally output after five groups of convolution operations. Unlike the original VGG-16, the feature extractor proposed by the present invention adds a Batch Normalization (BN) layer after the convolutional layer and applies a new feature fusion strategy on the output vector. BN is an operation of normalizing intermediate results of a batch of data in CNN, so that the training process can be accelerated, and the training model can be optimized. As shown in fig. 2, the multi-scale feature fusion strategy is designed for the tiny defect of the lithium battery, specifically, a branch is added after the feature graphs are output by the convolution operation of the third group and the fourth group, wherein the size of the feature graph 14 output by the convolution operation of the third group is 16 x 16, the convolution kernel size of the rear branch is 3*3, the step length is 2, the pooling window size is 2 x 2, and the step length is 2; the size of a feature diagram 15 output by the fourth group of convolution operation is 8 x 8, the branch of the feature diagram output by the fourth group of convolution operation is subjected to convolution operation 17 and pooling operation 18, the convolution kernel size 3*3, the step size is 1, the pooling window size is 2 x 2, and the step size is 2; the structure of VGG-16 is added, three branches are shared, the final output characteristic diagram of each branch is 4*4, the output characteristic diagrams on the three branches are stretched 19 into one-dimensional vectors, and then the one-dimensional vectors are spliced together to form a one-dimensional vector of 4 x 3, and the vector is the fused characteristic vector 10.
Feature maps of different scales are translated to the same size as the last feature map. The feature maps are stretched into one-dimensional vectors and then spliced into a new fusion vector, which is the output vector of the feature extractor. And inputting the obtained characteristic vector into a domain discriminator. The strategy can integrate the feature map information of different scales and receptive fields, and improves the comprehensive extraction capability of basic geometric features and advanced semantic features. The method is beneficial to effectively identifying the tiny defects which are difficult to detect.
The classifier designed by the invention comprises an adaptation layer 7, wherein the adaptation layer refers to the maximum mean value difference (MMD) and KL divergence as the difference measurement of the characteristic distribution of the two domains, and the common characteristics of the two domains can be obtained by minimizing the difference measurement in the whole model optimization process. MMD is a loss function most widely used (currently) in transfer learning, especially in domain adaptation, mainly to measure the distance of two different but related distributions. KL divergence is an asymmetric measure that can measure how much information is lost when a simple distribution approximates a complex distribution. The introduction of KL divergence can correct the problem that MMD does not fully extract the common characteristics of two domains. The loss function of the adaptation layer is defined as:
L con =MMD(S,T)+λD KL (p||q) (1)
wherein, MMD (S, T) is a calculation formula of MMD, wherein S, T respectively represents a source domain and a target domain. D (D) KL (p||q) is a calculation formula of KL divergence, wherein p represents the original distribution, and q represents a simple distribution used to approximate p. λ is the equilibrium coefficient, and the formula given by training experience is as follows:
Figure BDA0002447372760000061
wherein i is the number of steps of the current training, and N is the total number of training steps. The formulas for MMD and KL divergence are as follows:
Figure BDA0002447372760000062
wherein φ (·) represents a mapping, x s Representing source domain samples, x t Representing a target domain sample. n and m are small batches (batch size) of source and destination domain data. H represents measuring distance by mapping data to regenerated Hilbert space (RKHS).
Figure BDA0002447372760000063
In which p (x) j ) Is the distribution of the target domain, q (x i ) Is the distribution of source domain, as above, n=m is the small batch size of source and target domain data.
In addition to the loss of adaptation layer, the cross entropy loss function of the last layer in the classifier under supervised training of source domain data is as follows:
L c =L(C(F(x s )),y s ) (5)
wherein L is a cross entropy loss function, F is a feature extractor mapping function, C is a classifier mapping function, x s Representing source domain samples, y s Representing the source domain sample tag.
The structure of the domain discriminator is actually a classifier, only one class of discrimination is needed for the input feature vector, and in order to simplify the training step, the parameters of the domain discriminator and the feature extractor are replaced by a feature inversion operation for alternate updating. This operation enables challenge discrimination to become entirely an end-to-end conventional classification problem during training. The loss function of the domain arbiter is thus as follows:
Figure BDA0002447372760000077
where L is the cross entropy loss function, x s ,x t Samples representing source and target domains, d s ,d t Is the domain label of the source domain and the target domain, F is the feature extractor mapping function, and D is the domain discriminator mapping function.
Based on the above description of the three sub-modules, the final total loss function is as follows:
Figure BDA0002447372760000071
where α, β are balance parameters for adjusting the trade-off between these two quantities during learning. The sign-down occurs due to the gradient inversion operation. The parameter update rules are as follows:
Figure BDA0002447372760000074
where μ is the learning rate and θ represents the corresponding module parameter. During back propagation, the adaptive loss function L con Parameters before the feature extractor F and classifier adaptation layer can be updated; countermeasure againstSexual loss function
Figure BDA0002447372760000075
The parameters of the feature extractor F and the domain discriminator D are updated; classification loss function L c For updating the parameters of the feature extractor F and of the whole classifier C. The update of equation (8) may be achieved by random gradient descent (SGD).
In order to better illustrate the training process and parameter updating rules, training details and the overall detection flow are given in fig. 3.
Step 1: source domain and destination domain data preparation. The source domain data is similar to the target domain data but different from the target domain data and has a common label space, and is generally a defect picture collected on different manufacturers or production lines of lithium batteries or a defect image collected by different collection systems. The target field is the image acquired on the production line where defect detection is to be performed. For source domain data, labels are to be carried, which can be done by domain participants, and are usually better acquired.
Step 2: the depth field is adapted to the design of the model. The design combines two different feature distribution alignment approaches to reduce inter-domain variability. A new adaptation layer is provided to realize a statistic-based minimized distribution method, the adaptation layer refers to the maximum mean difference MMD and KL divergence as statistics to calculate the characteristic distribution difference of two domains, the KL divergence is an asymmetric measure, and the method can measure how much information is lost when the simple distribution approximates to the complex distribution. The introduction of KL divergence can correct the problem that MMD is insufficient in extracting the common features of two domains, especially under the condition that complex background interference is caused to the surface defects of the lithium battery, the introduction position of the adaptation layer in the embodiment is before and next to the last layer in the classifier; and a multi-scale feature fusion strategy is fused in the process of convolutional neural network extraction.
Step 3: training of the model.
1) And (3) adjusting the source domain data and the target domain data, properly cutting or scaling the source domain data and the target domain data into uniform sizes, adjusting the sizes of pictures to 128 x 128, and manufacturing the pictures into data formats which are suitable for depth domain adaptation model input in small batches n to form a data set.
2) The source domain data and the target domain data are simultaneously input into the model, as shown in fig. 1, in the forward propagation stage, the source domain data are sent into the model in small batches n, and are divided into two branches after passing through the feature extractor, one branch enters the classifier, and the adaptation layer (the structure before the adaptation layer of the classifier can obtain the training of the target domain data, so that the more the adaptation layer is, the stronger the generalization capability of the classifier to the target domain) and the last layer of the classifier have output ends. The other branch enters the domain discriminator and flows out through the last layer of the discriminator. The target domain data stream is also fed into the model in small batches m, and is divided into two branches after passing through the feature extractor, wherein one branch enters the classifier and flows out through the adaptation layer (at the moment, the last layer of the classifier is not passed). The other branch flows out through the domain discriminator.
3) And (5) calculating a loss function. The data streams of the source domain and the target domain calculate an adaptive loss function L at the output of the adaptation layer con The source domain data stream calculates a classification cross entropy loss function L at the classifier output c The data streams of the source domain and the target domain calculate a two-class cross entropy loss function at the output end of the domain discriminator
Figure BDA0002447372760000081
I.e. the antagonism loss function.
4) The loss function back propagates the update parameters. The total loss function is shown as a formula (7), and the updating rule of the model parameters is shown as a formula (8).
5) Repeating the steps 2) -4), completing one period of training of the model when the whole training data set participates in training once, and circularly training until the total loss function converges, thereby completing the training of the model.
Step 4: and after the model is trained, storing the model, and transplanting the model into a server of a detection system on a lithium battery production line. The model used on the production line only needs to train the feature extractor and the classifier, the adaptation layer and the domain discriminator are only used for training the model, and the model needs to be removed in the test stage.
Step 5: in-line testing phase. And inputting the image acquired on the line into the model detection transplanted in the step 4 and used for the production line, wherein the detection time of the single image is 0.2s, and the requirement of production efficiency is met.
In this embodiment, experiments were performed on 7 defect images such as surface pits, stains, surface bulges, wrinkles, pole piece scratches, particles, dark spots, and the like of a lithium battery, wherein the identification accuracy rates of the pole piece scratches, the surface pits, and the surface bulges are respectively 87.32%, 85.41%, 85.46%, and the identification rates of other defects are all above 90%. The relevant parameters in the experiment were set as follows: the input picture size is 128 x 128 pixels, the training burst size is 32, the training period is 100, and n, m in 200 batches (training burst corresponds to step 2) each period is also n, m in formulas 3, 4. 200 batches per cycle refers to (source domain data lumped sample number/small batch size 32=200). The period corresponds to a cyclic training period set in the model training. The total number of training steps n= (source field data lumped sample number/small lot size 32) cyclic training period) in equation (2). The learning rate is 0.0001, the total training step number N in the formula (2) is 100 x 200, and alpha and beta in the formula (7) respectively take 0.66 and 0.34.
The setting of parameters in training is related to a specific data set, for example, the cycle training period is determined according to the convergence degree of the total loss function, the convergence is early and quick, then the cycle number is smaller appropriately, otherwise, the cycle number is larger, and the larger cycle training period is set empirically during model training, so that the model training can meet the aim of realizing the total loss function in the cycle training period to achieve convergence. The size of the training small lot should not be too small.
The principles and embodiments of the present invention have been described in detail with reference to specific examples, which are provided to facilitate understanding of the method and core ideas of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.
The invention is applicable to the prior art where it is not described.

Claims (6)

1. A lithium battery surface defect detection method based on depth field adaptation, the depth field adaptation model design of the method comprises:
the feature extractor is constructed based on a convolutional neural network and is used for automatically extracting effective features from the input image;
the classifier is composed of a sub-module which is formed by a full-connection layer and used for accurately classifying the characteristics;
the field discriminator is a sub-module formed by the full connection layer and used for carrying out second class discrimination on the characteristics from a source domain or a target domain;
the model is connected with a field discriminator behind the feature extractor and connected with a classifier in parallel; designing an adaptation layer in the classifier, wherein the adaptation layer refers to the maximum mean value difference MMD and KL divergence as measurement criteria, calculating the difference of the two domain feature distribution of a source domain and a target domain, and minimizing the difference value to update model parameters; the image data of the source domain are defect images of the surface of the lithium battery collected on different production lines or defect images collected by collecting systems of different factories; the target domain is a defect image acquired on a production line to be detected;
the adaptation layer introduces the maximum mean difference MMD and KL divergence as statistics to calculate the difference of the two-domain feature distribution, and the adaptation layer self-adaptation loss function L con Is of formula (1):
L con =MMD(S,T)+λD KL (p||q) (1)
wherein MMD (S, T) is a calculation formula of MMD, wherein S, T respectively represents a source domain and a target domain; d (D) KL (p||q) is a calculation formula of KL divergence, wherein p represents an original distribution, and q represents a simple distribution used for approximating p; lambda is a balance coefficient calculated from equation (2):
Figure FDA0004156608870000011
wherein i is the number of steps of the current training, and N is the total number of training steps.
2. The method for detecting surface defects of a lithium battery according to claim 1, wherein the depth field adaptation model has different data flow paths in a source field and a target field in a training process, and the total loss function comprises three items:
Figure FDA0004156608870000012
where α, β are balance parameters, the update rule for each loss in back propagation is:
Figure FDA0004156608870000021
wherein μ represents a learning rate, θ represents a corresponding module parameter, f represents a feature extractor, c represents a classifier, and d represents a domain discriminator; l is a cross entropy loss function, d s ,d t Domain labels that are source and target domains;
during back propagation, the adaptive loss function L con Updating parameters before the adaptation layer of the feature extractor F and the classifier; resistance loss function
Figure FDA0004156608870000022
The parameters of the feature extractor F and the domain discriminator D are updated; classification loss function L c For updating the parameters of the feature extractor F and of the whole classifier C.
3. The method for detecting the surface defects of the lithium battery according to claim 1, wherein the feature extractor is based on a VGG-16 network and comprises five groups of convolution operations, each group of convolution operations consists of two or three convolution layers, a batch normalization layer and a pooling layer which follow the corresponding convolution layers, and the feature extractor outputs a feature map of 512 channels which are sampled 32 times down after the five groups of convolution operations; a multi-scale feature fusion strategy is fused in the feature extraction process, wherein a branch is added after the output feature graphs of the third group and the fourth group of convolution operations, convolution operation and pooling operation are carried out on each branch, three branches are added for the output of the fifth group of convolution operations of VGG-16, the final output feature graph of each branch is 4*4, the output feature graphs of the three branches are stretched, one-dimensional vectors are stretched, and then the one-dimensional vectors are spliced together to form a one-dimensional vector of 4 x 3, and the one-dimensional vector is the feature vector after fusion.
4. The method for detecting surface defects of a lithium battery according to claim 3, wherein all convolution kernels of the VGG-16 network have a size of 3×3, a step size of 1, a pooling window size of 2×2, and a step size of 2; the convolution kernel size of the branch after the third group of convolution operation is 3*3, the step length is 2, the pooling window size is 2 x 2, and the step length is 2; the convolution kernel size 3*3 of the fourth set of subsequent branches has a step size of 1 and a pooling window size of 2 x 2, step size 2.
5. The method for detecting surface defects of a lithium battery according to any one of claims 1 to 4, wherein the method comprises the following specific steps:
step 1: source domain and destination domain data preparation:
the source domain data is similar to the target domain data but different from the target domain data and has a common tag space, the source domain data is to be marked, and the target domain data does not need to be marked;
step 2: design of depth domain adaptation model:
the depth domain adaptation model comprises a feature extractor, a classifier which is composed of a full-connection layer and is used for accurately classifying the features, and a domain discriminator which is composed of a full-connection layer and is used for carrying out a second class discrimination on whether the features come from a source domain or a target domain,
the model is connected with a field discriminator behind the feature extractor and connected with a classifier in parallel; designing an adaptation layer in the classifier, wherein the adaptation layer refers to the maximum mean value difference MMD and KL divergence as measurement criteria, calculating the difference of the two domain feature distribution of a source domain and a target domain, and minimizing the difference value to update model parameters;
step 3: training of a model:
1) Cutting or scaling the source domain data and the target domain data into uniform sizes, adjusting the sizes of the pictures to 128 x 128, and manufacturing a small batch n of data formats which are suitable for the input of the depth domain adaptation model to form a data set;
2) The source domain data and the target domain data are simultaneously input into a depth domain adaptation model, and in a forward propagation stage, the source domain data are fed into the model in small batches n, are divided into two branches after passing through a feature extractor, and one branch enters a classifier, and an output end is arranged at the adaptation layer and the last layer of the classifier; the other branch enters the domain discriminator and flows out from the last layer of the domain discriminator;
the target domain data stream is also fed into the model in small batch m, and is divided into two branches after passing through the feature extractor, one branch enters the classifier and flows out through the adaptive layer, and the last layer of the classifier is not passed at the moment; the other branch flows out through the domain discriminator, m=n;
3) Calculation of the loss function:
the data streams of the source domain and the target domain calculate an adaptive loss function L at the output of the adaptation layer con The source domain data stream calculates a classification cross entropy loss function L at the classifier output c The data streams of the source domain and the target domain calculate a two-class cross entropy loss function at the output end of the domain discriminator
Figure FDA0004156608870000031
I.e. the antagonism loss function;
4) The loss function back propagates the update parameters, the total loss function is the formula (7), and the update rule of the model parameters is (8);
Figure FDA0004156608870000032
Figure FDA0004156608870000033
5) Repeating steps 2) -4), when the whole training data set participates in training once, the training of the model is completed for one period,
the training is circulated until the total loss function converges, and the model training is completed;
step 4: after the model is trained, storing the model, and transplanting the model into a server of a detection system on a lithium battery production line, wherein the model on the production line only needs a trained feature extractor and classifier, and an adaptation layer and a field discriminator need to be removed in a test stage;
step 5: on-line testing stage:
and (3) inputting the lithium battery surface image acquired on line into the depth domain adaptation model detection grafted in the step (4) and used for the production line, so as to realize detection and identification of the lithium battery surface defects.
6. The method for detecting surface defects of a lithium battery according to claim 5, wherein the types of the surface defects of the lithium battery are 7 types of surface dents, stains, surface bulges, wrinkles, pole piece scratches, particles and dark spots, the identification accuracy of the pole piece scratches, the surface dents and the surface bulges is not lower than 85%, and the identification accuracy of other defects is not lower than 90%.
CN202010282872.7A 2020-04-13 2020-04-13 Lithium battery surface defect detection method based on depth field adaptation Active CN111476307B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010282872.7A CN111476307B (en) 2020-04-13 2020-04-13 Lithium battery surface defect detection method based on depth field adaptation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010282872.7A CN111476307B (en) 2020-04-13 2020-04-13 Lithium battery surface defect detection method based on depth field adaptation

Publications (2)

Publication Number Publication Date
CN111476307A CN111476307A (en) 2020-07-31
CN111476307B true CN111476307B (en) 2023-06-20

Family

ID=71751564

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010282872.7A Active CN111476307B (en) 2020-04-13 2020-04-13 Lithium battery surface defect detection method based on depth field adaptation

Country Status (1)

Country Link
CN (1) CN111476307B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112232293B (en) * 2020-11-09 2022-08-26 腾讯科技(深圳)有限公司 Image processing model training method, image processing method and related equipment
CN112434602B (en) * 2020-11-23 2023-08-29 西安交通大学 Fault diagnosis method based on movable common feature space mining
CN112540298B (en) * 2020-12-26 2022-05-10 福州大学 Lithium ion battery SOC estimation method based on deep-migration learning
CN112967245B (en) * 2021-03-01 2022-11-08 创新奇智(青岛)科技有限公司 Battery detection method and device, electronic equipment and readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108062753A (en) * 2017-12-29 2018-05-22 重庆理工大学 The adaptive brain tumor semantic segmentation method in unsupervised domain based on depth confrontation study
CN109766921A (en) * 2018-12-19 2019-05-17 合肥工业大学 A kind of vibration data Fault Classification based on depth domain-adaptive
CN110111297A (en) * 2019-03-15 2019-08-09 浙江大学 A kind of injection-molded item surface image defect identification method based on transfer learning
WO2019169816A1 (en) * 2018-03-09 2019-09-12 中山大学 Deep neural network for fine recognition of vehicle attributes, and training method thereof
CN110348579A (en) * 2019-05-28 2019-10-18 北京理工大学 A kind of domain-adaptive migration feature method and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102015224854A1 (en) * 2015-12-10 2017-06-14 Siemens Aktiengesellschaft Method of creating a depth map

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108062753A (en) * 2017-12-29 2018-05-22 重庆理工大学 The adaptive brain tumor semantic segmentation method in unsupervised domain based on depth confrontation study
WO2019169816A1 (en) * 2018-03-09 2019-09-12 中山大学 Deep neural network for fine recognition of vehicle attributes, and training method thereof
CN109766921A (en) * 2018-12-19 2019-05-17 合肥工业大学 A kind of vibration data Fault Classification based on depth domain-adaptive
CN110111297A (en) * 2019-03-15 2019-08-09 浙江大学 A kind of injection-molded item surface image defect identification method based on transfer learning
CN110348579A (en) * 2019-05-28 2019-10-18 北京理工大学 A kind of domain-adaptive migration feature method and system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Yaroslav Ganin.etc."Domain-Adversarial Training of Neural Networks".《The journal of machine learning research》.2016,全文. *
刘坤 ; 张晓怿 ; 陈宁纪 ; 苏秀苹 ; .融合深度信息的雾霾情况下显著性目标提取.河北工业大学学报.2015,(第02期),全文. *

Also Published As

Publication number Publication date
CN111476307A (en) 2020-07-31

Similar Documents

Publication Publication Date Title
CN111476307B (en) Lithium battery surface defect detection method based on depth field adaptation
CN109919934B (en) Liquid crystal panel defect detection method based on multi-source domain deep transfer learning
CN109376792A (en) Photovoltaic cell open defect classification method based on multichannel residual error neural network
CN113643268B (en) Industrial product defect quality inspection method and device based on deep learning and storage medium
CN109101938B (en) Multi-label age estimation method based on convolutional neural network
CN108875602A (en) Monitor the face identification method based on deep learning under environment
WO2022236876A1 (en) Cellophane defect recognition method, system and apparatus, and storage medium
CN113688665B (en) Remote sensing image target detection method and system based on semi-supervised iterative learning
CN110163069B (en) Lane line detection method for driving assistance
CN112949408B (en) Real-time identification method and system for target fish passing through fish channel
CN112115993B (en) Zero sample and small sample evidence photo anomaly detection method based on meta-learning
CN105469111B (en) The object classification method of small sample set based on improved MFA and transfer learning
CN109858428B (en) Automatic ANA fluorescent film identification method based on machine learning and deep learning
CN116883393B (en) Metal surface defect detection method based on anchor frame-free target detection algorithm
CN105184229A (en) Online learning based real-time pedestrian detection method in dynamic scene
CN115631186B (en) Industrial element surface defect detection method based on double-branch neural network
CN105303169A (en) Slow characteristic based cell division recognition method and recognition device thereof
Tian et al. CASDD: Automatic surface defect detection using a complementary adversarial network
CN113591948A (en) Defect pattern recognition method and device, electronic equipment and storage medium
CN117434082A (en) Quality detection method and system for silica gel product production line
CN115797808A (en) Unmanned aerial vehicle inspection defect image identification method, system, device and medium
CN108428234B (en) Interactive segmentation performance optimization method based on image segmentation result evaluation
CN112396580A (en) Circular part defect detection method
CN116520154A (en) Performance evaluation method and system for lithium battery pole piece detection
CN116468935A (en) Multi-core convolutional network-based stepwise classification and identification method for traffic signs

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant