CN118014941A - Fabric image unsupervised defect detection method and device - Google Patents

Fabric image unsupervised defect detection method and device Download PDF

Info

Publication number
CN118014941A
CN118014941A CN202410114770.2A CN202410114770A CN118014941A CN 118014941 A CN118014941 A CN 118014941A CN 202410114770 A CN202410114770 A CN 202410114770A CN 118014941 A CN118014941 A CN 118014941A
Authority
CN
China
Prior art keywords
image
features
abnormal
fabric
local
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410114770.2A
Other languages
Chinese (zh)
Inventor
陈麒宇
吕承侃
罗惠元
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Institute of Automation of Chinese Academy of Science
Original Assignee
Institute of Automation of Chinese Academy of Science
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Institute of Automation of Chinese Academy of Science filed Critical Institute of Automation of Chinese Academy of Science
Priority to CN202410114770.2A priority Critical patent/CN118014941A/en
Publication of CN118014941A publication Critical patent/CN118014941A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/42Global feature extraction by analysis of the whole pattern, e.g. using frequency domain transformations or autocorrelation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30124Fabrics; Textile; Paper
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Quality & Reliability (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides a method and a device for detecting an unsupervised defect of a fabric image, wherein the method comprises the following steps: extracting features from an image sample of a normal fabric by using a feature extractor to serve as normal features, and performing global abnormal synthesis on the normal features to obtain global abnormal features; carrying out local anomaly synthesis on the image sample to obtain a local anomaly image, and extracting features from the local anomaly image by using the feature extractor to serve as local anomaly features; training a discriminator based on the global abnormal features and the local abnormal features, extracting features from the fabric image to be detected by using the feature extractor, and inputting the features of the fabric image to be detected into the trained discriminator to obtain a defect detection result output by the discriminator. The invention can effectively detect unknown defects and weak defects in the fabric without manual marking, and improves the accuracy and efficiency of fabric defect detection.

Description

Fabric image unsupervised defect detection method and device
Technical Field
The invention relates to the technical field of image processing, in particular to an unsupervised defect detection method and device for a fabric image.
Background
Fabric defects are mainly caused by machine failure, poor processing, and excessive stretching, and are often very weak and difficult to distinguish. At present, the defects of the appearance quality of the fabric depend on human eye detection for a long time, and the improvement of the quality and the production efficiency of the textile manufacturing industry is limited.
The existing defect detection method based on deep learning mostly adopts a supervised learning scheme to detect defects. According to the scheme, a large number of marked defect samples are collected in advance to construct a training set, and then a model is trained to perform visual tasks such as target detection or image segmentation. In addition, marking of defective samples can also significantly increase production costs and the time of early preparation.
The unsupervised defect detection aims to realize detection of a defect sample and positioning of a defect area by using a normal sample, and is widely applied to scenes with low defect occurrence frequency and difficult data collection. The existing unsupervised defect detection methods can be roughly divided into two types, one is to directly use a normal sample to store or model a normal mode, such as a method based on image reconstruction and a method based on feature embedding, and compare a test sample with the stored or modeled normal mode so as to detect an abnormality; a method based on abnormal data synthesis expands the diversity of data space expression on the basis of normal samples, effectively prevents the possibility of overfitting by using only normal samples, and converts unsupervised into a supervised paradigm for abnormality detection and positioning.
In the prior art, the synthesis of anomalies in the image space is usually insufficient in diversity of the synthesis of anomaly data, and weak defects in the fabric image cannot be accurately detected.
Disclosure of Invention
The invention provides an unsupervised defect detection method and device for a fabric image, which are used for solving the problems that the diversity of abnormal data synthesis in the prior art is insufficient and weak defects in the fabric image cannot be accurately detected, and realizing more comprehensive and comprehensive simulation of abnormal fabric distribution.
The invention provides a fabric image unsupervised defect detection method, which comprises the following steps:
Extracting features from an image sample of a normal fabric by using a feature extractor to serve as normal features, and performing global abnormal synthesis on the normal features to obtain global abnormal features;
carrying out local anomaly synthesis on the image sample to obtain a local anomaly image, and extracting features from the local anomaly image by using the feature extractor to serve as local anomaly features;
Training a discriminator based on the global abnormal features and the local abnormal features, extracting features from the fabric image to be detected by using the feature extractor, and inputting the features of the fabric image to be detected into the trained discriminator to obtain a defect detection result output by the discriminator.
According to the method for detecting the unsupervised defect of the fabric image, which is provided by the invention, the global abnormal feature is obtained by performing global abnormal synthesis on the normal feature, and the method comprises the following steps:
adding Gaussian noise to the normal features;
Determining gradient rising information of each pixel in the normal characteristic added with the Gaussian noise, and superposing the gradient rising information of each pixel on each pixel;
And taking the characteristic added with the gradient rising information as a global abnormal characteristic.
According to the method for detecting the unsupervised defect of the fabric image, the gradient rising information of each pixel is superimposed on each pixel, and the method comprises the following steps:
Generating vectors according to gradient rising information on all channels corresponding to each pixel;
Determining an L2 norm of the vector, and determining a first preset threshold and a second preset threshold according to the L2 norm, wherein the first preset threshold is smaller than the second preset threshold;
Limiting the gradient rise information of each pixel between the first preset threshold value and the second preset threshold value;
and superposing the gradient rising information of each pixel after limitation on each pixel.
According to the method for detecting the unsupervised defect of the fabric image, the gradient rising information of each pixel is limited between the first preset threshold value and the second preset threshold value, and the method comprises the following steps:
Taking the first preset threshold value as gradient rising information of each pixel under the condition that the gradient rising information of each pixel is smaller than the first preset threshold value;
and taking the second preset threshold value as gradient rising information of each pixel under the condition that the gradient rising information of each pixel is larger than the second preset threshold value.
According to the method for detecting the unsupervised defect of the fabric image, which is provided by the invention, the local abnormal synthesis is carried out on the image sample to obtain a local abnormal image, and the method comprises the following steps:
generating two binary masks by using two-dimensional Berlin noise, and determining an intersection set and a union set between the two binary masks;
determining an intersection between one or more of the intersection, the union and the two binarization masks and a foreground mask of the image sample as an anomaly mask, and adding the anomaly mask to the image sample to obtain the local anomaly image;
adding an external texture image to the image sample to obtain the local abnormal image;
And superposing the local abnormal image and the image sample by using a preset transparency coefficient to obtain the local abnormal image.
According to the method for detecting the unsupervised defect of the fabric image, which is provided by the invention, the training of the discriminator based on the global abnormal feature and the local abnormal feature comprises the following steps:
Training the discriminator based on the binary cross entropy loss of the normal feature, the binary cross entropy loss of the global abnormal feature, and the focus loss of the local abnormal feature.
According to the method for detecting the unsupervised defect of the fabric image, the feature extractor is used for extracting the feature from the image sample of the normal fabric as the normal feature, and the method comprises the following steps:
extracting multi-level features from the image samples based on a backbone network;
taking the average value of the neighborhood of each pixel in at least one level of the feature as the value of each pixel;
And splicing all the processed characteristics to obtain the normal characteristics.
The invention also provides a device for detecting the non-supervision defects of the fabric image, which comprises the following steps:
Extracting features from an image sample of a normal fabric by using a feature extractor to serve as normal features, and performing global abnormal synthesis on the normal features to obtain global abnormal features;
carrying out local anomaly synthesis on the image sample to obtain a local anomaly image, and extracting features from the local anomaly image by using the feature extractor to serve as local anomaly features;
Training a discriminator based on the global abnormal features and the local abnormal features, extracting features from the fabric image to be detected by using the feature extractor, and inputting the features of the fabric image to be detected into the trained discriminator to obtain a defect detection result output by the discriminator.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method for detecting the fabric image unsupervised defect according to any one of the above when executing the program.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of unsupervised defect detection of a fabric image as described in any of the above.
The invention also provides a computer program product comprising a computer program which when executed by a processor implements a method of unsupervised defect detection of a fabric image as described in any one of the above.
According to the method and the device for detecting the fabric image unsupervised defects, disclosed by the invention, the overall abnormal characteristic synthesis strategy of the characteristic space is combined with the local abnormal characteristic synthesis strategy of the image space, and the abnormal data is synthesized to train the discriminator, so that the more comprehensive and comprehensive simulated abnormal distribution is automatically obtained, the unknown defects and weak defects in the fabric can be effectively detected, manual labeling is not needed, and the accuracy and the efficiency of fabric defect detection are improved.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of an unsupervised defect detection method for fabric image according to the present invention;
FIG. 2 is a second flow chart of the method for detecting unsupervised defects of fabric images according to the present invention;
FIG. 3 is a schematic flow chart of global abnormal feature synthesis in the method for detecting the unsupervised defects of the fabric image;
FIG. 4 is a schematic flow chart of a partial image anomaly synthesis strategy in the fabric image unsupervised defect detection method provided by the present invention;
FIG. 5 is a schematic diagram of a process flow of a feature extractor in the method for detecting an unsupervised defect of a fabric image according to the present invention;
FIG. 6 is a schematic diagram of a fabric image unsupervised defect detection apparatus according to the present invention;
Fig. 7 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The following describes a fabric image unsupervised defect detection method according to the present invention with reference to fig. 1, which includes:
step 101, extracting features from an image sample of a normal fabric by using a feature extractor as normal features, and performing global abnormal synthesis on the normal features to obtain global abnormal features;
The features extracted from the image samples of the normal fabric by the feature extractor are the image features of the normal fabric, and are taken as the normal features. The present embodiment is not limited in the kind of feature extractor.
The normal features extracted by the feature extractor may be adapted by the feature adapter to eliminate domain bias caused by the pre-trained feature extractor.
And obtaining global abnormal characteristics for the global synthetic defect sample of the normal characteristics at the characteristic level. Feature space is a high-dimensional representation of image space in which synthesizing anomalies tends to be more efficient. Feature space based anomaly synthesis can be considered to be construction anomalies in an approximately global dimension, with poor synthesis capability for weak defects that approach normal features. The method of global exception synthesis is not limited in this embodiment.
102, Carrying out local anomaly synthesis on the image sample to obtain a local anomaly image, and extracting features from the local anomaly image by using the feature extractor to serve as local anomaly features;
And locally synthesizing the defect sample at the image level for the image sample, thereby introducing anomaly discrimination information and obtaining a local anomaly image. Based generally on the assumption that: the defects are mostly distributed in local areas instead of global areas, so that the distribution situation of a real sample can be effectively simulated by constructing anomalies in the local areas. The image level anomaly synthesis is directly effective and because of the introduction of rich local structuring information, the arbiter is more sensitive to obvious structuring defects. An image is a low-dimensional space in which the synthesized anomalies tend to be very sparse samples and cannot be completely traversed.
The feature extracted from the local abnormal image by the feature extractor is the local image feature of the abnormal fabric, and is taken as the local abnormal feature.
The local anomaly characteristics extracted by the feature extractor can be adapted by a feature adapter to eliminate domain bias caused by the pre-trained feature extractor.
And step 103, training a discriminator based on the global abnormal features and the local abnormal features, extracting features from the fabric image to be detected by using the feature extractor, and inputting the features of the fabric image to be detected into the trained discriminator to obtain a defect detection result output by the discriminator.
And introducing anomaly discrimination information, namely determining an actual anomaly region in the image sample, while obtaining the global anomaly characteristic and the local anomaly characteristic through anomaly synthesis.
And respectively inputting the global abnormal characteristic and the local abnormal characteristic into a discriminator to obtain a predicted abnormal region in the image sample output by the discriminator. And comparing the predicted abnormal region with the actual abnormal region, and adjusting parameters of the discriminator according to the comparison result so that the predicted abnormal region approaches the actual abnormal region.
In addition, the normal characteristics after the characteristic adapter is adapted can be input into the discriminator to obtain a predicted abnormal region in the image sample output by the discriminator, and parameters of the discriminator are adjusted to enable the predicted abnormal region to be empty.
The complete flow of the unsupervised defect detection of the fabric image is shown in fig. 2, and comprises three branches, namely a normal characteristic branch, a global abnormal characteristic synthesis branch and a local abnormal characteristic synthesis branch. These three branches share three models, namely a feature extractor, a feature adapter and a arbiter. And taking three groups of features obtained by the three branches as input of a discriminator, and directly outputting abnormal confidence for each feature point by the discriminator.
In the deducing stage, the fabric image to be detected is extracted with the feature extractor, the unbiased feature is obtained with the feature adapter, and finally the defect detection result is given out with the discriminator.
To obtain a pixel level detection result, the output of the arbiter is up-sampled and interpolated to the original image size, and gaussian smoothing is applied to reduce noise. The detection result of the image level can be obtained from the maximum value among the abnormal confidence levels of all the feature points output by the discriminator.
According to the embodiment, the overall abnormal feature synthesis strategy of the feature space and the local abnormal feature synthesis strategy of the image space are combined to synthesize the abnormal data training discriminator, so that more comprehensive and comprehensive simulated abnormal distribution is automatically obtained, unknown defects and weak defects in the fabric can be effectively detected, manual labeling is not needed, and accuracy and efficiency of fabric defect detection are improved.
On the basis of the foregoing embodiment, in this embodiment, performing global abnormal synthesis on the normal feature to obtain a global abnormal feature includes:
adding Gaussian noise to the normal features;
Determining gradient rising information of each pixel in the normal characteristic added with the Gaussian noise, and superposing the gradient rising information of each pixel on each pixel;
And taking the characteristic added with the gradient rising information as a global abnormal characteristic.
In order to more efficiently synthesize anomalies in the feature space, global gaussian noise is added at the feature level in the synthesis strategy of global anomaly features, and the anomaly direction is limited to be the gradient rising direction, and the specific flow is shown in fig. 3.
The distribution of defects in real scenes is variable and unknown, but some approximate distribution can be used to simulate anomalies. Therefore, global Gaussian noise is introduced into the characteristic layer, and the obtained Gaussian noise abnormal points simulate the abnormal states along the unknown direction.
The most effective way to perform the abnormal synthesis in the feature space of the fabric image is to synthesize the sample along the direction of gradient rise, not along the various directions. Therefore, the embodiment further superimposes gradient rising information guided by loss on the basis of Gaussian noise, and constrains the abnormal synthesis direction through the gradient rising information, so that global abnormal feature synthesis has better target guidance and is easier to detect weak defects of the fabric.
On the basis of the above embodiment, the superimposing the gradient-increasing information of each pixel on each pixel in this embodiment includes:
Generating vectors according to gradient rising information on all channels corresponding to each pixel;
Determining an L2 norm of the vector, and determining a first preset threshold and a second preset threshold according to the L2 norm, wherein the first preset threshold is smaller than the second preset threshold;
Limiting the gradient rise information of each pixel between the first preset threshold value and the second preset threshold value;
and superposing the gradient rising information of each pixel after limitation on each pixel.
In order to avoid the situation that the training of the discriminator cannot be converged due to overlarge gradient rise or serious abnormal fluctuation is caused by gradient rise, the gradient rise range is limited by adopting a truncated projection mode, so that weak abnormal sample characteristics are accurately synthesized.
The distance of gradient rise guided by gaussian noise is first calculated. And forming a characteristic diagram on each channel by the normal characteristic added with the Gaussian noise, wherein pixels between the characteristic diagrams are in one-to-one correspondence. A vector is generated from gradient rise information of pixels at the same position in all feature maps, and the L2 norm of the vector is used as the gradient rise distance guided by Gaussian noise.
Then, the gradient-rising distance is cut off. The set proportion of the L2 norm may be used as the first preset threshold and the second preset threshold. For example, 20% of the L2 norm is used as a first preset threshold, and 50% of the L2 norm is used as a second preset threshold. The gradient-rise information of each pixel in each feature map may be normalized to be limited between a first preset threshold and a second preset threshold.
According to the embodiment, the gradient rising distance is cut off, so that the synthesized abnormality cannot deviate from the normal feature too far or too close, the processed global abnormal feature can simulate weak defects more accurately, and meanwhile the risk of over fitting or under fitting of the model is avoided.
On the basis of the foregoing embodiment, the limiting the gradient-rise information of each pixel between the first preset threshold and the second preset threshold in this embodiment includes:
Taking the first preset threshold value as gradient rising information of each pixel under the condition that the gradient rising information of each pixel is smaller than the first preset threshold value;
and taking the second preset threshold value as gradient rising information of each pixel under the condition that the gradient rising information of each pixel is larger than the second preset threshold value.
In this embodiment, gradient rising information smaller than a first preset threshold is limited to the first preset threshold, gradient rising information larger than a second preset threshold is limited to the second preset threshold, and the distance of gradient rising is truncated to ensure that the synthesized anomaly does not deviate from the normal feature too far or too close, so that the processed global anomaly feature can simulate weak defects more accurately, and the risk of over-fitting or under-fitting of the model is avoided.
On the basis of the foregoing embodiments, in this embodiment, performing local anomaly synthesis on the image sample to obtain a local anomaly image includes:
generating two binary masks by using two-dimensional Berlin noise, and determining an intersection set and a union set between the two binary masks;
determining an intersection between one or more of the intersection, the union and the two binarization masks and a foreground mask of the image sample as an anomaly mask, and adding the anomaly mask to the image sample to obtain the local anomaly image;
adding an external texture image to the image sample to obtain the local abnormal image;
And superposing the local abnormal image and the image sample by using a preset transparency coefficient to obtain the local abnormal image.
Defects are generally distributed in local areas, and local synthesis anomalies in images can provide rich structural information. The present embodiment thus obtains a local anomaly image using a local anomaly synthesis strategy based on Berlin noise at the image level.
As shown in fig. 4, the present embodiment improves the conventional image level local anomaly synthesis method, and the adopted local image anomaly synthesis strategy includes three steps, and generates an anomaly morphology, an anomaly texture and a normal anomaly superposition fusion.
In the step of generating the abnormal shape, two binary masks are generated by adopting two-dimensional Berlin noise, and the abnormal masks are constructed by taking the intersection set and the union set of the two binary masks and taking different combination modes of one of the two binary masks.
In the step of generating an abnormal texture, after obtaining an abnormal form of the image sample, a texture image is introduced from an external data set, and the abnormal texture is obtained by using a plurality of random enhancement modes.
In the normal anomaly overlaying fusion step, in order to simulate weak defects and cover more possible real defects, the proportion of normal images in the anomaly region is adjusted by using transparency coefficients meeting Gaussian distribution in the overlaying fusion step.
The embodiment improves the accuracy and efficiency of detecting the defects of the fabric image by improving the local anomaly synthesis method at the image level.
On the basis of the foregoing embodiments, the training the arbiter based on the global abnormal feature and the local abnormal feature in this embodiment includes:
Training the discriminator based on the binary cross entropy loss of the normal feature, the binary cross entropy loss of the global abnormal feature, and the focus loss of the local abnormal feature.
In the embodiment, the binary cross entropy loss of the normal feature, the binary cross entropy loss of the global abnormal feature and the focus loss of the local abnormal feature are used as target functions for training the discriminator, and parameters of the discriminator are adjusted so that the values of the three-item target function are minimum. To better address the problem of unbalanced classification in the local image anomaly synthesis strategy, an online difficult-to-case mining strategy may be applied in the third term of loss.
On the basis of the above embodiments, the extracting, by the feature extractor, features from the image samples of the normal fabric as normal features in the present embodiment includes:
extracting multi-level features from the image samples based on a backbone network;
taking the average value of the neighborhood of each pixel in at least one level of the feature as the value of each pixel;
And splicing all the processed characteristics to obtain the normal characteristics.
As shown in fig. 5, features of different levels are extracted from the image sample by a feature extractor. The image samples may be input into a pre-trained backbone network in a feature extractor to extract multi-level features, from which normal features may be derived based on all or selected levels of features extracted.
Neighborhood information is embedded into each level of features through average neighborhood aggregation, specifically, an average value of neighborhood pixel values of each pixel in each level of features is used as the value of each pixel.
And splicing the processed multi-stage features, and superposing the multi-stage features along the channel dimension to obtain normal features.
For example, the backbone network extracts level 5 features from which level 2 and level 3 features are selected for average neighborhood aggregation. And the number of channels of the 2 nd-stage features is 30, and the number of channels of the third-stage features is 30, and after the processed 2 nd-stage and 3 rd-stage features are spliced, the normal features with the number of channels of 60 are obtained.
According to the embodiment, the characteristics of different levels are extracted from the image sample through the characteristic extractor to perform average neighborhood aggregation and embedding neighborhood information, and the processed multi-level characteristics are spliced along the channel dimension, so that rich normal characteristics are obtained, and the accuracy of fabric image defect detection is improved.
The fabric image unsupervised defect detection device provided by the invention is described below, and the fabric image unsupervised defect detection device described below and the fabric image unsupervised defect detection method described above can be correspondingly referred to each other.
As shown in fig. 6, the apparatus includes a first synthesis module 601, a second synthesis module 602, and a detection module 603, where:
the first synthesis module 601 is configured to extract a feature from an image sample of a normal fabric by using a feature extractor as a normal feature, and perform global abnormal synthesis on the normal feature to obtain a global abnormal feature;
the second synthesis module 602 is configured to perform local anomaly synthesis on the image sample to obtain a local anomaly image, and extract a feature from the local anomaly image by using the feature extractor as a local anomaly feature;
The detection module 603 is configured to train a discriminator based on the global abnormal feature and the local abnormal feature, extract a feature from a fabric image to be detected by using the feature extractor, and input the feature of the fabric image to be detected into the trained discriminator to obtain a defect detection result output by the discriminator.
According to the embodiment, the overall abnormal feature synthesis strategy of the feature space and the local abnormal feature synthesis strategy of the image space are combined to synthesize the abnormal data training discriminator, so that more comprehensive and comprehensive simulated abnormal distribution is automatically obtained, unknown defects and weak defects in the fabric can be effectively detected, manual labeling is not needed, and accuracy and efficiency of fabric defect detection are improved.
Fig. 7 illustrates a physical schematic diagram of an electronic device, as shown in fig. 7, which may include: processor 710, communication interface (Communications Interface) 720, memory 730, and communication bus 740, wherein processor 710, communication interface 720, memory 730 communicate with each other via communication bus 740. Processor 710 may invoke logic instructions in memory 730 to perform a fabric image unsupervised defect detection method comprising: extracting features from an image sample of a normal fabric by using a feature extractor to serve as normal features, and performing global abnormal synthesis on the normal features to obtain global abnormal features; carrying out local anomaly synthesis on the image sample to obtain a local anomaly image, and extracting features from the local anomaly image by using the feature extractor to serve as local anomaly features; training a discriminator based on the global abnormal features and the local abnormal features, extracting features from the fabric image to be detected by using the feature extractor, and inputting the features of the fabric image to be detected into the trained discriminator to obtain a defect detection result output by the discriminator.
Further, the logic instructions in the memory 730 described above may be implemented in the form of software functional units and may be stored in a computer readable storage medium when sold or utilized as a stand alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, the computer program product comprising a computer program, the computer program being storable on a non-transitory computer readable storage medium, the computer program, when executed by a processor, being capable of performing the method for unsupervised defect detection of fabric images provided by the above methods, the method comprising: extracting features from an image sample of a normal fabric by using a feature extractor to serve as normal features, and performing global abnormal synthesis on the normal features to obtain global abnormal features; carrying out local anomaly synthesis on the image sample to obtain a local anomaly image, and extracting features from the local anomaly image by using the feature extractor to serve as local anomaly features; training a discriminator based on the global abnormal features and the local abnormal features, extracting features from the fabric image to be detected by using the feature extractor, and inputting the features of the fabric image to be detected into the trained discriminator to obtain a defect detection result output by the discriminator.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the method for unsupervised defect detection of a fabric image provided by the above methods, the method comprising: extracting features from an image sample of a normal fabric by using a feature extractor to serve as normal features, and performing global abnormal synthesis on the normal features to obtain global abnormal features; carrying out local anomaly synthesis on the image sample to obtain a local anomaly image, and extracting features from the local anomaly image by using the feature extractor to serve as local anomaly features; training a discriminator based on the global abnormal features and the local abnormal features, extracting features from the fabric image to be detected by using the feature extractor, and inputting the features of the fabric image to be detected into the trained discriminator to obtain a defect detection result output by the discriminator.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. An unsupervised defect detection method for a fabric image, comprising:
Extracting features from an image sample of a normal fabric by using a feature extractor to serve as normal features, and performing global abnormal synthesis on the normal features to obtain global abnormal features;
carrying out local anomaly synthesis on the image sample to obtain a local anomaly image, and extracting features from the local anomaly image by using the feature extractor to serve as local anomaly features;
Training a discriminator based on the global abnormal features and the local abnormal features, extracting features from the fabric image to be detected by using the feature extractor, and inputting the features of the fabric image to be detected into the trained discriminator to obtain a defect detection result output by the discriminator.
2. The method for detecting an unsupervised defect of a fabric image according to claim 1, wherein the performing global abnormal synthesis on the normal features to obtain global abnormal features comprises:
adding Gaussian noise to the normal features;
Determining gradient rising information of each pixel in the normal characteristic added with the Gaussian noise, and superposing the gradient rising information of each pixel on each pixel;
And taking the characteristic added with the gradient rising information as a global abnormal characteristic.
3. The method of claim 2, wherein superimposing the gradient-increasing information of each pixel onto each pixel comprises:
Generating vectors according to gradient rising information on all channels corresponding to each pixel;
Determining an L2 norm of the vector, and determining a first preset threshold and a second preset threshold according to the L2 norm, wherein the first preset threshold is smaller than the second preset threshold;
Limiting the gradient rise information of each pixel between the first preset threshold value and the second preset threshold value;
and superposing the gradient rising information of each pixel after limitation on each pixel.
4. A fabric image unsupervised defect detection method according to claim 3, wherein said limiting the gradient-rise information of each pixel between the first preset threshold and the second preset threshold comprises:
Taking the first preset threshold value as gradient rising information of each pixel under the condition that the gradient rising information of each pixel is smaller than the first preset threshold value;
and taking the second preset threshold value as gradient rising information of each pixel under the condition that the gradient rising information of each pixel is larger than the second preset threshold value.
5. The method for detecting an unsupervised defect of a fabric image according to any one of claims 1 to 4, wherein the performing local anomaly synthesis on the image sample to obtain a local anomaly image comprises:
generating two binary masks by using two-dimensional Berlin noise, and determining an intersection set and a union set between the two binary masks;
determining an intersection between one or more of the intersection, the union and the two binarization masks and a foreground mask of the image sample as an anomaly mask, and adding the anomaly mask to the image sample to obtain the local anomaly image;
adding an external texture image to the image sample to obtain the local abnormal image;
And superposing the local abnormal image and the image sample by using a preset transparency coefficient to obtain the local abnormal image.
6. The method of any one of claims 1-4, wherein training the discriminators based on the global anomaly characteristics and the local anomaly characteristics comprises:
Training the discriminator based on the binary cross entropy loss of the normal feature, the binary cross entropy loss of the global abnormal feature, and the focus loss of the local abnormal feature.
7. The method for unsupervised defect detection of fabric image according to any one of claims 1 to 4, wherein the extracting features from the image samples of the normal fabric using the feature extractor as the normal features comprises:
extracting multi-level features from the image samples based on a backbone network;
taking the average value of the neighborhood of each pixel in at least one level of the feature as the value of each pixel;
And splicing all the processed characteristics to obtain the normal characteristics.
8. An apparatus for unsupervised defect detection of a fabric image, comprising:
the first synthesis module is used for extracting features from the image sample of the normal fabric by using the feature extractor as normal features, and carrying out global abnormal synthesis on the normal features to obtain global abnormal features;
The second synthesis module is used for carrying out local abnormal synthesis on the image sample to obtain a local abnormal image, and extracting features from the local abnormal image by using the feature extractor to serve as local abnormal features;
The detection module is used for training the discriminator based on the global abnormal characteristics and the local abnormal characteristics, extracting characteristics from the fabric image to be detected by utilizing the characteristic extractor, and inputting the characteristics of the fabric image to be detected into the trained discriminator to obtain a defect detection result output by the discriminator.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method for unsupervised defect detection of fabric images according to any one of claims 1 to 7 when executing the program.
10. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the method of unsupervised defect detection of a fabric image according to any one of claims 1 to 7.
CN202410114770.2A 2024-01-26 2024-01-26 Fabric image unsupervised defect detection method and device Pending CN118014941A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410114770.2A CN118014941A (en) 2024-01-26 2024-01-26 Fabric image unsupervised defect detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410114770.2A CN118014941A (en) 2024-01-26 2024-01-26 Fabric image unsupervised defect detection method and device

Publications (1)

Publication Number Publication Date
CN118014941A true CN118014941A (en) 2024-05-10

Family

ID=90954451

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410114770.2A Pending CN118014941A (en) 2024-01-26 2024-01-26 Fabric image unsupervised defect detection method and device

Country Status (1)

Country Link
CN (1) CN118014941A (en)

Similar Documents

Publication Publication Date Title
CN110852316B (en) Image tampering detection and positioning method adopting convolution network with dense structure
JP6330385B2 (en) Image processing apparatus, image processing method, and program
CN111798409A (en) Deep learning-based PCB defect data generation method
CN114170227B (en) Product surface defect detection method, device, equipment and storage medium
CN113706564A (en) Meibomian gland segmentation network training method and device based on multiple supervision modes
Li et al. Edge-aware regional message passing controller for image forgery localization
CN112950561A (en) Optical fiber end face defect detection method, device and storage medium
CN112330594A (en) Paper tube defect detection method and device, electronic equipment and storage medium
CN114187201A (en) Model training method, image processing method, device, equipment and storage medium
CN116310568A (en) Image anomaly identification method, device, computer readable storage medium and equipment
CN115082909B (en) Method and system for identifying lung lesions
CN111882545B (en) Fabric defect detection method based on bidirectional information transmission and feature fusion
Xing et al. Normal image guided segmentation framework for unsupervised anomaly detection
CN111414895A (en) Face recognition method and device and storage equipment
CN113989814B (en) Image generation method, device, computer equipment and storage medium
CN118014941A (en) Fabric image unsupervised defect detection method and device
CN114512052A (en) Method and device for generating branch and confluence road junction by fusing remote sensing image and track data
CN113591856A (en) Bill picture processing method and device
CN118071735B (en) Liquid leakage detection method and system
CN112652059B (en) Mesh R-CNN model-based improved target detection and three-dimensional reconstruction method
CN117474916B (en) Image detection method, electronic equipment and storage medium
CN117994173B (en) Repair network training method, image processing method, device and electronic equipment
KR102685079B1 (en) Apparatus and method for automatic target search, extraction, and recognition targets from wide-area synthetic aperture radar images
CN117079103B (en) Pseudo tag generation method and system for neural network training
Jam et al. V-LinkNet: Learning Contextual Inpainting Across Latent Space of Generative Adversarial Network

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