CN117495786A - Defect detection meta-model construction method, defect detection method, device and medium - Google Patents

Defect detection meta-model construction method, defect detection method, device and medium Download PDF

Info

Publication number
CN117495786A
CN117495786A CN202311349989.2A CN202311349989A CN117495786A CN 117495786 A CN117495786 A CN 117495786A CN 202311349989 A CN202311349989 A CN 202311349989A CN 117495786 A CN117495786 A CN 117495786A
Authority
CN
China
Prior art keywords
model
defect
image
defect detection
labeling
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.)
Pending
Application number
CN202311349989.2A
Other languages
Chinese (zh)
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.)
Sichuan Cric Technology Co ltd
Sichuan Changhong Electronic Holding Group Co Ltd
Original Assignee
Sichuan Cric Technology Co ltd
Sichuan Changhong Electronic Holding Group Co Ltd
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 Sichuan Cric Technology Co ltd, Sichuan Changhong Electronic Holding Group Co Ltd filed Critical Sichuan Cric Technology Co ltd
Priority to CN202311349989.2A priority Critical patent/CN117495786A/en
Publication of CN117495786A publication Critical patent/CN117495786A/en
Pending legal-status Critical Current

Links

Classifications

    • 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
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/774Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/778Active pattern-learning, e.g. online learning of image or video features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/70Labelling scene content, e.g. deriving syntactic or semantic representations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • 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/20076Probabilistic image processing
    • 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]
    • 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
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Databases & Information Systems (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Computational Linguistics (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a defect detection meta-model construction method, a defect detection method, a device and a medium, wherein the construction method comprises the following steps: acquiring image data of a product in a certain industry, and performing self-supervision training on a basic vision model to obtain an industry pre-training model; randomly selecting a part of product images in the industry to carry out strong label labeling and weak label labeling, wherein the strong label labeling is pixel-level labeling, and the weak label labeling is image-level labeling; performing strong and weak label joint supervision training on the industrial pre-training model by using strong label information and weak label information and taking the combination of segmentation loss and classification loss as a loss function; and after the joint supervision training is finished, fusing the probability of the output result of the segmentation network and the probability of the output result of the classification network, so as to obtain the defect detection meta-model. The invention performs probability fusion on strong and weak supervision results, fully utilizes complementarity of different supervision information, effectively improves model generalization capability, and solves the detection problems of few sample defects and micro defects.

Description

Defect detection meta-model construction method, defect detection method, device and medium
Technical Field
The invention relates to the technical field of visual inspection, in particular to a defect detection meta-model construction method, a defect detection method, defect detection equipment and a medium.
Background
Surface defects of industrial products have adverse effects on the performance, the attractiveness, the comfort and the like of the products, so that manufacturing enterprises need to detect the surface defects of the products so as to discover and control the surface defects in time. The machine vision detection method overcomes the defects of low accuracy, poor real-time performance, low efficiency, high labor intensity and the like in manual visual inspection, and is widely researched and applied in modern manufacturing industry. Machine vision defect detection is classified into a supervised mode (including a weak supervised mode) and an unsupervised mode, in which although a defect sample is not required, accuracy and robustness are inferior to the supervised mode. In daily industrial production, accuracy and robustness are the most important indexes, so that most of the currently practically applied visual detection models are supervised (including weak supervision).
The related information of the supervision type visual defect detection is Chinese patent CN202310272537.2, chinese patent CN202211732514.7, chinese patent CN202211456980.7, chinese patent CN202010875361.6, chinese patent CN202211174874.X, wen-Huan Chu and Kris M.Kitani published in 2020 on ECCV, "Neural batch sampling with reinforcement learning for semi-supervised anomaly detection", qian Wan, liang Gao and Xinyu Li published in 2022 on IEEE TIM "Logit inducing with abnormality capturing for semi-supervised image anomaly detection" and the like.
However, these and other existing methods have the following problems: firstly, the model which is lack of generality and is trained on one surface of a product is not suitable for other surfaces, and data are required to be collected again for retraining when other surfaces are detected; secondly, the generalization capability of unknown defects is lacking, namely, the defect types which do not appear in the training set are difficult to correctly detect; thirdly, a large number of labels are required to be marked, so that a lot of manpower and material resources are required to be spent; fourthly, the detection performance is poor, the tiny defects are difficult to detect, and the over-detection rate is very high under the given omission rate; fifthly, the model lacks of evolutionary capability, is completely fixed after training, and is difficult to adapt to changes of working conditions, environments and the like.
Disclosure of Invention
The invention provides a defect detection meta-model construction method, a defect detection method, defect detection equipment and a medium, which are used for solving the technical problems in the prior art.
The technical scheme adopted by the invention is as follows:
in a first aspect, the present invention provides a method for constructing a defect detection meta-model, including:
acquiring image data of a product in a certain industry, and performing self-supervision training on a basic vision model to obtain an industry pre-training model;
randomly selecting a part of product images in the industry to carry out strong label labeling and weak label labeling, wherein the strong label labeling is pixel-level labeling, and the weak label labeling is image-level labeling;
performing strong and weak label joint supervision training on the industrial pre-training model by using the strong label information of the pixel level label and the weak label information of the image level label and taking the combination of segmentation loss and classification loss as a loss function;
and after the joint supervision training is finished, fusing the probability of the output result of the segmentation network and the probability of the output result of the classification network, so as to obtain the defect detection meta-model.
Further, after the self-supervision training is finished, only the encoder part of the industrial pre-training model is reserved, and a decoder, a segmentation network and a classification network are added behind the encoder of the industrial pre-training model.
Further, when the ratio of the real defect image to the normal image is less than a set value, strong label labeling and weak label labeling are carried out by utilizing the artificially synthesized defect image and the product image together, and the labeling carried out on the normal image without defects in the product image is the strong label labeling.
Further, the combining the segmentation loss and the classification loss as a loss function includes:
segmentation lossAnd Classification loss->Is combined as->Wherein alpha is E [0,1 ]]And beta.epsilon.0, 1]Is a balancing factor that balances the contribution of strong and weak tag information in the final loss.
Further, the fusing the output result probability of the segmentation network and the output result probability of the classification network includes:
the output P (I of the split network seg ) And an output P (I cls ) Probability fusion is carried out, and the discrimination probability that the input image I is a defect image is obtained: p (I) =p seg ·max(P(I seg )*f)+p cls ·P(I cls ) Wherein P (I) seg ) Is a probability matrix for dividing each pixel of an image I output by a network into defects, a symbol represents convolution operation, f represents a preset convolution kernel, and P (I) cls ) Is the probability of defect of the image I output by the classification network, p seg And p cls The prior probabilities, p, of the split network output and the classification network output are respectively represented seg ≥0,p cls Not less than 0 and p seg +p cls =1。
Further, after obtaining the defect detection meta-model, the method further includes:
and (3) manually rechecking the sample of the defect image judged by the defect detection meta-model, and executing playback type incremental learning on the defect detection meta-model to continuously evolve.
Further, the rechecking results have three cases: firstly, judging that a sample of a defect image is actually a normal sample by a defect detection meta-model, namely, over-detecting; secondly, judging that the sample of the defect image has defects by the defect detection meta-model, namely positive detection, wherein the segmentation of the defect region by the defect detection meta-model is inaccurate; thirdly, the defect detection meta-model judges that the sample of the defect image has defects, namely positive detection, and the defect detection meta-model accurately divides the defect area;
the performing playback incremental learning on the defect detection metamodel to continuously evolve includes:
forming a playback sample set by the strong tag label samples;
the detected samples found by manual rechecking are listed as difficult samples, and the difficult samples are listed as pixel-level labeling samples; the sample with inaccurate division of the defect area in the normal sample found by the manual rechecking is listed as an image-level labeling sample; the sample with accurate segmentation of the defect area in the positive detection sample found by the manual rechecking is listed as a pixel-level labeling sample; combining the three into an increment sample set;
and performing playback type incremental training on the defect detection metamodel by using the playback sample set and the incremental sample set to continuously optimize the defect detection metamodel.
In a second aspect, the present invention provides a defect detection method, including:
deploying the defect detection meta model obtained by the construction method in the first aspect on an automatic detection line, detecting defects of the industrial products, and outputting whether the product image to be detected is a defect image or not by comparing the discrimination probability with a preset integral defect judgment threshold; if the image is a defect image, the prediction probability matrix of the segmentation network is compared with the element-by-element size of a preset region defect judgment threshold matrix, and a segmentation result of the defect region is output.
In a third aspect, the present invention provides a defect detection method for rapidly adapting to a specific field product, including:
collecting image data of products in a specific field and carrying out pixel-level labeling on defects;
and on the basis of pixel-level labeling data in the specific field, fine-tuning the defect detection meta-model obtained by the construction method in the first aspect by using a parameter fine-tuning algorithm, and performing defect detection on the product in the specific field through the fine-tuned defect detection meta-model.
In a fourth aspect, the present invention provides a defect detection meta-model construction apparatus, including:
the pre-training module is used for acquiring image data of a product in a certain industry and performing self-supervision training on the basic vision model to obtain an industry pre-training model;
the labeling module is used for randomly selecting a part of product images in the industry to carry out strong label labeling and weak label labeling, wherein the strong label labeling is pixel-level labeling, and the weak label labeling is image-level labeling;
the strong and weak label joint supervision training module is used for performing strong and weak label joint supervision training on the industrial pre-training model by using the combination of segmentation loss and classification loss as a loss function by using the strong label information of the pixel-level label and the weak label information of the image-level label;
and the probability fusion module is used for fusing the probability of the output result of the segmentation network and the probability of the output result of the classification network after the joint supervision training is finished, so that the defect detection meta-model is obtained.
Further, the method further comprises the following steps:
and the manual rechecking module is used for sending the sample which is judged to be the defect image by the defect detection meta-model to the manual rechecking, and executing playback type incremental learning on the defect detection meta-model to enable the defect detection meta-model to continuously evolve.
In a fifth aspect, the present invention provides an electronic device, including:
one or more processors;
a storage means for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the defect detection meta-model construction method as described in the first aspect, or to implement the defect detection method as described in the second or third aspect.
In a sixth aspect, the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the defect detection meta model construction method according to the first aspect, or implements the defect detection method according to the second or third aspect.
The beneficial effects of the invention are as follows: the invention collects industry data for self-supervision training, solves the field difference problem between a basic model and an actual application scene, strengthens the inherent feature learning capacity of the model, and simultaneously avoids a large amount of labeling work; the strong and weak label joint supervision algorithm adopted by the invention reduces the dependence on the strong label; the invention performs probability fusion on strong and weak supervision results, fully utilizes complementarity of different supervision information, effectively improves model generalization capability, and solves the detection problems of few sample defects and micro defects; the defect detection meta-model has the characteristics of low omission ratio, good universality and capability of fast migration and adaptation. Meanwhile, the invention can realize the manual rechecking and incremental learning, so that the model can be continuously evolved and automatically adapt to the changes of production conditions and working conditions. The invention performs a comparison experiment on the own data set, and the effect of the invention is demonstrated.
Drawings
FIG. 1 is a flowchart of a method for constructing a defect detection meta-model disclosed in embodiment 1 of the present invention;
fig. 2 presents some example pictures of a battery product;
fig. 3 is a block diagram of a decoder network disclosed in embodiment 1 of the present invention;
FIG. 4 is a block diagram of a classification network disclosed in embodiment 1 of the present invention;
FIG. 5 is a block diagram of a split network disclosed in embodiment 1 of the present invention;
FIG. 6 is a flow chart of a method of artificially synthesizing a defect image disclosed in embodiment 1 of the present invention;
FIG. 7 is a schematic diagram of a method for constructing a defect detection meta-model disclosed in embodiment 1 of the present invention;
FIG. 8 is a schematic diagram of a remote review as disclosed in example 1 of the present invention;
FIG. 9 is a schematic diagram of the artificial review and model evolution disclosed in example 1 of the present invention;
fig. 10 is a block diagram showing the structure of a defect inspection meta model constructing apparatus according to embodiment 4 of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
As used in this specification and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
Example 1:
fig. 1 shows a flowchart of a method for constructing a defect detection meta-model disclosed in this embodiment, and fig. 7 shows a schematic diagram of a method for constructing a defect detection meta-model disclosed in this embodiment. The construction method comprises the following steps:
a) Acquiring image data of a product in a certain industry, and performing self-supervision training on a basic vision model to obtain an industry pre-training model;
b) Randomly selecting a part of product images in the industry to carry out strong label labeling and weak label labeling, wherein the strong label labeling is pixel-level labeling, and the weak label labeling is image-level labeling; performing strong and weak label joint supervision training on the industrial pre-training model by using the strong label information of the pixel level label and the weak label information of the image level label and taking the combination of segmentation loss and classification loss as a loss function; after the joint supervision training is finished, the probability fusion of the output result of the segmentation network and the output result of the classification network is carried out, so that a defect detection meta-model is obtained;
c) And (3) manually rechecking the sample of the defect image judged by the defect detection meta-model, and executing playback type incremental learning on the defect detection meta-model to continuously evolve.
Preferably, the basic visual model described in step a) refers to a visual transducer model encoder, a CNN model encoder or a mixture thereof pre-trained on a public data set; the pre-training models have better universality; the pre-trained ResNet101 network is selected in this embodiment.
Preferably, the self-supervised training described in step a) includes contrast learning training, such as InstDisc, moCo, simCLR, sparse masKed modeling, etc. and variants thereof, and non-contrast learning training, such as BYOL, swAV, simSiam, MAE, GAN, VAE, etc. and variants thereof. In the prior art, after network parameters of a basic visual model are imported, the parameters are usually kept unchanged during supervision training, because the basic visual model is pre-trained on a large amount of image data, and has better generalization capability; however, there is a field difference between the training data of the basic visual model and the specific industry product image data, so that the direct use of the pre-trained parameters of the basic visual model will lead to an undesirable defect detection effect; meanwhile, the defect detection model obtained by training a certain surface of a certain product is not suitable for other surfaces of the same product, namely the model has poor universality. For example, the two surface materials of the product have different quality, different patterns, different colors and the like, which results in the problem of poor universality.
The invention uses industry product images and self-supervision algorithm to pretrain the basic model again to eliminate the field difference; for a specific product, a lot of image data can be acquired in a short time, and the self-supervision training is not required to be marked; in this embodiment, a total of 468315 images of the battery product are collected, including a cylindrical shell, an inner cavity, a slurry layer paper, a negative electrode, a positive electrode, and the like, which include a normal image and a defective image. Some example pictures are as shown in fig. 2, which are uniformly scaled to 224 x 224 size; a Sparse masKed modeling (SparK) self-supervising algorithm is used in this embodiment.
The self-supervision pre-training method solves the field difference problem between the basic model and the actual application scene, strengthens the inherent feature learning capacity of the model, and ensures that the model has universality for specific products.
Preferably, the industry pre-training model in step a) only keeps the encoder part after the self-supervision training is completed, and the embodiment keeps four convolution group layers of the ResNet101 network; and a decoder, a segmentation network and a classification network are added after the encoder of the industrial pre-training model. In this embodiment, the decoder structure is shown in fig. 3, the classification network is shown in fig. 4, and the partition network is shown in fig. 5.
Preferably, when the ratio of the real defect image to the normal image in the step b) is smaller than the set value, strong label marking and weak label marking are carried out by utilizing the artificially synthesized defect image and the product image together; labeling normal images without defects in the product image is strong label labeling. The artificially synthesized defect image can be obtained by adding noise pixels to a normal image; the defective area of the synthesized defective image is an area to which noise pixels are added, and the label thereof is automatically generated in the synthesis process.
In the prior art, the training set of supervised defect detection comes from the acquired real image data, however, certain defects of certain products in specific industries can occur once for a long time, and the acquired real image data lacks such defect images; in this way, in actual detection, such defects are unknown defects to the model, and it is difficult to detect them accurately.
When some types of defect images are not or rarely found in the acquired data, the invention can realize generalization of unknown defects by manually synthesizing the defect images and performing model training by using real data and artificial data together so as to detect the types of defects which do not appear.
Specifically, the method for artificially synthesizing the defect image, as shown in fig. 6, includes:
randomly selecting a small block with a fixed size from the normal image to copy; in this embodiment, for a normal image of 224×224 size, a small block of size (16, 8) is randomly selected for copying;
downsampling the copy small blocks, randomly rotating the copy small blocks, and finally pasting the copy small blocks back to the original place; in this embodiment, the copy small block is downsampled to the original 1/4 size and randomly rotated, and finally stuck to the home position center.
The defective area of the synthesized defective image is an area to which noise pixels are added, and thus, the label thereof is automatically generated in the synthesis process.
The artificial synthesis of the defect image can solve the problems that the real defect image rarely appears and is difficult to collect in certain industries. However, it should be noted that, compared with the actual defect image, the artificially synthesized defect image has a distribution difference, such as burrs on the surface of the product, and the artificially synthesized burrs are more abrupt than the actual burrs, so that only when the ratio of the actual defect image to the normal image is less than a set value, such as less than 10%, the artificially synthesized defect image and the product image are used for strong label labeling and weak label labeling together, and then strong and weak label joint supervision training is more meaningful.
Preferably, the image-level labeling in the step b) refers to labeling whether the sample image has a defect, and the result is a weak label; the pixel-level labeling refers to labeling whether each pixel of the sample image is a defect, and the result is a strong label. Since all pixels of the normal image are not defects, the strong label is very easy to label; in fact, for normal images, weak labels correspond to strong labels.
In the embodiment, 13000 defective samples are selected from the battery image to carry out pixel-level labeling, so that strong label data are obtained; then 90000 sheets of image-level labels with low cost are randomly selected from the rest samples, and whether each sample is defective or not is marked, so that weak label data are obtained; and finally, generating a strong label for a normal image without defects in the weak label data.
Preferably, the strong and weak label joint supervision training in the step b) refers to training the model by using weak label information marked at an image level and strong label information marked at a pixel level and taking a combination of segmentation loss and classification loss as a total loss function; the strong and weak label joint supervision solves the problems of few pixel-level labeling samples and high labeling cost, and enlarges the range of data available for training.
In the embodiment, the strong tag data generates a segmentation loss function, the weak tag data generates a classification loss function, and model training is completed by combining the segmentation loss and the classification loss function; in this embodiment, only the decoder and the output part are trained when the strong and weak labels are jointly supervised (the encoder has been trained before in the self-supervised training).
Preferably, the segmentation loss functionThe cross entropy Loss can be a cross entropy Loss or various segmentation Loss variants, such as Focal Loss, dice Loss, IOU Loss, jaccard Loss and the like; classification loss function->The cross entropy Loss can be the same as the segmentation Loss, and can also be Focal Loss or Gradient Harmonizing Mechanism-Classification Loss, etc.; the combination of partition loss and classification loss is +.> Wherein alpha is E [0,1 ]]And beta.epsilon.0, 1]Is a balance factor used for balancing the contribution of strong and weak label information in the final loss; alpha E [0,1 ] due to the learning rate]And beta.epsilon.0, 1]The effect generated by alpha E [0, ++ infinity) and beta E [0, ++ infinity); in this embodiment, for image I, the loss function used is +.> Wherein the method comprises the steps of
Where y is t Is the label value of the t-th pixel of image I, y when the t-th pixel is defective t Taking 1, otherwise taking 0; p (P) t (I seg ) The prediction probability that the t pixel of the image I is a defect is output by a segmentation network; m represents the total number of pixels of the image I; y is the label value of the image I, when the image I has a defect, y is 1, otherwise, 0 is taken; p (I) cls ) The prediction probability representing that the image I has defects is output by a classification network; when the image I is an image-level annotation, α takes a value of 0, and the other cases take a value of 1.
In the prior art, after training a model by using an image-level label and a pixel-level label, whether the image has a defect is determined by a classification module, and the position of a defective area is determined by a segmentation module. However, the existing scheme breaks the connection between classification and segmentation, and the segmentation result cannot assist the classification module in judging whether the image has defects or not; meanwhile, the segmentation module and the classification module may conflict, that is, the probability that the segmentation module predicts that some pixels are defects is high, and the probability that the classification module predicts that the image is defects is low. Such cracking and collision cause that the existing scheme is difficult to identify a defect image with a small defect area, and the overall detection performance is poor.
The invention carries out probability fusion on the output of the segmentation network and the output of the classification network, so that the segmentation module also participates in judging whether the whole image is a defect image, the complementarity of different supervision information is fully utilized, and the possible conflict between the segmentation module and the classification module is reconciled; with the aid of the segmentation module, the method can identify the micro defect image, and improves the overall detection performance and generalization capability.
Preferably, the probability fusion of the output result of the dividing network and the output result of the classifying network in the step b) refers to the output P (I seg ) And an output P (I cls ) Probability fusion is carried out, and the discrimination probability that the input image I is a defect image is obtained: p (I) =p seg ·max(P(I seg )*f)+p cls ·P(I cls ) Wherein P (I) seg ) Is a probability matrix for dividing each pixel of an image I output by a network into defects, a symbol represents convolution operation, f represents a preset convolution kernel, and P (I) cls ) Is the probability of defect of the image I output by the classification network, p seg And p cls The prior probabilities, p, of the split network output and the classification network output are respectively represented seg ≥0,p cls Not less than 0 and p seg +p cls =1; in the present embodiment, the convolution kernel f is selected as the mean filter of 7×7, and the step size is 1 while filling P (I seg ) Four (3) pixels, P (I) seg ) F is a probability matrix of 224×224 size; priori p seg And p cls The values are respectively n seg /(n seg +n cls ) And n cls /(n seg +n cls ) Wherein n is seg Representing the number of defective image samples of pixel-level annotation, n cls Representing the number of defective image samples of the image level annotation.
The flow of obtaining the defect detection metamodel in this embodiment is shown in fig. 7.
In the prior art, the defect detection model is fixed once trained, and is difficult to adapt to the changes of working conditions, production conditions and the like. Meanwhile, any model can inevitably cause over-inspection while meeting the requirement of low omission ratio, and the quality product is judged as a defective product, so that economic loss is caused.
The invention uses the manual work to check the sample of the defect image judged by the defect detection meta-model, if the sample has no defect, the sample is put in storage, and the economic loss caused by misjudgment of the model is reduced; if the sample is defective, scrapping the sample; in addition, the invention further discloses that incremental learning is carried out on the defect detection meta-model according to the manual rechecking result so as to enable the defect detection meta-model to continuously evolve, so that the defect detection meta-model is suitable for continuously changing working conditions and production conditions.
Preferably, the rechecking in step c) can be performed on site, or can be performed remotely by transmitting the defect sample image determined by the model through wires or wirelessly; the method can be used for on-line real-time rechecking and off-line non-real-time rechecking; in this embodiment, the defect sample image determined by the model is transmitted to a special manual review platform for storage, and offline non-real-time review is performed, as shown in fig. 8; the remote rechecking can avoid workers from being exposed in toxic, harmful or polluted production sites, and upgrade the working environment; the off-line non-real-time rechecking can enable workers to rest at night.
Preferably, in step c), the samples of the defect image determined by the defect detection meta-model are manually checked, and the results have three cases: firstly, judging that a sample of a defect image is actually a normal sample by a model, namely, over-checking; secondly, the model judges that the sample of the defect image has defects, namely positive detection, but the segmentation of the model on the defect area is inaccurate; thirdly, the model judges that the sample of the defect image has defects, namely positive detection, and the model divides the defect area accurately.
Preferably, the performing playback incremental learning on the model in step c) continuously evolves, as shown in fig. 9, including:
c.1 The strong label samples in the step b) form a playback sample set; the use of historical data as a playback sample can alleviate the catastrophic forgetting problem in incremental learning;
c.2 The detected sample found by the manual rechecking is listed as a difficult sample, and the difficult sample is listed as a pixel-level labeling sample; the sample with inaccurate segmentation of the defect area in the found positive detection sample is listed as an image-level labeling sample, and the sample with accurate segmentation of the defect area in the found positive detection sample is listed as a pixel-level labeling sample; combining the three into an increment sample set;
c.3 Playback-type incremental training of the model using the playback sample set and the incremental sample set to continuously optimize it.
Example 2:
the embodiment discloses a defect detection method, which comprises the following steps:
disposing the defect detection meta model obtained by the construction method described in the embodiment 1 on an automatic detection line, detecting defects of the battery product, and outputting whether the image of the product to be detected is a defect image or not by comparing the discrimination probability with a preset overall defect judgment threshold; if the image is a defect image, the prediction probability matrix of the segmentation network is compared with the element-by-element size of a preset region defect judgment threshold matrix, and a segmentation result of the defect region is output.
Preferably, in this embodiment, the overall defect determination threshold is 0.4, and each element of the area defect determination threshold matrix is 0.3.
Example 3:
the embodiment provides a defect detection method for rapidly adapting to a product in a specific field, which comprises the following steps:
collecting image data of products in a specific field and carrying out pixel-level labeling on defects;
based on the pixel-level labeling data of the specific field, the defect detection meta-model obtained by the construction method described in the embodiment 1 is finely tuned by using a parameter fine tuning algorithm, and defect detection is performed on the product of the specific field through the finely tuned defect detection meta-model.
The parameter tuning algorithms herein include Adapter, loRA, and the like, and various variants thereof.
For example: and collecting a plurality of cylindrical dry battery positive electrode images on a production line to manufacture a data set. The data set is 6878 in total, with the defective samples 6157, the remaining samples without any defects, and the present embodiment scales all samples to 224×224. Taking 200 normal samples and 300 defect samples from the data set, performing pixel-level labeling to serve as a training set, and the rest is a testing set;
when the training set is used for parameter fine tuning training, only the last convolution block layer and the segmentation network output of the defect detection meta-model in the step b) are adjusted, and the rest parameters are frozen; the loss function used is Wherein the method comprises the steps of
Where y is t Is the label value of the t-th pixel of image I, y when the t-th pixel is defective t Taking 1, otherwise taking 0; p (P) t (I seg ) The prediction probability that the t pixel of the image I is a defect is output by a segmentation network; m represents the total number of pixels of the image I. The probability of discrimination of the defective image according to the present embodiment is P (I) =max (P (I seg ) F), the convolution kernel f selects a mean filter of size 7 x 7.
The embodiment adjusts the overall defect judging threshold value to ensure that the omission ratio of the model on the test set is not more than 0.02%, and the corresponding over-detection ratio is about 14%; in contrast, this example uses the SegmentAnything (SAM) model published in ICCV2023 to test through input point cues on the test set, and SAM corresponds to an overstock of about 99.4% when a omission ratio of no more than 0.02% is required.
Training set Test set Model Leak rate Rate of overstock
500 sheets 6157 sheets The invention is that ≤0.0002 0.14
- 6157 sheets SAM ≤0.0002 0.994
Example 4:
referring to fig. 10, the present embodiment discloses a defect detection meta-model construction apparatus, including:
the pre-training module 100 is configured to collect image data of a product in a certain industry and perform self-supervision training on the basic vision model to obtain an industry pre-training model;
the labeling module 200 is configured to randomly select a part of product images in the industry to perform strong label labeling and weak label labeling, where the strong label labeling is pixel-level labeling, and the weak label labeling is image-level labeling;
the strong and weak label joint supervision training module 300 is configured to perform strong and weak label joint supervision training on the industry pre-training model by using the strong label information of the pixel level label and the weak label information of the image level label and using a combination of segmentation loss and classification loss as a loss function;
the probability fusion module 400 is configured to fuse the probability of the output result of the segmentation network and the probability of the output result of the classification network after the joint supervision training is completed, so as to obtain a defect detection meta-model.
Further, the apparatus may further include: the manual review module 500 is configured to send the sample of the defect detection meta-model determined to be the defect image to a person for review, and perform playback type incremental learning on the defect detection meta-model to continuously evolve.
The defect detection meta-model constructing device can execute the defect detection meta-model constructing method provided by the embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the defect detection meta-model constructing method.
Example 5:
the present embodiment provides an electronic device in the form of a general purpose computing device. Components of an electronic device may include, but are not limited to: one or more processors or processing units, a system memory, and a bus that connects the different system components (including the system memory and the processing units).
Bus means one or more of several types of bus structures including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic devices typically include a variety of computer system readable media. Such media can be any available media that can be accessed by the electronic device and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) and/or cache memory. The electronic device may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, a storage system may be used to read from or write to a non-removable, nonvolatile magnetic medium (commonly referred to as a "hard disk drive"). A magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk such as a CD-ROM, DVD-ROM, or other optical media may be provided. In these cases, each drive may be coupled to the bus through one or more data medium interfaces. The memory may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of the embodiments of the invention.
A program/utility having a set (at least one) of program modules may be stored, for example, in a memory, such program modules including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules typically carry out the functions and/or methods of the embodiments described herein.
The electronic device may also communicate with one or more external devices (e.g., keyboard, pointing device, display, etc.), with one or more devices that enable a user to interact with the electronic device, and/or with any device (e.g., network card, modem, etc.) that enables the electronic device to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface. And, the electronic device may also communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet, through a network adapter. The network adapter communicates with other modules of the electronic device via a bus. It should be appreciated that other hardware and/or software modules may be used in connection with an electronic device, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processing unit executes various functional applications and data processing by running a program stored in the system memory, for example, implementing the defect detection meta model construction method provided in embodiment 1 of the present invention, or implementing the defect detection method described in embodiment 2 or embodiment 3.
Example 6:
the present embodiment provides a storage medium containing computer-executable instructions for performing the defect detection meta model construction method described in embodiment 1 or implementing the defect detection method described in embodiment 2 or embodiment 3 when executed by a computer processor.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for embodiments of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be appreciated by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (13)

