CN116051479A - Textile defect identification method integrating cross-domain migration and anomaly detection - Google Patents
Textile defect identification method integrating cross-domain migration and anomaly detection Download PDFInfo
- Publication number
- CN116051479A CN116051479A CN202211679870.7A CN202211679870A CN116051479A CN 116051479 A CN116051479 A CN 116051479A CN 202211679870 A CN202211679870 A CN 202211679870A CN 116051479 A CN116051479 A CN 116051479A
- Authority
- CN
- China
- Prior art keywords
- domain
- data
- feature
- fabric
- sample
- 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
Links
- 230000007547 defect Effects 0.000 title claims abstract description 73
- 239000004753 textile Substances 0.000 title claims abstract description 38
- 238000000034 method Methods 0.000 title claims abstract description 29
- 238000001514 detection method Methods 0.000 title claims abstract description 24
- 238000013508 migration Methods 0.000 title claims abstract description 14
- 230000005012 migration Effects 0.000 title claims abstract description 14
- 239000004744 fabric Substances 0.000 claims abstract description 58
- 230000007246 mechanism Effects 0.000 claims abstract description 8
- 238000013140 knowledge distillation Methods 0.000 claims abstract description 7
- 238000012549 training Methods 0.000 claims description 22
- 238000012360 testing method Methods 0.000 claims description 20
- 230000006870 function Effects 0.000 claims description 19
- 230000000877 morphologic effect Effects 0.000 claims description 12
- 230000008569 process Effects 0.000 claims description 12
- 238000010586 diagram Methods 0.000 claims description 9
- 230000002159 abnormal effect Effects 0.000 claims description 8
- 230000004913 activation Effects 0.000 claims description 7
- 238000013527 convolutional neural network Methods 0.000 claims description 6
- 238000000605 extraction Methods 0.000 claims description 5
- 238000013528 artificial neural network Methods 0.000 claims description 4
- 238000012937 correction Methods 0.000 claims description 4
- 239000000284 extract Substances 0.000 claims description 4
- 238000013507 mapping Methods 0.000 claims description 4
- 239000011159 matrix material Substances 0.000 claims description 4
- 238000011176 pooling Methods 0.000 claims description 4
- 238000012545 processing Methods 0.000 claims description 4
- 238000012935 Averaging Methods 0.000 claims description 2
- 238000004364 calculation method Methods 0.000 claims description 2
- 238000005516 engineering process Methods 0.000 claims description 2
- 238000011478 gradient descent method Methods 0.000 claims description 2
- 238000005457 optimization Methods 0.000 claims description 2
- 238000007781 pre-processing Methods 0.000 claims description 2
- 230000001902 propagating effect Effects 0.000 claims description 2
- 238000010845 search algorithm Methods 0.000 claims description 2
- 230000009466 transformation Effects 0.000 claims description 2
- 230000004927 fusion Effects 0.000 claims 1
- 238000004519 manufacturing process Methods 0.000 abstract description 8
- 238000002372 labelling Methods 0.000 abstract description 4
- 238000009826 distribution Methods 0.000 abstract description 3
- 238000013135 deep learning Methods 0.000 description 5
- 238000013136 deep learning model Methods 0.000 description 5
- 230000000694 effects Effects 0.000 description 3
- 239000000463 material Substances 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 230000005856 abnormality Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000015556 catabolic process Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000006731 degradation reaction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 235000003642 hunger Nutrition 0.000 description 1
- 238000009776 industrial production Methods 0.000 description 1
- 208000011580 syndromic disease Diseases 0.000 description 1
- 230000035922 thirst Effects 0.000 description 1
- 230000000007 visual effect Effects 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
- G06T7/0004—Industrial image inspection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/084—Backpropagation, e.g. using gradient descent
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/088—Non-supervised learning, e.g. competitive learning
-
- 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/40—Extraction of image or video features
-
- 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
-
- 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
- G06V10/7753—Incorporation of unlabelled data, e.g. multiple instance learning [MIL]
-
- 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]
-
- 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/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30124—Fabrics; Textile; Paper
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- Software Systems (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Computing Systems (AREA)
- Multimedia (AREA)
- Databases & Information Systems (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Molecular Biology (AREA)
- Life Sciences & Earth Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Medical Informatics (AREA)
- General Engineering & Computer Science (AREA)
- Mathematical Physics (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
Abstract
The invention relates to a textile defect identification method integrating cross-domain migration and anomaly detection. And a semi-supervised learning mechanism is introduced, the characteristic distribution of a source domain and a target domain is deeply excavated, the domain migration is realized by utilizing a production countermeasure mode, and the fabric pattern can still be accurately identified when the fabric pattern is changed. Aiming at small-scale surface defects of the fabric, an unsupervised anomaly detection method based on multi-level feature matching is designed, knowledge distillation and a multi-level feature matching mechanism are utilized, so that a model is more targeted, the fabric defects can be accurately detected without labeling, and low-cost and high-precision identification of the fabric is realized.
Description
Technical Field
The invention relates to the fields of deep learning, field self-adaption, anomaly detection and textile defect identification, in particular to a textile defect identification method integrating cross-domain migration and anomaly detection.
Background
Textiles are an indispensable material for people in daily life and industrial fields, and the demand of the textiles is increasing. However, in the production process, due to the existence of objective factors such as thread materials, machine faults, manual operation errors, production environments and the like, various defects are formed on the surface of the textile, and quality detection becomes important. In the industrial field, the fabric is manufactured in a loop-to-loop manner, and earlier defects are found to reduce losses to a greater extent. In view of the drawbacks of the conventional detection methods, automatic classification of fabric defects has become an industry trend.
With the development of hardware equipment, the deep learning method is widely applied to defect identification of fabrics in recent years, so that the related research and application of the industry are promoted, and a plurality of defect detection schemes based on a deep convolutional neural network are developed. The method can automatically extract the characteristics from the fabric image, and various general supervision type deep learning algorithms such as FasterR-CNN, SSD, YOLO and the like are widely studied and applied in the field. However, existing fabric defects have the characteristic of different scales. Aiming at fabric defects with different sizes and scales, the detection difficulty is different, if the existing deep learning method is used for directly detecting the mixed scale, the requirements on the algorithm are high, the ideal identification effect is difficult to achieve in the aspects of detection efficiency and accuracy, and the real-time production requirement cannot be met.
The supervised deep learning model has the characteristic of data hunger and thirst, a large amount of defect data is required to be fed in the model training process, and the difficulty in acquiring the defect data in the actual textile production process is far higher than that of normal data. In addition, the models trained by the deep learning methods are solidified, when the patterns of the textiles change, old models are not suitable for new patterns, if migration of the styles of the textiles is to be completed, data must be collected again, the new and old patterns are integrated, the models are retrained, and the collection and labeling of the data are labor-consuming and inefficient.
Therefore, how to solve the problems of small data quantity of textile defects, high labeling cost, different defect scales and various defect patterns, and realize high-precision identification of the defects of the textile is an urgent problem to be solved by the invention.
Disclosure of Invention
The invention aims to solve the problem of how to finish fabric defect identification in the mode of lowest cost and highest efficiency in the production process of textiles, and because only fabric defects need to be identified in the actual production process of textiles, normal textiles are reserved, large-scale defect characteristics are more obvious and are easier to identify by a model, according to the thought, the textile defect identification method integrating cross-domain migration and anomaly detection is provided, the multi-scale multi-model high-precision identification can be realized on the premise of only marking a small amount of fabric data, an image is firstly sent into a morphological defect identification network to identify whether large-scale defects exist, then the large-scale defects are detected by a surface defect detection network, and if the large-scale defects exist, the detection of the small-scale defects can be skipped, and a result is directly output.
In order to achieve the above purpose, the technical scheme of the invention is as follows: a textile defect identification method integrating cross-domain migration and anomaly detection comprises the following steps:
step 1, preprocessing the fabric image data
The method comprises the steps of collecting a fabric image through a machine to serve as an original data set, processing initial data in the original data set, selecting a fixed pattern to serve as a source domain, and integrating other patterns to serve as a target domain;
step 2, establishing a fabric data image library
Dividing an image set into a normal image, a large-scale morphological defect image and a small-scale surface defect image, marking partial data in the morphological defect image, and reserving marking information;
step 3, identifying morphological defects of the fabric
Aiming at the large-scale morphological defects in the fabric, an improved semi-supervised cross-domain neural network SSDANN is provided, and consists of a feature extractor, a label predictor and a domain discriminator; the feature extractor realizes mapping between different styles of data through a source domain and a target domain with a mark; the domain discriminator realizes the migration of data from the source domain to the target domain in an unsupervised learning mode;
in the SSDANN training process, respectively inputting source domain data and target domain data into a feature extractor to extract depth features of the fabric, and subsequently sending feature information into two branches of a label predictor G and a domain discriminator D; performing supervised learning on the source domain data, and optimizing a label predictor; the source domain data and the unlabeled target domain data are input to a domain discriminator to perform unsupervised learning, and feature information between the source domain and the target domain is confused;
step 4, detecting surface defects of the fabric
Aiming at small-scale surface defects in fabrics, an anomaly detection method without the participation of defect data in training is provided: firstly, aiming at the field difference problem of the general field and the textile field, a knowledge distillation technology is adopted to improve the expression capability of a depth model to the textile image characteristics; secondly, designing a multi-level feature extraction method, constructing a normal data feature memory unit, and generating and storing multi-level implicit features of a normal fabric sample; finally, a multi-level feature matching mechanism based on a memory unit is provided, the abnormal score of the sample to be tested is calculated through a nearest neighbor search algorithm, and the fabric state is judged.
Compared with the prior art, the invention has the following beneficial effects: aiming at large-scale morphological defects of fabrics, the invention provides a multi-style fabric defect identification network, a semi-supervised learning mechanism is introduced, the characteristic distribution of a source domain and a target domain is deeply excavated, the field migration is realized by utilizing a production countermeasure mode, and the fabric pattern can be accurately identified when the fabric pattern is changed. Aiming at small-scale surface defects of the fabric, an unsupervised anomaly detection method based on multi-level feature matching is designed, knowledge distillation and a multi-level feature matching mechanism are utilized, so that a model is more targeted, the fabric defects can be accurately detected without labeling, and low-cost and high-precision identification of the fabric is realized.
Drawings
FIG. 1 is a flow chart of the multi-scale defect identification of the textile according to the present invention.
FIG. 2 is a diagram of a SSDANN network architecture
Fig. 3 is a schematic diagram of a knowledge distillation process.
FIG. 4 is a schematic diagram of an anomaly determination framework based on multi-level feature matching
Detailed Description
The technical scheme of the invention is specifically described below with reference to the accompanying drawings.
As shown in fig. 1, in the textile defect identification method based on the combination of cross-domain research and anomaly detection in this example, a morphological defect identification network and a surface defect identification network are respectively designed according to different defect scales.
The module can learn data characteristics between the two fields, a domain discriminator draws in potential relations of fabrics of different patterns in a manner of generating countermeasures, and a label predictor directly identifies textile defects.
And when the output result of the cross-domain network is normal, the multi-level feature matching network module is sent to the anomaly detection network for discrimination, the feature extraction capacity of the small-scale defects can be enhanced by the introduction of knowledge distillation and multi-level feature matching, the precision is improved, and finally, the fabric defect state is judged according to the relationship between the anomaly score output by the network and a threshold value.
FIG. 2 is a schematic diagram of an SSDANN network structure designed for morphological defects in fabrics, wherein a feature extractor consists of a plurality of convolution and pooling layers and is used for mapping data into a specific feature space so as to realize the distinction of a label predictor on fabric types and the confusion of a domain discriminator on whether the fabrics come from a source domain or a target domain. The output of the sigma is taken as an activation function in the sigma:
G f (x;W,b)=sigm(Wx+b) (1)
in the above formula, x is a source domain sample and a target domain sample, W is a weight factor, and b is a bias term. The tagged data of the source domain is fed into the feature extractor and the output part is fed into the tag predictor. The tag predictor classifies the source domain data and classifies the correct tag as much as possible. The output of the tag predictor is a Softmax activation function, which will x s Viewed as an example of a source domain, y s Considered as x s The output of the tag predictor may be expressed as:
G p (G f (x s );Z,k)=softmax(ZG f (x s )+k) (2)
in the above, G f (x s ) Representing the input of the label predictor and also the output of the feature extractor, Z being the weight factor and k being the bias term. Only the feature extractor and the label predictor will be used in the model test and actual use stage, and the loss function can be expressed as follows:
in the above, G p (G f (x s ) Is the output of the tag predictor, y s For source domain sample x s A corresponding tag. Special purposeThe syndrome extractor and the tag classifier form a feed-forward neural network. For a fixed pattern of source domain textiles, there is an optimized objective function as follows:
in the above formula, n represents the number of source domain samples,representing the label prediction loss of the ith sample, λ represents a regularization term parameter, and R (W, b) represents a regularizer, acting to prevent the label prediction network from overfitting. The domain classifier is used for performing domain discrimination on the whole input data, and judging whether the data come from a source domain or a target domain, and can be understood as a classifier. As indicated by the arrow in the figure, this is an unsupervised learning process, at this stage, only unlabeled source domain data and destination domain data are input to the feature extractor, and after processing, the domain classifier performs domain discrimination, and the domain classifier uses a sigmoid activation function, whose output is expressed as:
G d (G f (x m );O,p)=sigm(O T G f (x m )+p) (5)
in the above, x m And the integrated data representing the source domain and the target domain, wherein O and p represent weight and bias items respectively. The domain classifier takes the binary cross entropy as a loss function, the output of which is expressed as:
in the above, d i 0 or 1, indicating the field label of the i-th sample. The feature extractor requires as much interference domain discriminant as possible, preferably to render it unrecognizable to d i From the source domain or the target domain, the domain classifier strives to identify the source of the feature, and by such resistance training, a similar distribution of characteristics can be achieved between the source domain data and the target domain data, with the shared domain notAnd (5) changing characteristics. To simplify the training process, a gradient inversion layer (GRL) is introduced between the feature extractor and the domain classifier. In forward propagation, GRL is considered an identity transformation, and in reverse propagation, gradient inversion is achieved, multiplied by an-alpha and passed on to the previous layer. The forward and backward propagation of the gradient inversion layer is expressed as follows:
where I is an identity matrix. During the back propagation, the gradient of domain classification loss is automatically inverted before back propagating to the parameters of the feature extractor, achieving a resistive loss similar to GAN. The objective optimization function of the domain discriminator is:
the different styles of textiles in different styles are different, the original network is difficult to extract the characteristics from the textile data with different styles, the classification effect is poor and satisfactory, and the requirements of industrial production are difficult to meet. Therefore, the SSDANN network provided by the invention is added with a semi-supervised learning mechanism, and only a small number of samples need to be marked in a target domain for training. Target domain data (x) with label information pt ,y pt ) The input to the feature extractor extracts the features, and the output is as follows:
G f (x pt ;W,b)=ReLU(Wx pt +b) (9)
then, as with the source domain data described above, the output of the feature extractor is input to the tag predictor with the output result being:
G p (G f (x pt );O,p)=softmax(OG f (x pt )+p) (10)
tag classification loss of the tagged target domain data is:
and (3) the calculation mode of the target domain data loss function with the label is the same as that of the formula (3), and the network adopts a gradient descent method to carry out counter propagation so as to realize iterative updating of network parameters. In the SSDANN, the characteristics of target domain data can be extracted due to the existence of a semi-supervised learning mechanism, so that textile defects in different styles can be better distinguished. In the test phase, the target domain test data x tt Inputting the data into a network for testing, sequentially passing through a feature extractor and a label predictor, and finally classifying in the label predictor, wherein the obtained output is shown as follows:
y t =G p (G f (x tt );O,p)=softmax(OG f (x tt )+p)(12)
in the above, y t Representing a one-dimensional vector, each element value representing the probability of a textile defect class, with the index of the maximum value therein as the final output, i.e. the label of the corresponding class.
FIG. 3 is a schematic diagram of an algorithm for knowledge distillation in the present invention, where a deep convolutional neural network can extract high quality visual features of an input image. However, there is a large gap between the textile image and the image in the public domain, and performance degradation phenomenon occurs when the deep learning model in the public domain is directly introduced. Aiming at the field difference problem, a teacher student framework is adopted, knowledge acquired by CNN in the public data set is transferred to the field of fabric images, and the deep learning model has stronger textile field pertinence while retaining the original high-quality image feature extraction capability.
The network mainly comprises two CNN models with the same structure, and the training sample is a normal fabric image. The public domain model is used as a teacher T and is responsible for teaching knowledge, and the network weight parameters of the model are fixed; the textile field model is used as a student S to absorb and learn knowledge, and the network weight parameters are updated according to the loss values in the training process. Assume that and />The first layer feature diagrams output by the training sample I through the teacher model and the student model are respectively represented, and the total loss function of training can be expressed by the following formula:
wherein vec (x) represents performing vectorization operation on the feature map, converting the feature matrix into a 1-dimensional feature vector, and updating the student model by using a random gradient descent algorithm in the training process.
FIG. 4 is a schematic diagram of an anomaly determination framework based on multi-level feature matching designed for small scale surface defects in accordance with the present invention. In the training stage, normal fabric images are taken as input, hidden feature graphs of all layers of the deep learning model are extracted, and a multi-level feature memory unit based on normal data is constructed. In the test stage, aiming at a certain test sample, the same multi-level feature extraction operation is carried out, the multi-level feature of the test data is obtained, multi-level feature matching is carried out on the test data and the constructed memory unit, the abnormal score of the current sample is calculated, and if the score exceeds a certain threshold value, the surface defect of the fabric is judged.
Suppose phi l (I i )∈R (w×h×c) And (3) representing a first layer of characteristic diagram of the ith sample after the ith sample passes through the deep learning model, wherein w, h and c respectively represent the width, the height and the channel number. The expression of the memory cell is as follows:
wherein P represents global averaging pooling, stretching any size of input into a 1-dimensional vector, N represents the total number of normal samples, and the number of levels used herein is 4, l ε {1,2,3,4} corresponds to four different downsampled scale feature levels in classical residual network ResNet.
Let it be assumed that the i-th normal sample in memory cell M has a layer of IThe stage is characterized byThe l-level features of the sample to be tested are denoted as f l Then the initial anomaly score of layer I->Can be represented by the following formula:
wherein ,the physical meaning of (a) is the minimum Euclidean distance between a test sample feature and a corresponding feature in a memory cell. However, the normal data itself has specific sample characteristics relative to outliers, and only the memory characteristics closest to the normal data are taken as the judgment basis, so that the abnormality of the test sample itself is difficult to prove. Therefore, the invention comprehensively considers a plurality of adjacent features and designs an abnormal score correction module to improve the confidence of the abnormal score. The anomaly score correction factor can be expressed as:
wherein Nk Representing k nearest neighbor search, selecting test feature f l The nearest k neighbors memorize the features. The final anomaly score s can be expressed as:
and when the anomaly score exceeds a certain threshold value, judging that the sample is abnormal, namely that the textile image has small-scale surface defects.
The above is a preferred embodiment of the present invention, and all changes made according to the technical solution of the present invention belong to the protection scope of the present invention when the generated functional effects do not exceed the scope of the technical solution of the present invention.
Claims (3)
1. A textile defect identification method integrating cross-domain migration and anomaly detection is characterized by comprising the following steps:
step 1, preprocessing the fabric image data
The method comprises the steps of collecting a fabric image through a machine to serve as an original data set, processing initial data in the original data set, selecting a fixed pattern to serve as a source domain, and integrating other patterns to serve as a target domain;
step 2, establishing a fabric data image library
Dividing an image set into a normal image, a large-scale morphological defect image and a small-scale surface defect image, marking partial data in the morphological defect image, and reserving marking information;
step 3, identifying morphological defects of the fabric
Aiming at the large-scale morphological defects in the fabric, an improved semi-supervised cross-domain neural network SSDANN is provided, and consists of a feature extractor, a label predictor and a domain discriminator; the feature extractor realizes mapping between different styles of data through a source domain and a target domain with a mark; the domain discriminator realizes the migration of data from the source domain to the target domain in an unsupervised learning mode;
in the SSDANN training process, respectively inputting source domain data and target domain data into a feature extractor to extract depth features of the fabric, and subsequently sending feature information into two branches of a label predictor G and a domain discriminator D; performing supervised learning on the source domain data, and optimizing a label predictor; the source domain data and the unlabeled target domain data are input to a domain discriminator to perform unsupervised learning, and feature information between the source domain and the target domain is confused;
step 4, detecting surface defects of the fabric
Aiming at small-scale surface defects in fabrics, an anomaly detection method without the participation of defect data in training is provided: firstly, aiming at the field difference problem of the general field and the textile field, a knowledge distillation technology is adopted to improve the expression capability of a depth model to the textile image characteristics; secondly, designing a multi-level feature extraction method, constructing a normal data feature memory unit, and generating and storing multi-level implicit features of a normal fabric sample; finally, a multi-level feature matching mechanism based on a memory unit is provided, the abnormal score of the sample to be tested is calculated through a nearest neighbor search algorithm, and the fabric state is judged.
2. The textile defect identification method integrating cross-domain migration and anomaly detection according to claim 1, wherein the SSDANN specifically comprises the following steps:
the feature extractor consists of a plurality of convolution and pooling layers and is used for mapping data to a specific feature space so as to realize the distinction of the label predictor on the fabric category and the confusion of the domain discriminator on whether the fabric comes from a source domain or a target domain; the output of the sigma is taken as an activation function in the sigma:
G f (x;W,b)=sigm(Wx+b) (1)
wherein x is a source domain sample and a target domain sample, W is a weight factor, and b is a bias term; the marked data of the source domain is sent to a feature extractor, and then the output part is sent to a label predictor; the label predictor classifies the source domain data and classifies correct labels as far as possible; the output of the tag predictor is a Softmax activation function, which will x s Viewed as an example of a source domain, y s Considered as x s The output of the corresponding tag, tag predictor, is expressed as:
G p (G f (x s );Z,k)=softmax(ZG f (x s )+k) (2)
in the formula ,Gf (x s ) Representing the input of the tag predictor and the output of the feature extractor, wherein Z is a weight factor and k is a bias term; the loss function is expressed as:
in the formula ,Gp (G f (x s ) For label predictionOutput of the device, y s For source domain sample x s A corresponding tag; the feature extractor and the tag classifier form a feedforward neural network; for a fixed pattern of source domain fabrics, there is an optimized objective function as follows:
where n represents the number of source domain samples,representing the label prediction loss of the ith sample, lambda representing a regularization term parameter, R (W, b) representing a regularization means, acting to prevent the label prediction network from overfitting;
the domain classifier is used for performing domain discrimination on the whole input data, judging whether the data come from a source domain or a target domain, which is an unsupervised learning process, at this stage, only unmarked source domain data and target domain data are input to the feature extractor, after processing, the domain classifier is input to perform domain discrimination, and the domain classifier adopts a sigmoid activation function, and the output of the sigmoid activation function is expressed as:
G d (G f (x m );O,p)=sigm(O T G f (x m )+p) (5)
in the formula ,xm The integrated data of the source domain and the target domain are represented, and O and p respectively represent weight and bias items; the domain classifier takes the binary cross entropy as a loss function, the output of which is expressed as:
in the formula ,di 0 or 1, a field tag representing the i-th sample;
to simplify the training process, a gradient inversion layer GRL is introduced between the feature extractor and the domain classifier; in forward propagation, GRL is considered as an identity transformation, and in reverse propagation, gradient inversion is achieved, multiplied by a- α and transferred to the previous layer; the forward and backward propagation of the gradient inversion layer is expressed as follows:
wherein I is an identity matrix; during the back propagation, the gradient of domain classification loss is automatically inverted before back propagating to the parameters of the feature extractor, achieving a GAN-like contrast loss; the objective optimization function of the domain discriminator is:
the marked target domain data (x pt ,y pt ) The input to the feature extractor extracts the features, and the output is as follows:
G f (x pt ;W,b)=ReLU(Wx pt +b) (9)
the output of the feature extractor is input to the tag predictor, and the output result is:
G p (G f (x pt );O,p)=softmax(OG f (x pt )+p) (10)
tag classification loss of the tagged target domain data is:
the calculation mode of the target domain data loss function with the label is the same as that of the formula (3), the network adopts a gradient descent method to carry out counter propagation, and the iterative update of network parameters is realized;
in the test phase, the target domain test data x tt Inputting the data into the SSDANN for testing, sequentially passing through the feature extractor and the tag predictor, and finally classifying in the tag predictor, wherein the obtained output is shown as follows:
y t =G p (G f (x tt );O,p)=softmax(OG f (x tt )+p)(12)
in the formula ,yt Representing a one-dimensional vector, each element value representing the probability of a fabric defect class, with the index of the maximum value therein as the final output, i.e., the label of the corresponding class.
3. The textile defect identification method for fusion cross-domain migration and anomaly detection according to claim 1, wherein the anomaly detection method without participation of defect data in training constructs a multi-level feature matching network based on small-scale surface defects, and the method comprises two CNN models with the same structure, wherein training samples are normal fabric images; the public domain model is used as a teacher T and is responsible for teaching knowledge, and the network weight parameters of the model are fixed; the fabric field model is used as a student S to absorb and learn knowledge, and the network weight parameters are updated according to the loss values in the training process; assume that and />Respectively representing a first layer of feature graphs output by a training sample I through a teacher T and a student S, wherein the total loss function of training is expressed by the following formula:
wherein vec (x) represents that vectorization operation is carried out on the feature map, the feature matrix is converted into a 1-dimensional feature vector, and a student model is updated by a random gradient descent algorithm in the training process;
in the training stage, taking a normal fabric image as input, extracting each layer of implicit feature map of the multi-level feature matching network, and constructing a multi-level feature memory unit based on normal data; in the test stage, extracting each layer of implicit feature map of a multi-level feature matching network of a test sample aiming at a certain test sample, carrying out multi-level feature matching with a multi-level feature memory unit based on normal data, calculating the abnormal score of the current sample, and judging that the fabric has surface defects if the score exceeds a preset threshold value;
suppose phi l (I i )∈R (w×h×c) Representing a first layer characteristic diagram of an ith sample after the ith sample passes through a multi-layer characteristic matching network, wherein w, h and c respectively represent width, height and channel number; the expression of the multi-level feature memory cell based on normal data is as follows:
wherein P represents global averaging pooling, and stretching the input with any size into a 1-dimensional vector, N represents the total number of normal samples, and l epsilon {1,2,3,4} corresponds to four different downsampled scale feature levels in the classical residual network ResNet.
Assume that the l-level feature of the ith normal sample in the normal data-based multi-level feature memory cell M isThe l-level features of the sample to be tested are denoted as f l Then the initial anomaly score of layer I->Represented by the formula:
wherein ,the physical meaning of the test sample feature is the minimum Euclidean distance between the test sample feature and the corresponding feature in the multi-level feature memory unit based on normal data; comprehensively consider moreThe neighbor features are provided with an anomaly score correction module to improve the confidence of anomaly scores; the anomaly score correction factor is expressed as:
wherein Nk Representing k nearest neighbor search, selecting test feature f l Nearest k neighbor memory features; the final anomaly score s is expressed as:
and when the anomaly score exceeds a preset threshold value, judging that the sample is abnormal, namely that the textile image has small-scale surface defects.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211679870.7A CN116051479A (en) | 2022-12-26 | 2022-12-26 | Textile defect identification method integrating cross-domain migration and anomaly detection |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211679870.7A CN116051479A (en) | 2022-12-26 | 2022-12-26 | Textile defect identification method integrating cross-domain migration and anomaly detection |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116051479A true CN116051479A (en) | 2023-05-02 |
Family
ID=86119224
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211679870.7A Pending CN116051479A (en) | 2022-12-26 | 2022-12-26 | Textile defect identification method integrating cross-domain migration and anomaly detection |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116051479A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116777896A (en) * | 2023-07-07 | 2023-09-19 | 浙江大学 | Negative migration inhibition method for cross-domain classification and identification of apparent defects |
CN116862903A (en) * | 2023-07-31 | 2023-10-10 | 梅卡曼德(北京)机器人科技有限公司 | Defect detection model training method and device, defect detection method and electronic equipment |
CN117372424A (en) * | 2023-12-05 | 2024-01-09 | 成都数之联科技股份有限公司 | Defect detection method, device, equipment and storage medium |
CN118155046A (en) * | 2024-05-09 | 2024-06-07 | 东北大学 | Neural architecture acceleration search method for image classification |
-
2022
- 2022-12-26 CN CN202211679870.7A patent/CN116051479A/en active Pending
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116777896A (en) * | 2023-07-07 | 2023-09-19 | 浙江大学 | Negative migration inhibition method for cross-domain classification and identification of apparent defects |
CN116777896B (en) * | 2023-07-07 | 2024-03-19 | 浙江大学 | Negative migration inhibition method for cross-domain classification and identification of apparent defects |
CN116862903A (en) * | 2023-07-31 | 2023-10-10 | 梅卡曼德(北京)机器人科技有限公司 | Defect detection model training method and device, defect detection method and electronic equipment |
CN116862903B (en) * | 2023-07-31 | 2024-06-25 | 梅卡曼德(北京)机器人科技有限公司 | Defect detection model training method and device, defect detection method and electronic equipment |
CN117372424A (en) * | 2023-12-05 | 2024-01-09 | 成都数之联科技股份有限公司 | Defect detection method, device, equipment and storage medium |
CN117372424B (en) * | 2023-12-05 | 2024-03-08 | 成都数之联科技股份有限公司 | Defect detection method, device, equipment and storage medium |
CN118155046A (en) * | 2024-05-09 | 2024-06-07 | 东北大学 | Neural architecture acceleration search method for image classification |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111967294B (en) | Unsupervised domain self-adaptive pedestrian re-identification method | |
CN116051479A (en) | Textile defect identification method integrating cross-domain migration and anomaly detection | |
Wang et al. | Learning fine-grained features via a CNN tree for large-scale classification | |
Xu et al. | A weakly supervised surface defect detection based on convolutional neural network | |
CN106778832B (en) | The semi-supervised Ensemble classifier method of high dimensional data based on multiple-objection optimization | |
CN109543693B (en) | Weak labeling data noise reduction method based on regularization label propagation | |
CN114723994B (en) | Hyperspectral image classification method based on dual classifier antagonism enhancement network | |
Zhan et al. | Fabric defect classification using prototypical network of few-shot learning algorithm | |
CN107220663B (en) | Automatic image annotation method based on semantic scene classification | |
CN112766170B (en) | Self-adaptive segmentation detection method and device based on cluster unmanned aerial vehicle image | |
CN114863091A (en) | Target detection training method based on pseudo label | |
CN114255371A (en) | Small sample image classification method based on component supervision network | |
CN117152503A (en) | Remote sensing image cross-domain small sample classification method based on false tag uncertainty perception | |
CN113283282A (en) | Weak supervision time sequence action detection method based on time domain semantic features | |
CN110717602B (en) | Noise data-based machine learning model robustness assessment method | |
Aljundi et al. | Continual novelty detection | |
Ghanmi et al. | Table detection in handwritten chemistry documents using conditional random fields | |
Gao et al. | An improved XGBoost based on weighted column subsampling for object classification | |
CN114078106A (en) | Defect detection method based on improved Faster R-CNN | |
CN116304941A (en) | Ocean data quality control method and device based on multi-model combination | |
CN116681961A (en) | Weak supervision target detection method based on semi-supervision method and noise processing | |
Din et al. | A reliable adaptive prototype-based learning for evolving data streams with limited labels | |
CN116665039A (en) | Small sample target identification method based on two-stage causal intervention | |
CN113158878B (en) | Heterogeneous migration fault diagnosis method, system and model based on subspace | |
Hao et al. | A Model-Agnostic approach for learning with noisy labels of arbitrary distributions |
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 |