CN115082435A - Defect detection method based on self-supervision momentum contrast - Google Patents
Defect detection method based on self-supervision momentum contrast Download PDFInfo
- Publication number
- CN115082435A CN115082435A CN202210858635.XA CN202210858635A CN115082435A CN 115082435 A CN115082435 A CN 115082435A CN 202210858635 A CN202210858635 A CN 202210858635A CN 115082435 A CN115082435 A CN 115082435A
- Authority
- CN
- China
- Prior art keywords
- defect
- sample
- image
- positive
- momentum
- 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.)
- Granted
Links
- 230000007547 defect Effects 0.000 title claims abstract description 97
- 238000001514 detection method Methods 0.000 title claims abstract description 31
- 238000000034 method Methods 0.000 claims abstract description 31
- 230000002159 abnormal effect Effects 0.000 claims abstract description 29
- 230000006870 function Effects 0.000 claims abstract description 14
- 238000005520 cutting process Methods 0.000 claims abstract description 10
- 239000013598 vector Substances 0.000 claims description 28
- 238000009826 distribution Methods 0.000 claims description 18
- 238000012549 training Methods 0.000 claims description 15
- 238000009499 grossing Methods 0.000 claims description 7
- 238000005070 sampling Methods 0.000 claims description 7
- 238000004364 calculation method Methods 0.000 claims description 4
- 238000012360 testing method Methods 0.000 claims description 4
- 238000012545 processing Methods 0.000 claims description 3
- 238000010276 construction Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000008859 change Effects 0.000 description 2
- 230000000052 comparative effect Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000004913 activation Effects 0.000 description 1
- 230000002547 anomalous effect Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000012512 characterization method Methods 0.000 description 1
- 230000002950 deficient Effects 0.000 description 1
- 238000010191 image analysis Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000001788 irregular Effects 0.000 description 1
- 230000007786 learning performance Effects 0.000 description 1
- 239000007788 liquid Substances 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003062 neural network model Methods 0.000 description 1
- 230000000644 propagated effect Effects 0.000 description 1
- 238000000926 separation method Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/26—Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/28—Quantising the image, e.g. histogram thresholding for discrimination between background and foreground patterns
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/764—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
- G06V10/765—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects using rules for classification or partitioning the feature space
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing 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/772—Determining representative reference patterns, e.g. averaging or distorting patterns; Generating dictionaries
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing 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/774—Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20081—Training; Learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20084—Artificial neural networks [ANN]
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Multimedia (AREA)
- Evolutionary Computation (AREA)
- Computing Systems (AREA)
- Artificial Intelligence (AREA)
- Databases & Information Systems (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Software Systems (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
- Image Processing (AREA)
Abstract
The invention relates to the technical field of single-classification image detection, and discloses a defect detection method based on self-supervision momentum comparison, which comprises the following steps: generating an original pseudo-defect image; cutting a small rectangular area with variable size and aspect ratio from the original pseudo-defect image, randomly rotating the small rectangular area and dithering pixel values, and then pasting the small rectangular area to the random position of the positive sample to form a pseudo-defect image; positive and negative sample characteristics which can obviously reflect the existence of defects are generated by utilizing a comparison learning loss function driving model, so that a normal sample and a defect sample are separated, a characteristic dictionary is maintained by utilizing a momentum comparison method, and the characteristics of the positive and negative samples are learned while the characteristics keep consistency; and calculating the defect abnormal score by using a Gaussian density estimator, and judging whether the whole image is a defect image. The method can simulate the irregularity, the continuity and the diversity of the defect data as accurately as possible, and improve the detection accuracy of the model according to the method.
Description
Technical Field
The invention relates to the technical field of single-classification image detection, in particular to a defect detection method based on self-supervision momentum comparison.
Background
Anomaly detection is intended to detect instances of anomalies and defect patterns that differ from what is seen for normal instances. Many of the problems from different vision applications are anomaly detection, including manufacturing defect detection, medical image analysis, and video surveillance. Unlike typical supervised classification problems, anomaly detection faces unique challenges.
First, due to the different nature of the problem, it is difficult to obtain large amounts of anomalous data, whether tagged or untagged. Second, the defect region may be a small and subtle high resolution image, so the difference between normal and abnormal patterns tends to be fine grained. Second, due to limited access to the anomaly data, the construction of an anomaly detector is typically done under semi-supervised or single classification settings using only normal data. Finally, since the distribution of abnormal patterns is unknown in advance, general training models only learn the existence of normal examples, and therefore these training models do not determine well whether a test sample is abnormal.
In summary, the invention provides a defect detection method based on self-supervision momentum comparison, which can construct defect data, simulate the irregularity, the continuity and the diversity of the defect data as accurately as possible, and improve the detection accuracy of a model according to the method so as to solve the problem of low accuracy of abnormal detection.
Disclosure of Invention
The invention aims to provide a defect detection method based on self-supervision momentum comparison.
The invention is realized by the following technical scheme: a defect detection method based on self-supervision momentum contrast comprises the following steps:
step S1, constructing a Gaussian noise sample image as an original pseudo-defect image according to the original positive type sample, the randomly generated mean value and the variance in the data set;
step S2, generating a negative type sample by using a sample mixing operation;
step S3, positive and negative sample characteristics which can obviously reflect the existence of defects are generated by using a contrast learning loss function driving model, so that a normal sample and a defect sample are separated, a characteristic dictionary is maintained by using a momentum contrast method, and the characteristics of the positive and negative samples are learned while the characteristics keep consistency;
and step S4, calculating the abnormal score of the defect by using a Gaussian density estimator, judging whether the whole image is a defect image, dividing the image into image blocks according to a fixed step length when the image is tested for positioning the defect, extracting features from all the image blocks, calculating the abnormal score of each image block, and transmitting the abnormal score to each pixel by using a Gaussian smoothing method.
The invention discloses a defect detection method based on self-supervision momentum comparison, which combines an original positive sample in a data set, utilizes a randomly generated mean value and variance to jointly construct a Gaussian noise sample image, utilizes a Berlin noise generator to generate a noise image, carries out binarization through a uniformly randomly sampled threshold value to form a defect distribution map, and utilizes the positive sample and the Gaussian noise sample to combine to generate an original pseudo-defect image according to the defect distribution map; cutting a small rectangular area with variable size and aspect ratio from the original pseudo-defect image, randomly rotating and dithering the pixel value of the small rectangular area, and then pasting the small rectangular area to the random position of the positive type sample to form a pseudo-defect image, namely a negative type sample; positive and negative sample characteristics which can obviously reflect the existence of defects are generated by using a comparison learning loss function driving model, so that a normal sample and a defect sample are separated as far as possible, a larger characteristic dictionary is maintained by using a momentum comparison method, and the characteristics of the positive and negative samples are learned while the characteristics are kept consistent; calculating the abnormal score of the defect by using a Gaussian density estimator, judging whether the whole image is the defect image, dividing the image into image blocks according to a fixed step length when the image positioning defect is tested, extracting features from all the image blocks, calculating the abnormal score of each image block, and transmitting the abnormal score to each pixel by using a Gaussian smoothing method. The invention provides a novel pseudo defect construction method and a training frame based on positive and negative samples, which can effectively detect defects on the aspect of single classification. The pseudo-defect sample construction method accurately simulates the irregularity, the coherence and the diversity of the defect sample, and ensures the further improvement of the learning performance of the neural network model.
In order to better implement the present invention, further, the step S1 includes:
step S11, combining the original positive samples in the data set, and constructing a Gaussian noise sample image by using the randomly generated mean value and variance;
step S12, generating a noise image by using a Berlin noise generator;
step S13, performing binarization processing on the noise image through a threshold value of uniform random sampling to form a defect distribution map;
and step S14, generating an original pseudo-defect image by combining the normal sample and the Gaussian noise sample according to the defect distribution map.
In order to better implement the present invention, further, the step S2 includes:
randomly selecting a cutting area from an original pseudo-defect image, cutting a small rectangular area with variable size and aspect ratio, randomly rotating the small rectangular area and dithering pixel values, and then pasting the small rectangular area to a random position of a positive sample to form a pseudo-defect image as a negative sample.
In order to better implement the present invention, further, the step S1 includes:
step S11, combining the original positive samples in the data set, and constructing a Gaussian noise sample image by using the randomly generated mean value and variance;
step S12, generating a noise image using a berlin noise generator;
step S13, performing binarization processing on the noise image through a threshold value of uniform random sampling to form a defect distribution map;
and step S14, generating an original pseudo-defect image by combining the normal sample and the Gaussian noise sample according to the defect distribution map.
In order to better implement the present invention, further, the step S2 includes:
a negative class sample is generated using a sample mixing operation.
In order to better implement the present invention, further, the step S3 includes:
constructing a corresponding negative sample for each positive sample through sample mixing operation, and generating a negative sample set;
combining the positive and negative sample sets to create a sample space;
generating a query view and a dictionary view by a random data expansion method, and sending the query view and the dictionary view into a corresponding query network and a corresponding dictionary network to obtain a pair of embedded vectors q and k;
and adding a classifier driving model after the network is queried for training, performing momentum updating by using the dictionary network and the query network, and performing comparison learning according to the embedded vector acquired by the dictionary network and the embedded vector acquired by the query network.
In order to better implement the present invention, further, the step S4 includes:
when the image positioning defect is tested, dividing the image into image blocks according to a fixed step length, extracting features from all the image blocks, calculating the abnormal score of each image block, and transmitting the calculated abnormal score to each pixel by using a Gaussian smoothing method;
randomly selecting an embedded vector of a sample in a training set to participate in the calculation of a total probability formula;
calculating the mean value and the variance of each embedded vector, and obtaining a total probability formula according to the obtained mean value and variance;
and for the test sample, calculating a defect abnormity score according to a total probability formula, and judging whether the whole image is a defect image according to the defect abnormity score to finish defect detection.
Compared with the prior art, the invention has the following advantages and beneficial effects:
(1) the invention provides a construction method of defect data, which can simulate the irregularity, the continuity and the diversity of the defect data as accurately as possible and improve the detection accuracy of a model according to the method;
(2) the invention utilizes the comparison learning framework to drive the model to generate positive and negative sample characteristics which can obviously reflect the existence of defects, so that the positive and negative samples are separated as far as possible;
(3) the invention maintains a larger feature dictionary by using a momentum comparison method, and learns the characterization of positive and negative samples while keeping the consistency of the features.
Drawings
The invention is further described in connection with the following figures and examples, all of which are intended to be open ended and within the scope of the invention.
Fig. 1 is a schematic diagram of defect data generation in a defect detection method based on an auto-supervision momentum contrast according to the present invention.
Fig. 2 is a schematic flow chart of a defect detection method based on auto-supervision momentum contrast according to the present invention.
Detailed Description
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it should be understood that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments, and therefore should not be considered as a limitation to the scope of protection. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
In the embodiment of the invention, the mixnoise operation is a sample mixing operation, the Perlin noise generator is a Berlin noise generator, the query view is a query view, the key view is a dictionary view, the key network is a dictionary network, and the query network is a query network.
Example 1:
the defect detection method based on the auto-supervised momentum comparison of the present embodiment is a schematic diagram of defect data generation as shown in fig. 1, and two examples are illustrated to show how defect data is generated. In order to simulate the irregularity, the continuity and the diversity of the defect data as accurately as possible, a Berlin noise generator is used for generating a noise image with the same size as a sample, and a defect distribution diagram is formed by binarizing the noise image through a uniform random sampling threshold valueAnd randomly generating a mean value and a variance for each positive sample in the data set, generating Gaussian noise according to the values of the mean value and the variance and the size of the positive sample, and superposing the Gaussian noise on the positive sample to construct a Gaussian noise sample image A. The Gaussian noise sample image is distributed according to the defect distribution mapPerforming texture display and matching with the positive type sampleMixing to form defect anomalies beyond the distribution to obtain an original pseudo-defect image. From the original pseudo-defect imageIn cutting a blockAnd randomly rotating and dithering the small rectangular area, and then pasting the small rectangular area to the random position of the positive type sample to form a pseudo-defect image, namely the negative type sample. As shown in fig. 2, in the present invention, first, only normal samples without defects in the single classification defect detection data set, i.e., the original positive type samples in the data set, are constructed, and then the defect samples (negative type samples) are constructed, so that the positive type samples in the data set are used at first. Combining an original positive sample in a data set, using a numerical value generated by a random function as a mean value and a variance, using a random function random to randomly generate a numerical value as a mean value and a variance, constructing a Gaussian noise sample image with the same size as an original image according to the randomly generated mean value and variance, generating a noise image by using a Berlin noise generator, performing binarization by using a uniformly randomly sampled threshold value to form a defect distribution map, and combining the positive sample and the Gaussian noise sample to generate an original pseudo-defect image according to the defect distribution map. Secondly, cutting a small rectangular area with variable size and aspect ratio from the original pseudo-defect image, randomly rotating and dithering the pixel value of the small rectangular area, randomly rotating the rectangular area for simulating the irregularity of the defect sample by the cut small rectangular area, and then pasting the small rectangular area to the random position of the positive sample to form the pseudo-defect image, namely the negative sample. Secondly, positive and negative sample characteristics which can obviously reflect the existence of defects are generated by using a comparison learning loss function driving model, so that a normal sample and a defect sample are separated as much as possible, a larger characteristic dictionary is maintained by using a momentum comparison method, and the characteristics of the positive and negative samples are learned while the characteristics keep consistency. Finally, a Gaussian density estimator is used for calculating defect abnormal scores, the abnormal scores have two uses, and the first method is that the embedded vector of the whole image calculates the abnormal scores to judge whether the image has defects; the other method is that the abnormal score is utilized to help the image to be positioned, whether the whole image is a defect image is judged, when the image positioning defect is tested, the image is divided into image blocks according to a fixed step length, the characteristics are extracted from all the image blocks, and the abnormal score is counted for each image blockAn anomaly score is computed and propagated to each pixel using gaussian smoothing.
Example 2:
this embodiment is further optimized based on embodiment 1, in which a Perlin noise generator (berlin noise generator) is used to generate a noise image and capture various abnormal shapes, binarization is performed by a uniform random sampling threshold value to form a defect distribution map, and an original pseudo-defect image is generated by combining a normal sample and a gaussian noise sample according to the defect distribution map.
The invention is provided withIn order to be a sample space, the sample space,where n is the number of samples in the dataset.
Generating a Perlin noise image (Berlin noise image) P by a Perlin noise generator (Berlin noise generator), and binarizing the noise image P by uniformly randomly sampling a threshold to form a defect distribution map。
Randomly generating a mean value and a variance value for each positive type sample in the data set, generating Gaussian noise according to the values of the mean value and the variance value and the size of the positive type sample, and superposing the Gaussian noise on the positive type sample subjected to any three data enhancement operations (the data enhancement operations comprise sharpness, brightness change, color change and tone separation) to construct a constructed Gaussian noise sample image A.
The Gaussian noise sample image is distributed according to the defect distribution diagramPerforming texture display and matching with the positive type sampleMixing to form an oversubscribed profileTrapping anomalies to obtain an original pseudo-defect image. Original pseudo-defect imageIs defined as
Wherein,is composed ofThe inverse of (a) is,is a point-by-point operation,is a transparency parameter upon mixing, the parameter being selected fromInterval uniform sampling, i.e.And A is the constructed Gaussian noise sample image.
Other parts of this embodiment are the same as embodiment 1, and thus are not described again.
Example 3:
this embodiment is further optimized on the basis of the above embodiment 1 or 2, from the original pseudo-defect imageCutting a small rectangular area with variable size and aspect ratio, randomly rotating the small rectangular area and dithering the pixel value, and then dividing the small rectangular areaThe random position where the fields are pasted to the positive type samples forms a pseudo-defect image, i.e., the negative type samples.
The invention defines a mixnoise operation (sample mixing operation) to generate a negative class sample, which is essentially a data enhancement strategy, and particularly generates a local irregular noise pattern and puts the noise pattern into a positive class sample to try to simulate defect data in real life.
The mixnoise operation (sample mixing operation) proposed by the invention is to obtain the original pseudo-defect imageCutting a small rectangular area with randomly variable size and aspect ratio, randomly rotating the small rectangular area and dithering pixel values, and then pasting the transformed small rectangular area to a positive sampleThereby forming a final pseudo-defect image, i.e., a negative type sample, represented as:wherein, in the process,in order to be a negative class sample set,is the nth negative class sample, and n is the number of samples.
The rest of this embodiment is the same as embodiment 1 or 2, and therefore, the description thereof is omitted.
Example 4:
in this embodiment, a comparison learning loss function is used to drive the model to generate positive and negative type sample features that can obviously reflect the existence of defects, so that the normal sample and the negative type sample are separated as much as possible, a larger feature dictionary is maintained by using a momentum comparison method, and the features of the positive and negative type samples are learned while the features are kept consistent.
First, construct a set of negative class samples by a mixnoise operation (sample mixing operation) for each positive class sampleWherein, in the process,in order to be a negative class sample set,for the nth negative sample class, n is the number of samples, and the positive and negative sample class sets are combined to create a sample spaceExpressed as:where n is the number of samples, due to the sample spaceIs created by combining positive and negative samples, so that the total number of the samples is 2n, and the random data expansion method is adoptedTwo views, namely, the query view and the key view, are generated and then fed into a query networkHeke network (dictionary network)Obtaining a pair of embedded vectorsAndhere, both the query network (query network) and the key network (dictionary network) are Resnet50 networks with classifiers removed, i.e., a common convolutional layer, a BN layer, and a ReLU activation function followed by four residual modules. For query network (query network)The method has two functions of acquiring embedded vectors and training input data, and for the later functions, the method is applied to a query network (inquiry network)A classifier-driven model training is added later, represented as:
(2) whereinis a function of the classification loss for the,the normal sample is put into a query network (query network) after data enhancement operation, the prediction and the original label are obtained through a classifier to carry out cross entropy operation,the positive type sample is put into a query network (query network) after being subjected to data enhancement operation by using a negative type sample obtained by mixnoise operation, the prediction and the original label are subjected to cross entropy operation by using a classifier,for cross entropy loss, for contrast learning, through the query network (query network)Obtaining the embedded vector of the positive sample with the category of 0 and the rest embedded vectors for comparison learning, firstly constructing a comparison embedded libraryAnd is represented as:
wherein,andis a set of embedded vectors obtained by inputting the query view (query view) and the key view (dictionary view) of all samples of the current batch into a query network (query network) and a key network (dictionary network) respectively,a queue of embedded vectors, i.e., a feature dictionary, is stored for training. During training, a positive type sample with the category of 0 in the current batch is randomly selectedEmbedded vector of, uniteAll the positive samples in (1) form a positive sample setTraining a model, a loss function for a specific trainingComprises the following steps:
wherein,,is a parameter of the temperature of the liquid,is from a positive sample setThe embedding vector of class 0 obtained in (1),is an embedded vector obtained from a query network (query network),is a contrast embedding warehouseAll embedded vectors obtained from the key network (dictionary network);
the overall loss function in the network framework is:
by usingParameter updating is carried out on the query network (query network), momentum updating is used by the key network (dictionary network) and the query network (query network) in a joint mode, and the method is represented as follows:
wherein,is a parameter of the key network (dictionary network),is a parameter of the query network (query network),is a momentum coefficient. Finally, a queue is maintained to store the latest embedded vector. Adding a classifier driving model after a query network (query network) for training, performing momentum updating by using a key network (dictionary network) and the query network (query network), performing comparative learning according to an embedded vector acquired by the key network (dictionary network) and an embedded vector acquired by the query network (query network), updating the key network (dictionary network) through parameters of the query network (query network), performing comparative learning by combining all embedded vectors output by the two networks, wherein 0/1 prediction output by the classifier can assist in correct defect judgment. Each sample is provided with 0/1 labels, namely a positive sample and a defective negative sample, and is compared with a query network (query network) in a learning network for classification.
Other parts of this embodiment are the same as any of embodiments 1 to 3, and thus are not described again.
Example 5:
in this embodiment, a gaussian density estimator is used to calculate the defect anomaly score so as to determine whether the sample has defects or not. When the defect positioning is carried out on the test sample, the image is divided into image blocks according to a fixed step length, features are extracted from all the image blocks, the abnormal score calculation is carried out on each image block, and the abnormal score is spread to each pixel by using a Gaussian smoothing method. For arbitrary samplesThe defect judgment is carried out, and the anomaly detection is realized by using Gaussian density estimation as follows:
wherein is prepared fromAndis the mean and variance obtained from the embedded vectors of the training data, m is the number of selected embedded vectors,is a query network. The gaussian density estimator can determine whether the image is a defect image. When the image positioning defect is tested, the image is divided into image blocks according to a fixed step length, embedded vectors are extracted from all the image blocks, the abnormal score calculation is carried out on each image block, and the abnormal score is spread to each pixel by using a Gaussian smoothing method.
Other parts of this embodiment are the same as any of embodiments 1 to 4, and thus are not described again.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention in any way, and all simple modifications and equivalent variations of the above embodiments according to the technical spirit of the present invention are included in the scope of the present invention.
Claims (5)
1. A defect detection method based on self-supervision momentum contrast is characterized by comprising the following steps:
step S1, constructing a Gaussian noise sample image as an original pseudo-defect image according to the original positive type sample, the randomly generated mean value and the variance in the data set;
step S2, generating a negative type sample by using a sample mixing operation;
step S3, positive and negative sample characteristics which can obviously reflect the existence of defects are generated by using a contrast learning loss function driving model, so that a normal sample and a negative sample are separated, a characteristic dictionary is maintained by using a momentum contrast method, and the characteristics of the positive and negative samples are learned while the characteristics keep consistency;
and step S4, calculating defect abnormal scores by using a Gaussian density estimator, and judging whether the whole image is a defect image according to the defect abnormal scores to finish defect detection.
2. The method for defect detection based on the auto-supervised momentum contrast as claimed in claim 1, wherein the step S1 includes:
step S11, combining the original positive samples in the data set, and constructing a Gaussian noise sample image by using the randomly generated mean value and variance;
step S12, generating a noise image using a berlin noise generator;
step S13, performing binarization processing on the noise image through a threshold value of uniform random sampling to form a defect distribution map;
and step S14, generating an original pseudo-defect image by combining the normal sample and the Gaussian noise sample according to the defect distribution map.
3. The method for defect detection based on the auto-supervised momentum contrast as claimed in claim 1, wherein the step S2 includes:
randomly selecting a cutting area from an original pseudo-defect image, cutting a small rectangular area with variable size and aspect ratio, randomly rotating the small rectangular area and dithering pixel values, and then pasting the small rectangular area to a random position of a positive sample to form a pseudo-defect image as a negative sample.
4. The method for defect detection based on the auto-supervised momentum contrast as claimed in claim 1, wherein the step S3 includes:
constructing a corresponding negative sample for each positive sample through sample mixing operation, and generating a negative sample set;
combining the positive and negative sample sets to create a sample space;
generating a query view and a dictionary view by a random data expansion method, and sending the query view and the dictionary view into a corresponding query network and a corresponding dictionary network to obtain a pair of embedded vectors q and k;
and adding a classifier driving model after the network is queried for training, performing momentum updating by using the dictionary network and the query network, and performing comparison learning according to the embedded vector acquired by the dictionary network and the embedded vector acquired by the query network.
5. The method for defect detection based on the auto-supervised momentum contrast as claimed in claim 1, wherein the step S4 includes:
when the image positioning defect is tested, dividing the image into image blocks according to a fixed step length, extracting features from all the image blocks, calculating the abnormal score of each image block, and transmitting the calculated abnormal score to each pixel by using a Gaussian smoothing method;
randomly selecting an embedded vector of a sample in a training set to participate in the calculation of a total probability formula;
calculating the mean value and the variance of each embedded vector, and obtaining a total probability formula according to the obtained mean value and variance;
and for the test sample, calculating a defect abnormal score according to a total probability formula, and judging whether the whole image is a defect image according to the defect abnormal score to finish defect detection.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210858635.XA CN115082435B (en) | 2022-07-21 | 2022-07-21 | Defect detection method based on self-supervision momentum contrast |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210858635.XA CN115082435B (en) | 2022-07-21 | 2022-07-21 | Defect detection method based on self-supervision momentum contrast |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115082435A true CN115082435A (en) | 2022-09-20 |
CN115082435B CN115082435B (en) | 2022-11-22 |
Family
ID=83243835
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210858635.XA Active CN115082435B (en) | 2022-07-21 | 2022-07-21 | Defect detection method based on self-supervision momentum contrast |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115082435B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115690094A (en) * | 2022-12-12 | 2023-02-03 | 常州微亿智造科技有限公司 | Industrial defect detection method and system based on self-supervision network |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111982910A (en) * | 2020-07-06 | 2020-11-24 | 华南理工大学 | Weak supervision machine vision detection method and system based on artificial defect simulation |
CN112365468A (en) * | 2020-11-11 | 2021-02-12 | 南通大学 | AA-gate-Unet-based offshore wind power tower coating defect detection method |
CN112464879A (en) * | 2020-12-10 | 2021-03-09 | 山东易视智能科技有限公司 | Ocean target detection method and system based on self-supervision characterization learning |
CN112966755A (en) * | 2021-03-10 | 2021-06-15 | 深圳市固电电子有限公司 | Inductance defect detection method and device and readable storage medium |
CN112991330A (en) * | 2021-04-19 | 2021-06-18 | 征图新视(江苏)科技股份有限公司 | Knowledge distillation-based positive sample industrial defect detection method |
CN113032458A (en) * | 2021-03-23 | 2021-06-25 | 中国人民解放军63920部队 | Method and device for determining abnormality of spacecraft |
CN113313684A (en) * | 2021-05-28 | 2021-08-27 | 北京航空航天大学 | Video-based industrial defect detection system under dim light condition |
US20210319266A1 (en) * | 2020-04-13 | 2021-10-14 | Google Llc | Systems and methods for contrastive learning of visual representations |
US20210327029A1 (en) * | 2020-04-13 | 2021-10-21 | Google Llc | Systems and Methods for Contrastive Learning of Visual Representations |
CN114281985A (en) * | 2021-09-30 | 2022-04-05 | 腾讯科技(深圳)有限公司 | Sample feature space enhancement method and device |
-
2022
- 2022-07-21 CN CN202210858635.XA patent/CN115082435B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20210319266A1 (en) * | 2020-04-13 | 2021-10-14 | Google Llc | Systems and methods for contrastive learning of visual representations |
US20210327029A1 (en) * | 2020-04-13 | 2021-10-21 | Google Llc | Systems and Methods for Contrastive Learning of Visual Representations |
CN111982910A (en) * | 2020-07-06 | 2020-11-24 | 华南理工大学 | Weak supervision machine vision detection method and system based on artificial defect simulation |
CN112365468A (en) * | 2020-11-11 | 2021-02-12 | 南通大学 | AA-gate-Unet-based offshore wind power tower coating defect detection method |
CN112464879A (en) * | 2020-12-10 | 2021-03-09 | 山东易视智能科技有限公司 | Ocean target detection method and system based on self-supervision characterization learning |
CN112966755A (en) * | 2021-03-10 | 2021-06-15 | 深圳市固电电子有限公司 | Inductance defect detection method and device and readable storage medium |
CN113032458A (en) * | 2021-03-23 | 2021-06-25 | 中国人民解放军63920部队 | Method and device for determining abnormality of spacecraft |
CN112991330A (en) * | 2021-04-19 | 2021-06-18 | 征图新视(江苏)科技股份有限公司 | Knowledge distillation-based positive sample industrial defect detection method |
CN113313684A (en) * | 2021-05-28 | 2021-08-27 | 北京航空航天大学 | Video-based industrial defect detection system under dim light condition |
CN114281985A (en) * | 2021-09-30 | 2022-04-05 | 腾讯科技(深圳)有限公司 | Sample feature space enhancement method and device |
Non-Patent Citations (3)
Title |
---|
KAIMING HE等: "《Momentum Contrast for UnsuperVised Visual Representation Learning》", 《2020 IEEE/CVF CONFERENCE ON COMPUTER VISION AND PATTERN RECOGNITION (CVPR)》 * |
张倩等: "《基于自监督表征学习的海面目标检测方法》", 《水下无人系统学报》 * |
张玲玲等: "《基于对比约束的可解释小样本学习》", 《计算机研究与发展》 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115690094A (en) * | 2022-12-12 | 2023-02-03 | 常州微亿智造科技有限公司 | Industrial defect detection method and system based on self-supervision network |
Also Published As
Publication number | Publication date |
---|---|
CN115082435B (en) | 2022-11-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107330453B (en) | Pornographic image identification method based on step-by-step identification and fusion key part detection | |
CN110852316B (en) | Image tampering detection and positioning method adopting convolution network with dense structure | |
CN109919934B (en) | Liquid crystal panel defect detection method based on multi-source domain deep transfer learning | |
CN112001903A (en) | Defect detection network construction method, abnormality detection method and system, and storage medium | |
CN112183788A (en) | Domain adaptive equipment operation detection system and method | |
CN107169417B (en) | RGBD image collaborative saliency detection method based on multi-core enhancement and saliency fusion | |
CN113870128B (en) | Digital mural image restoration method based on depth convolution countermeasure network | |
CN111027590B (en) | Breast cancer data classification method combining deep network features and machine learning model | |
Christlein et al. | A study on features for the detection of copy-move forgeries | |
CN112686894A (en) | FPCB (flexible printed circuit board) defect detection method and device based on generative countermeasure network | |
CN115082435B (en) | Defect detection method based on self-supervision momentum contrast | |
CN111242026A (en) | Remote sensing image target detection method based on spatial hierarchy perception module and metric learning | |
CN114550110A (en) | Vehicle weight identification method and system based on unsupervised domain adaptation | |
Nirmala et al. | A modern approach for image forgery detection using BRICH clustering based on normalised mean and standard deviation | |
CN114972216A (en) | Construction method and application of texture surface defect detection model | |
CN116188516A (en) | Training method of defect data generation model | |
CN115661539A (en) | Less-sample image identification method embedded with uncertainty information | |
CN114820541A (en) | Defect detection method based on reconstructed network | |
CN117456272A (en) | Self-supervision abnormality detection method based on contrast learning | |
CN117058716A (en) | Cross-domain behavior recognition method and device based on image pre-fusion | |
CN116912144A (en) | Data enhancement method based on discipline algorithm and channel attention mechanism | |
CN116682057A (en) | Substation potential safety hazard detection method based on window self-attention mechanism | |
CN115546689A (en) | Video time sequence abnormal frame detection method based on unsupervised frame correlation | |
CN115409822A (en) | Industrial part surface anomaly detection method based on self-supervision defect detection algorithm | |
CN112861670B (en) | Transmission line hardware detection method and system |
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 |