1. A method of constructing a defect detection meta-model, comprising:
acquiring image data of a product in a certain industry, and performing self-supervision training on a basic vision model to obtain an industry pre-training model;
randomly selecting a part of product images in the industry to carry out strong label labeling and weak label labeling, wherein the strong label labeling is pixel-level labeling, and the weak label labeling is image-level labeling;
performing strong and weak label joint supervision training on the industrial pre-training model by using the strong label information of the pixel level label and the weak label information of the image level label and taking the combination of segmentation loss and classification loss as a loss function;
and after the joint supervision training is finished, fusing the probability of the output result of the segmentation network and the probability of the output result of the classification network, so as to obtain the defect detection meta-model.
2. The method of claim 1, wherein after the self-monitoring training is completed, only the encoder portion of the industry pre-training model is reserved, and the decoder, the segmentation network, and the classification network are added after the encoder portion of the industry pre-training model.
3. The method according to claim 1, wherein when the ratio of the actual defect image to the normal image is less than the set value, the artificially synthesized defect image is used to perform strong label labeling and weak label labeling together with the product image, and the normal image without defects in the product image is labeled as strong label labeling.
4. The method of claim 1, wherein the combining the segmentation loss and the classification loss as a loss function comprises:
segmentation lossAnd Classification loss->Is combined as->Wherein alpha is E [0,1 ]]And beta.epsilon.0, 1]Is a balancing factor that balances the contribution of strong and weak tag information in the final loss.
5. The method of claim 1, wherein the fusing the segmentation network output probabilities with the classification network output probabilities comprises:
the output P (I of the split network seg ) And an output P (I cls ) Probability fusion is carried out, and the discrimination probability that the input image I is a defect image is obtained: p (I) =p seg ·max(P(I seg )*f)+p cls ·P(I cls ) Wherein P (I) seg ) Is a probability matrix for dividing each pixel of an image I output by a network into defects, a symbol represents convolution operation, f represents a preset convolution kernel, and P (I) cls ) Is the probability of defect of the image I output by the classification network, p seg And p cls The prior probabilities, p, of the split network output and the classification network output are respectively represented seg ≥0,p cls Not less than 0 and p seg +p cls =1。
6. The method of claim 1, further comprising, after obtaining the defect inspection metamodel:
and (3) manually rechecking the sample of the defect image judged by the defect detection meta-model, and executing playback type incremental learning on the defect detection meta-model to continuously evolve.
7. The method for constructing a metamodel for defect detection according to claim 6, wherein the rechecking results have three cases: firstly, judging that a sample of a defect image is actually a normal sample by a defect detection meta-model, namely, over-detecting; secondly, judging that the sample of the defect image has defects by the defect detection meta-model, namely positive detection, wherein the segmentation of the defect region by the defect detection meta-model is inaccurate; thirdly, the defect detection meta-model judges that the sample of the defect image has defects, namely positive detection, and the defect detection meta-model accurately divides the defect area;
the performing playback incremental learning on the defect detection metamodel to continuously evolve includes:
forming a playback sample set by the strong tag label samples;
the detected samples found by manual rechecking are listed as difficult samples, and the difficult samples are listed as pixel-level labeling samples; the sample with inaccurate division of the defect area in the normal sample found by the manual rechecking is listed as an image-level labeling sample; the sample with accurate segmentation of the defect area in the positive detection sample found by the manual rechecking is listed as a pixel-level labeling sample; combining the three into an increment sample set;
and performing playback type incremental training on the defect detection metamodel by using the playback sample set and the incremental sample set to continuously optimize the defect detection metamodel.
8. A defect detection method, comprising:
deploying the defect detection meta model obtained by the construction method according to any one of claims 1-7 on an automatic detection line, performing defect detection on the industrial product, and outputting whether the image of the product to be detected is a defect image or not by comparing the discrimination probability with a preset integral defect discrimination threshold; if the image is a defect image, the prediction probability matrix of the segmentation network is compared with the element-by-element size of a preset region defect judgment threshold matrix, and a segmentation result of the defect region is output.
9. A defect detection method for rapidly adapting to a product in a specific field is characterized by comprising the following steps:
collecting image data of products in a specific field and carrying out pixel-level labeling on defects;
based on pixel-level labeling data of the specific field, a parameter fine tuning algorithm is used for fine tuning the defect detection meta-model obtained by the construction method of any one of claims 1 to 7, and defect detection is performed on the product of the specific field through the fine-tuned defect detection meta-model.
10. A defect detection meta-model construction apparatus, comprising:
the pre-training module is used for acquiring image data of a product in a certain industry and performing self-supervision training on the basic vision model to obtain an industry pre-training model;
the labeling module is used for randomly selecting a part of product images in the industry to carry out strong label labeling and weak label labeling, wherein the strong label labeling is pixel-level labeling, and the weak label labeling is image-level labeling;
the strong and weak label joint supervision training module is used for performing strong and weak label joint supervision training on the industrial pre-training model by using the combination of segmentation loss and classification loss as a loss function by using the strong label information of the pixel-level label and the weak label information of the image-level label;
and the probability fusion module is used for fusing the probability of the output result of the segmentation network and the probability of the output result of the classification network after the joint supervision training is finished, so that the defect detection meta-model is obtained.
11. The defect detection meta-model construction apparatus according to claim 10, further comprising:
and the manual rechecking module is used for sending the sample which is judged to be the defect image by the defect detection meta-model to the manual rechecking, and executing playback type incremental learning on the defect detection meta-model to enable the defect detection meta-model to continuously evolve.
12. An electronic device, the electronic device comprising:
one or more processors;
a storage means for storing one or more programs;
when executed by the one or more processors, the one or more programs cause the one or more processors to implement the defect detection metamodel construction method of any one of claims 1-7, or the defect detection method of any one of claims 8-9.
13. A computer-readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the defect detection meta model construction method according to any one of claims 1 to 7 or the defect detection method according to any one of claims 8 to 9.
CN202311349989.2A 2023-10-18 2023-10-18 Defect detection meta-model construction method, defect detection method, device and medium Pending CN117495786A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311349989.2A CN117495786A (en) 2023-10-18 2023-10-18 Defect detection meta-model construction method, defect detection method, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311349989.2A CN117495786A (en) 2023-10-18 2023-10-18 Defect detection meta-model construction method, defect detection method, device and medium

Publications (1)

Publication Number Publication Date
CN117495786A true CN117495786A (en) 2024-02-02

Family

ID=89677263

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311349989.2A Pending CN117495786A (en) 2023-10-18 2023-10-18 Defect detection meta-model construction method, defect detection method, device and medium

Country Status (1)

Country Link
CN (1) CN117495786A (en)

Similar Documents

Publication Publication Date Title
EP3655923B1 (en) Weakly supervised anomaly detection and segmentation in images
CN110111334B (en) Crack segmentation method and device, electronic equipment and storage medium
CN111612751A (en) Lithium battery defect detection method based on Tiny-yolov3 network embedded with grouping attention module
CN109086811B (en) Multi-label image classification method and device and electronic equipment
CN109671071B (en) Underground pipeline defect positioning and grade judging method based on deep learning
CN111709948B (en) Method and device for detecting defects of container
CN114549997B (en) X-ray image defect detection method and device based on regional feature extraction
CN111598825B (en) Data processing method, flaw detection method, computing device and storage medium
CN110648310A (en) Weak supervision casting defect identification method based on attention mechanism
CN111179249A (en) Power equipment detection method and device based on deep convolutional neural network
CN108154191B (en) Document image recognition method and system
CN112070135A (en) Power equipment image detection method and device, power equipment and storage medium
CN112906823B (en) Target object recognition model training method, recognition method and recognition device
CN112766110A (en) Training method of object defect recognition model, object defect recognition method and device
CN115880298A (en) Glass surface defect detection method and system based on unsupervised pre-training
CN114169381A (en) Image annotation method and device, terminal equipment and storage medium
US20230222643A1 (en) Semantic deep learning and rule optimization for surface corrosion detection and evaluation
CN111192678A (en) Pathological microscopic image diagnosis and model training method, device, equipment and medium
CN114820679B (en) Image labeling method and device electronic device and storage medium
CN116823793A (en) Device defect detection method, device, electronic device and readable storage medium
CN113111875A (en) Seamless steel rail weld defect identification device and method based on deep learning
CN114663687A (en) Model training method, target recognition method, device, equipment and storage medium
JP7059889B2 (en) Learning device, image generator, learning method, and learning program
CN114528913A (en) Model migration method, device, equipment and medium based on trust and consistency
WO2024061309A1 (en) Defect identification method and apparatus, computer device, and storage medium

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