Fabric surface defect detection method and related device

By adopting a pre-trained general unsupervised defect detection model in unsupervised defect detection, combined with the category matching and patch matching modules, the problems of category interference and sparse feature distribution in multi-category anomaly detection are solved, and efficient and lightweight fabric surface defect detection is achieved.

CN119810058AActive Publication Date: 2025-04-11INST OF AUTOMATION CHINESE ACAD OF SCI
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411880405.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-04-11
Estimated Expiration
2044-12-19

AI Technical Summary

Technical Problem

The existing unsupervised defect detection methods have challenges in memory consumption and deployment difficulty, especially in multi-category anomaly detection scenarios, and the problem of category interference and sparse feature distribution of models is difficult to effectively solve.

Method used

A pre-trained general unsupervised defect detection model is adopted, which includes a feature extractor, a category matching module, a patch matching module, a center offset discrimination module, and a feature discriminator. Through the combination of category matching and patch matching modules, the model's ability to capture fine-grained features is improved, and category interference is alleviated through the center offset discrimination module.

Benefits of technology

It improves the generalization capability and detection accuracy of the model, reduces memory consumption and computing load, simplifies model deployment, is suitable for resource-constrained devices, and effectively accelerates the speed of defect detection and inference.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119810058A_ABST
    Figure CN119810058A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of defect detection, and discloses a fabric surface defect detection method and related device.The method comprises the steps that a to-be-detected fabric image is obtained; and inputting the to-be-detected fabric image into a pre-trained universal unsupervised defect detection model to obtain a surface defect detection result of the to-be-detected fabric. The universal unsupervised defect detection model comprises a feature extractor, a category matching module, a patch matching module, a center offset discrimination module and a feature discriminator; the category matching module is used for acquiring target category center feature information from a plurality of preset category center feature information; the patch matching module is used for aligning a plurality of feature blocks of the feature information with a plurality of category center feature blocks in the target category center feature information; the center offset judgment module is used for obtaining the offset between each feature block and each type of aligned center feature block; and the feature discriminator is used for obtaining a surface defect detection result of the fabric. The surface defect detection accuracy of the fabric is improved, and the deployment difficulty is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of defect detection and relates to a fabric surface defect detection method and a related device. Background Art

[0002] In the current global market environment, international competition is becoming increasingly fierce and traditional production advantages are gradually disappearing, which puts higher requirements on the technical level and efficiency of the manufacturing industry. Product quality is directly related to the market competitiveness and economic benefits of enterprises. Especially for traditional manufacturing industries such as textile manufacturing, product surface defect detection is crucial. Such defects are often caused by mechanical failure, improper processing or improper material handling, and are usually small and difficult to identify with the naked eye. For a long time, fabric defect detection has mainly relied on artificial vision. This method is not only inefficient, but also the detection accuracy is limited by human subjective judgment and fatigue, which affects product quality and production efficiency. In recent years, defect detection technology based on deep learning has been proposed and widely used to solve this problem. However, most methods rely on supervised learning, which requires a large number of annotated fabric defect images to construct a training set, with high annotation costs and long project preparation time. In addition, in actual production, new types of fabric defects may continue to appear, and traditional supervised learning methods are difficult to quickly adapt to and detect these unknown defects.

[0003] The goal of unsupervised defect detection is to use only normal samples to identify defective samples and accurately locate their defective areas. This method is widely used when the frequency of defect occurrence is low and data collection is difficult. At present, the mainstream unsupervised defect detection methods can be divided into three categories. Image reconstruction-based methods: This method accurately reconstructs the normal area through the reconstruction model, while it is difficult to reconstruct the abnormal area, so as to detect defects by the difference between the reconstructed image and the original image; Feature embedding-based methods: This method uses a pre-trained network to extract features and compresses normal features into a compact space, so as to identify defect features far from the normal distribution in the feature space; Synthetic anomaly-based methods: This method introduces abnormal discrimination information by performing data enhancement on normal samples at the image or feature level to further improve the accuracy of defect detection. Based on unsupervised defect detection, in the current technical solutions, most methods adopt the method of training separate models for different categories of detection. Specifically, in the single-category unsupervised defect detection task, only normal samples of a single category are used in the training phase, and abnormal samples of the same category are detected in the test phase. The separate training method requires a specific weight model to be assigned to each category, which results in a significant increase in time and memory consumption as the number of categories increases, and is not suitable for application scenarios with large intra-class diversity. In contrast, the unified model only needs a model with shared weights to perform multiple categories of detection tasks at the same time. Specifically, in the general unsupervised defect detection task, normal samples of multiple different categories are used in the training phase, and abnormal samples of all known categories are detected in the test phase. Since this paradigm has higher generalization ability, it has more advantages in actual industrial unsupervised defect detection scenarios. In response to this problem, general unsupervised defect detection methods have gradually attracted widespread attention.

[0004] However, the general unsupervised defect detection method still has several significant shortcomings, which limit its application in actual industrial scenarios. First, the general unsupervised defect detection method still has high memory consumption. Since the model needs to learn and store general feature information, when running on edge devices with limited memory resources, it may cause memory overflow or insufficient resources, which makes it difficult to meet the needs of real-time detection. Secondly, this method is difficult to deploy. General unsupervised detection models usually rely on complex feature embedding or generation networks, resulting in a relatively large model architecture. Special processing of computing resources and model compression is required during the deployment process, which increases the difficulty of applying the model on industrial equipment, especially in embedded devices or low-power environments. The deployment of complex models faces significant challenges, affecting the possibility of their widespread promotion. Summary of the invention

[0005] The purpose of the present invention is to overcome the above-mentioned shortcomings of the prior art and provide a method and related device for detecting fabric surface defects.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] In a first aspect, the present invention provides a fabric surface defect detection method, comprising: obtaining a fabric image to be detected; inputting the fabric image to be detected into a pre-trained general unsupervised defect detection model to obtain a surface defect detection result of the fabric to be detected; wherein the general unsupervised defect detection model comprises a feature extractor, a category matching module, a patch matching module, a center offset discrimination module and a feature discriminator; the feature extractor is used to obtain feature information of the fabric image; the category matching module is used to obtain category center feature information with the highest similarity to the feature information from a plurality of preset category center feature information as target category center feature information; the patch matching module is used to divide the feature information into a plurality of feature blocks, and align the plurality of feature blocks with a plurality of category center feature blocks in the target category center feature information; the center offset discrimination module is used to obtain the offset between each feature block and the aligned category center feature blocks; the feature discriminator is used to obtain the surface defect detection result of the fabric according to the offset between each feature block and the aligned category center feature blocks.

[0008] Optionally, obtaining the category center feature information having the highest similarity to the feature information from among several preset category center feature information as the target category center feature information includes: obtaining the category center feature information having the shortest Euclidean distance to the feature information from among several preset category center feature information as the target category center feature information.

[0009] Optionally, the pre-trained universal unsupervised defect detection model is obtained by the following method: obtaining a training image sample; wherein the training image sample is a fabric image of a defect-free fabric; inputting the training image sample into the universal unsupervised defect detection model, and obtaining the offset between each feature block of the training image sample and the aligned central feature block of each category through a center offset discrimination module; superimposing a disturbance on each feature block to obtain each perturbed feature block of the training image sample, and obtaining the offset between each perturbed feature block of the training image sample and the aligned central feature block of each category through a center offset discrimination module; Through the feature discriminator, the surface defect detection result of the training image sample is obtained according to the offset between each feature block of the training image sample and the aligned central feature block of each category; through the feature discriminator, the perturbed surface defect detection result of the training image sample is obtained according to the offset between each perturbed feature block of the training image sample and the aligned central feature block of each category; according to the surface defect detection result of the training image sample and the perturbed surface defect detection result, the model parameters of the universal unsupervised defect detection model are updated; the above steps are iterated until the preset conditions are met to obtain the pre-trained universal unsupervised defect detection model.

[0010] Optionally, the preset several category center feature information are obtained in the following manner: the feature information of the fabric images of each category of defect-free fabric in the training image samples is obtained by a feature extractor, and the feature information of the fabric images of each category of defect-free fabric is averaged according to the category to obtain the category center feature information of the fabric images of each category of defect-free fabric.

[0011] Optionally, the superimposing disturbance on each feature block to obtain each disturbed feature block of the training image sample includes: traversing each feature block of each training image sample, and performing the following steps: obtaining the modulus of the offset between the current feature block of the training image sample and the aligned category center feature block to obtain a first modulus; and obtaining the modulus of a preset Gaussian noise to obtain a second modulus; based on a preset scaling factor, linearly scaling the ratio of the first modulus to the second modulus with a fixed point 1 as the center to obtain an adjustment coefficient; adjusting the variance of the preset Gaussian noise according to the adjustment coefficient to obtain the disturbance amount of the current feature block and superimposing it on the current feature block to obtain the current disturbed feature block of the training image sample.

[0012] Optionally, iterating the above steps until a preset condition is satisfied includes: iterating the above steps until a preset number of iterations is reached, or the detection accuracy of the general unsupervised defect detection model under the current model parameters on a preset test set is greater than a preset detection accuracy threshold.

[0013] According to a second aspect of the present invention, a fabric surface defect detection system is provided, comprising: an image acquisition module for acquiring a fabric image to be detected; a defect detection module for inputting the fabric image to be detected into a pre-trained general unsupervised defect detection model to obtain a surface defect detection result of the fabric to be detected; wherein the general unsupervised defect detection model comprises a feature extractor, a category matching module, a patch matching module, a center offset discrimination module and a feature discriminator; the feature extractor is used to acquire feature information of the fabric image; the category matching module is used to acquire the category center feature information with the highest similarity to the feature information from a plurality of preset category center feature information as the target category center feature information; the patch matching module is used to divide the feature information into a plurality of feature blocks, and align the plurality of feature blocks with a plurality of category center feature blocks in the target category center feature information; the center offset discrimination module is used to acquire the offset between each feature block and the aligned category center feature blocks; the feature discriminator is used to obtain the surface defect detection result of the fabric according to the offset between each feature block and the aligned category center feature blocks.

[0014] Optionally, the pre-trained universal unsupervised defect detection model is obtained in the following manner: obtaining training image samples; wherein the training image samples are defect-free fabric images; inputting the training image samples into the universal unsupervised defect detection model, and obtaining the offset between each feature block of the training image sample and the aligned central feature blocks of each category through a center offset discrimination module; superimposing perturbations on each feature block to obtain each perturbed feature block of the training image sample, and obtaining the offset between each perturbed feature block of the training image sample and the aligned central feature blocks of each category through a center offset discrimination module; obtaining the surface defect detection result of the training image sample according to the offset between each feature block of the training image sample and the aligned central feature blocks of each category through a feature discriminator; obtaining the perturbed surface defect detection result of the training image sample according to the offset between each perturbed feature block of the training image sample and the aligned central feature blocks of each category through a feature discriminator; updating the model parameters of the universal unsupervised defect detection model according to the surface defect detection result of the training image sample and the perturbed surface defect detection result; iterating the above steps until the preset conditions are met to obtain the pre-trained universal unsupervised defect detection model.

[0015] According to a third aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned fabric surface defect detection method when executing the computer program.

[0016] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned fabric surface defect detection method are implemented.

[0017] Compared with the prior art, the present invention has the following beneficial effects:

[0018] The fabric surface defect detection method of the present invention realizes the surface defect detection of the fabric to be detected based on the pre-trained general unsupervised defect detection model. Among them, the general unsupervised defect detection model improves the model's ability to capture fine-grained features by combining the category matching module and the patch matching module to solve the problem that the detection accuracy is reduced due to the large difference in the distribution of features of different categories. By introducing a novel center offset discrimination module, the offset of the feature information of the fabric image to be detected relative to the category center feature information of the corresponding category is determined for detection, which alleviates the category interference of the model during detection, thereby effectively improving the generalization ability and detection accuracy of the model in the multi-category anomaly detection scenario, and improving the accuracy of fabric surface defect detection. At the same time, a simple unsupervised defect detection network architecture is adopted, and the defect location result is directly given by the feature discriminator. In addition, in the detection process, only a small amount of information of the preset center feature information of several categories needs to be queried, and all the center feature information does not need to be recalculated, which reduces memory consumption and computing load, reduces computing cost and realizes a lightweight inference process, effectively speeds up the defect detection reasoning speed, and reduces the deployment difficulty of the model, which is convenient for deployment on resource-constrained devices.

[0019] Furthermore, in order to address the problem of sparse distribution of features in space, during the pre-training process, the ratio of the first modulus to the second modulus is linearly scaled with the fixed point 1 as the center based on a preset scaling factor to obtain an adjustment coefficient, and the preset Gaussian noise is adjusted according to the adjustment coefficient to obtain the current perturbation feature block of the training image sample, so that the abnormal image maintains an appropriate distance from the normal images of each category in the feature space, thereby ensuring the generalization ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 The present invention is a flowchart of a method for detecting fabric surface defects according to an embodiment of the present invention.

[0021] Figure 2 Schematic diagram of the disturbance feature block synthesis principle of an embodiment of the present invention.

[0022] Figure 3 4 is a structural block diagram of a fabric surface defect detection system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0023] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0025] The present invention is further described in detail below in conjunction with the accompanying drawings:

[0026] See also Figure 1 In one embodiment of the present invention, a method for detecting fabric surface defects is provided, specifically, a general unsupervised multi-category defect detection method for fabric surface based on memory center perception. The generalization ability and detection accuracy of the model are improved through innovative module design, which can effectively solve the common problems of inter-class interference and sparse distribution of features in multi-category fabric surface anomaly detection.

[0027] Specifically, the fabric surface defect detection method of the present invention comprises the following steps:

[0028] S1: Acquire the fabric image to be detected.

[0029] S2: Input the image of the fabric to be inspected into the pre-trained general unsupervised defect detection model to obtain the surface defect detection result of the fabric to be inspected.

[0030] Among them, the general unsupervised defect detection model includes a feature extractor, a category matching module, a patch matching module, a center offset discrimination module and a feature discriminator; the feature extractor is used to obtain feature information of the fabric image; the category matching module is used to obtain the category center feature information with the highest similarity to the feature information from a plurality of preset category center feature information as the target category center feature information; the patch matching module is used to divide the feature information into a plurality of feature blocks, and align the plurality of feature blocks with a plurality of category center feature blocks in the target category center feature information; the center offset discrimination module is used to obtain the offset between each feature block and the aligned category center feature blocks; the feature discriminator is used to obtain the surface defect detection result of the fabric according to the offset between each feature block and the aligned category center feature blocks.

[0031] The fabric surface defect detection method of the present invention realizes the surface defect detection of the fabric to be detected based on the pre-trained general unsupervised defect detection model. Among them, the general unsupervised defect detection model improves the model's ability to capture fine-grained features by combining the category matching module and the patch matching module to solve the problem that the detection accuracy is reduced due to the large difference in the distribution of features of different categories. By introducing a novel center offset discrimination module, the offset of the feature information of the fabric image to be detected relative to the category center feature information of the corresponding category is determined for detection, which alleviates the category interference of the model during detection, thereby effectively improving the generalization ability and detection accuracy of the model in the multi-category anomaly detection scenario, and improving the accuracy of fabric surface defect detection. At the same time, a simple unsupervised defect detection network architecture is adopted, and the defect location result is directly given by the feature discriminator. In addition, in the detection process, only a small amount of information of the preset center feature information of several categories needs to be queried, and all the center feature information does not need to be recalculated, which reduces memory consumption and computing load, reduces computing cost and realizes a lightweight inference process, effectively speeds up the defect detection reasoning speed, and reduces the deployment difficulty of the model, which is convenient for deployment on resource-constrained devices.

[0032] Explanatory, the surface defect detection result of the fabric is generally whether each feature block of the fabric image has defects, which is determined by the defect probability corresponding to each feature block output by the feature discriminator according to the offset between each feature block and the aligned central feature block of each category. Then, the detection result of whether each area corresponding to each feature block of the fabric image has defects is output to realize defect location detection.

[0033] Explanatory, the similarity between the feature information obtained by the category matching module and the feature information of the category center is calculated through global similarity, and the fabric image is assigned to the best matching category center based on it.

[0034] Explanation: The patch matching module divides the feature information of the fabric image into multiple small blocks, namely feature blocks, and compares and aligns them one by one with the feature blocks of the category center feature information of the corresponding category, thereby achieving more fine-grained feature matching. This patch-level matching can effectively enhance the diversity of intra-class features and ensure that the model captures subtle features more accurately during feature generation and anomaly detection.

[0035] In a possible implementation, the obtaining, from among several preset category center feature information, category center feature information having the highest similarity to the feature information as target category center feature information includes: obtaining, from among several preset category center feature information, category center feature information having the shortest Euclidean distance to the feature information as target category center feature information.

[0036] Explanatory, the feature extractor is used to extract multi-level feature information of the fabric image, which contains detailed descriptions of different levels and regions of the fabric image.

[0037] Exemplarily, several preset category center feature information can be pre-stored in the memory bank, and the corresponding category center feature information can be acquired by calling it when in use. The category matching module determines the category to which the input fabric image belongs by querying several category center feature information pre-stored in the memory bank, ensuring that the input fabric image can accurately find its most similar category center feature information for subsequent abnormality detection.

[0038] In a possible implementation, the pre-trained universal unsupervised defect detection model is obtained by: obtaining a training image sample; wherein the training image sample is a fabric image of a defect-free fabric; inputting the training image sample into the universal unsupervised defect detection model, and obtaining the offset between each feature block of the training image sample and the aligned central feature blocks of each category through a center offset discriminant module; superimposing a disturbance on each feature block to obtain each perturbed feature block of the training image sample, and obtaining the offset between each perturbed feature block of the training image sample and the aligned central feature blocks of each category through a center offset discriminant module. offset; through the feature discriminator, according to the offset between each feature block of the training image sample and the aligned central feature block of each category, the surface defect detection result of the training image sample is obtained; through the feature discriminator, according to the offset between each perturbation feature block of the training image sample and the aligned central feature block of each category, the perturbed surface defect detection result of the training image sample is obtained; according to the surface defect detection result of the training image sample and the perturbed surface defect detection result, the model parameters of the universal unsupervised defect detection model are updated; iterate the above steps until the preset conditions are met to obtain the pre-trained universal unsupervised defect detection model.

[0039] Explanation: During the training process, the classification of the training image samples is realized by using the preset central feature information of several categories stored in the memory bank, wherein the preset central feature information of several categories stored in the memory bank can be updated in real time according to the newly acquired training image samples.

[0040] Optionally, the preset several category center feature information are obtained in the following manner: the feature information of the fabric images of each category of defect-free fabric in the training image samples is obtained by a feature extractor, and the feature information of the fabric images of each category of defect-free fabric is averaged according to the category to obtain the category center feature information of the fabric images of each category of defect-free fabric.

[0041] Explanatory, the category center feature information is defined as the mean of the feature information of the fabric images of each category of defect-free fabrics, which can more accurately represent the features of the fabric images of each category of fabrics.

[0042] In a possible implementation, superimposing disturbances on each feature block to obtain each disturbed feature block of the training image sample includes: traversing each feature block of each training image sample, and performing the following steps: obtaining the modulus of the offset between the current feature block of the training image sample and the aligned category center feature block to obtain a first modulus; and obtaining the modulus of a preset Gaussian noise to obtain a second modulus; based on a preset scaling factor, linearly scaling the ratio of the first modulus to the second modulus with a fixed point 1 as the center to obtain an adjustment coefficient; adjusting the variance of the preset Gaussian noise according to the adjustment coefficient to obtain the disturbance amount of the current feature block and superimposing it on the current feature block to obtain the current disturbed feature block of the training image sample.

[0043] Explanatory, in this strategy, the feature information of the fabric image of the defect-free fabric is first input, and it is matched with the category center feature information of the corresponding category. The category center feature information corresponding to the feature information of the input fabric image of the defect-free fabric can be accurately found through similarity comparison, that is, the Euclidean distance between the feature information of the input fabric image of the defect-free fabric and the preset category center feature information is calculated, and on this basis, the category center feature information with the closest distance is found, and then the adjusted Gaussian noise is added to the category center feature information with the closest distance.

[0044] Specifically, the variance of Gaussian noise sets the range of the generation of the perturbed feature blocks, so that the perturbed feature blocks maintain an appropriate distance distribution from the normal feature blocks in the feature space, thereby forming a reasonable abnormal boundary. Since normal features of different categories have different patterns of feature distribution, the perturbed feature blocks directly superimposed with Gaussian noise of fixed variance may produce aliasing with the normal feature blocks. Therefore, a strategy of center distance constrained variance is designed to adaptively generate perturbed feature blocks with variable variance, thereby alleviating the aliasing problem.

[0045] This center distance constrained variance strategy ensures that features of different categories remain relatively independent by regulating the distance between the perturbed feature blocks and the normal feature blocks, avoiding the features of abnormal fabric images from being "close" to the features of normal fabric images of a certain category, thereby reducing detection errors and inter-class interference.

[0046] In addition, the strategy of center distance constrained variance can also ensure that the generated perturbation feature blocks will not deviate too far from the normal feature blocks and remain within a reasonable range, thereby effectively improving the accuracy of anomaly detection and model generalization performance.

[0047] Exemplarily, when updating the model parameters of the general unsupervised defect detection model according to the surface defect detection results of the training image samples and the perturbed surface defect detection results, the normal sample discrimination loss of the model is obtained according to the surface defect detection results of the training image samples, and the abnormal sample discrimination loss of the model is obtained according to the perturbed surface defect detection results of the training image samples. Among them, the normal sample discrimination loss and the abnormal sample discrimination loss can adopt the cross entropy loss function, and then the normal sample discrimination loss and the abnormal sample discrimination loss are combined to obtain the superposition discrimination loss, and the model parameters of the general unsupervised defect detection model are updated according to the superposition discrimination loss.

[0048] In a possible implementation, iterating the above steps until a preset condition is satisfied includes: iterating the above steps until a preset number of iterations is reached, or the detection accuracy of the general unsupervised defect detection model under the current model parameters on a preset test set is greater than a preset detection accuracy threshold.

[0049] Compared with the existing methods, the fabric surface defect detection method of the present invention mainly has the following outstanding substantial features and significant progress: 1. In view of the problem of large differences in feature distribution of different categories, by introducing a center offset discrimination module, the offset of samples relative to the center of each category is learned, which alleviates the category interference of the model during detection, thereby improving the detection accuracy; 2. In view of the sparse distribution of features in space, the strategy of center distance constrained variance is used to effectively constrain the disturbance amount, so that abnormal samples maintain an appropriate distance from normal samples of each category in the feature space, thereby ensuring generalization ability; 3. By designing a lightweight model, memory consumption and computing load are reduced, which is convenient for deployment on resource-constrained devices, and low-cost and high-efficiency defect detection is achieved.

[0050] The following are device embodiments of the present invention, which can be used to implement the method embodiments of the present invention. For details not disclosed in the device embodiments, please refer to the method embodiments of the present invention.

[0051] See also Figure 3 In another embodiment of the present invention, a fabric surface defect detection system is provided, which can be used to implement the above-mentioned fabric surface defect detection method. Specifically, the fabric surface defect detection system includes an image acquisition module and a defect detection module.

[0052] Among them, the image acquisition module is used to acquire the fabric image to be detected; the defect detection module is used to input the fabric image to be detected into the pre-trained general unsupervised defect detection model to obtain the surface defect detection result of the fabric to be detected; wherein the general unsupervised defect detection model includes a feature extractor, a category matching module, a patch matching module, a center offset discrimination module and a feature discriminator; the feature extractor is used to acquire the feature information of the fabric image; the category matching module is used to acquire the category center feature information with the highest similarity to the feature information from a plurality of preset category center feature information as the target category center feature information; the patch matching module is used to divide the feature information into a plurality of feature blocks, and align the plurality of feature blocks with a plurality of category center feature blocks in the target category center feature information; the center offset discrimination module is used to acquire the offset between each feature block and the aligned category center feature blocks; the feature discriminator is used to obtain the surface defect detection result of the fabric according to the offset between each feature block and the aligned category center feature blocks.

[0053] In a possible implementation, the pre-trained universal unsupervised defect detection model is obtained in the following manner: obtaining a training image sample; wherein the training image sample is a defect-free fabric image; inputting the training image sample into the universal unsupervised defect detection model, and obtaining the offset between each feature block of the training image sample and the aligned central feature block of each category through a center offset discriminant module; superimposing a disturbance on each feature block to obtain each perturbed feature block of the training image sample, and obtaining the offset between each perturbed feature block of the training image sample and the aligned central feature block of each category through a center offset discriminant module; obtaining a surface defect detection result of the training image sample according to the offset between each feature block of the training image sample and the aligned central feature block of each category through a feature discriminator; obtaining a perturbed surface defect detection result of the training image sample according to the offset between each perturbed feature block of the training image sample and the aligned central feature block of each category through a feature discriminator; updating the model parameters of the universal unsupervised defect detection model according to the surface defect detection result of the training image sample and the perturbed surface defect detection result; iterating the above steps until the preset conditions are met to obtain the pre-trained universal unsupervised defect detection model.

[0054] All relevant contents of each step involved in the embodiment of the aforementioned fabric surface defect detection method can be referred to the functional description of the functional modules corresponding to the fabric surface defect detection system in the embodiment of the present invention, and will not be repeated here.

[0055] The division of modules in the embodiments of the present invention is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional module in each embodiment of the present invention may be integrated into one processor, or may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.

[0056] In another embodiment of the present invention, a computer device is provided, the computer device includes a processor and a memory, the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions in the computer storage medium to implement the corresponding method flow or corresponding function; the processor described in the embodiment of the present invention can be used for the operation of the fabric surface defect detection method.

[0057] In another embodiment of the present invention, the present invention further provides a storage medium, specifically a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The processor can load and execute one or more instructions stored in the computer-readable storage medium to implement the corresponding steps of the fabric surface defect detection method in the above embodiment.

[0058] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0059] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0060] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0061] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0062] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A method for detecting fabric surface defects, characterized in that: include: Acquire a fabric image to be detected; The image of the fabric to be inspected is input into a pre-trained general unsupervised defect detection model to obtain a surface defect detection result of the fabric to be inspected; Among them, the general unsupervised defect detection model includes a feature extractor, a category matching module, a patch matching module, a center offset discrimination module and a feature discriminator; the feature extractor is used to obtain feature information of the fabric image; the category matching module is used to obtain the category center feature information with the highest similarity to the feature information from a plurality of preset category center feature information as the target category center feature information; the patch matching module is used to divide the feature information into a plurality of feature blocks, and align the plurality of feature blocks with a plurality of category center feature blocks in the target category center feature information; the center offset discrimination module is used to obtain the offset between each feature block and the aligned category center feature blocks; the feature discriminator is used to obtain the surface defect detection result of the fabric according to the offset between each feature block and the aligned category center feature blocks.

2. The fabric surface defect detection method according to claim 1, characterized in that: The step of obtaining the category center feature information having the highest similarity to the feature information from the preset plurality of category center feature information as the target category center feature information includes: The category center feature information having the shortest Euclidean distance to the feature information is obtained from the preset plurality of category center feature information as the target category center feature information.

3. The fabric surface defect detection method according to claim 1, characterized in that: The pre-trained general unsupervised defect detection model is obtained in the following way: Acquire training image samples; wherein the training image samples are fabric images of fabrics without defects; The training image samples are input into the general unsupervised defect detection model, and the offset between each feature block of the training image sample and the aligned center feature blocks of each category is obtained through the center offset discrimination module; Superimposing disturbances on each feature block to obtain each perturbed feature block of the training image sample, and obtaining the offset between each perturbed feature block of the training image sample and the aligned central feature blocks of each category through a center offset discrimination module; Through the feature discriminator, the surface defect detection result of the training image sample is obtained according to the offset between each feature block of the training image sample and the aligned central feature block of each category; Through the feature discriminator, the disturbed surface defect detection result of the training image sample is obtained according to the offset between each disturbed feature block of the training image sample and the aligned central feature block of each category; updating model parameters of the general unsupervised defect detection model according to the surface defect detection results of the training image samples and the perturbed surface defect detection results; The above steps are iterated until the preset conditions are met to obtain a pre-trained general unsupervised defect detection model.

4. The fabric surface defect detection method according to claim 3, characterized in that: The preset central feature information of several categories is obtained in the following manner: The feature information of fabric images of each category of defect-free fabric in the training image samples is obtained by a feature extractor, and the feature information of the fabric images of each category of defect-free fabric is averaged according to the category to obtain the category center feature information of the fabric images of each category of defect-free fabric.

5. The fabric surface defect detection method according to claim 3, characterized in that: The perturbation feature blocks of the training image samples obtained by superimposing perturbations on the feature blocks include: Traverse each feature block of each training image sample and perform the following steps: Obtaining the modulus of the offset between the current feature block of the training image sample and the aligned category center feature block to obtain a first modulus; and obtaining the modulus of the preset Gaussian noise to obtain a second modulus; Based on a preset scaling factor, a ratio of the first modulus to the second modulus is linearly scaled with the fixed point 1 as the center to obtain an adjustment coefficient; The variance of the preset Gaussian noise is adjusted according to the adjustment coefficient to obtain the disturbance amount of the current feature block and superimpose it on the current feature block to obtain the current disturbance feature block of the training image sample.

6. The fabric surface defect detection method according to claim 3, characterized in that: The iterating of the above steps until the preset conditions are met includes: The above steps are iterated until a preset number of iterations is reached, or the detection accuracy of the general unsupervised defect detection model under the current model parameters on the preset test set is greater than a preset detection accuracy threshold.

7. A fabric surface defect detection system, characterized in that: include: An image acquisition module, used for acquiring an image of a fabric to be detected; A defect detection module is used to input the image of the fabric to be detected into a pre-trained general unsupervised defect detection model to obtain a surface defect detection result of the fabric to be detected; Among them, the general unsupervised defect detection model includes a feature extractor, a category matching module, a patch matching module, a center offset discrimination module and a feature discriminator; the feature extractor is used to obtain feature information of the fabric image; the category matching module is used to obtain the category center feature information with the highest similarity to the feature information from a plurality of preset category center feature information as the target category center feature information; the patch matching module is used to divide the feature information into a plurality of feature blocks, and align the plurality of feature blocks with a plurality of category center feature blocks in the target category center feature information; the center offset discrimination module is used to obtain the offset between each feature block and the aligned category center feature blocks; the feature discriminator is used to obtain the surface defect detection result of the fabric according to the offset between each feature block and the aligned category center feature blocks.

8. The fabric surface defect detection system according to claim 7, characterized in that: The pre-trained general unsupervised defect detection model is obtained in the following way: Acquire training image samples; wherein the training image samples are defect-free fabric images; The training image samples are input into the general unsupervised defect detection model, and the offset between each feature block of the training image sample and the aligned center feature blocks of each category is obtained through the center offset discrimination module; Superimposing disturbances on each feature block to obtain each perturbed feature block of the training image sample, and obtaining the offset between each perturbed feature block of the training image sample and the aligned central feature blocks of each category through a center offset discrimination module; Through the feature discriminator, the surface defect detection result of the training image sample is obtained according to the offset between each feature block of the training image sample and the aligned central feature block of each category; Through the feature discriminator, the disturbed surface defect detection result of the training image sample is obtained according to the offset between each disturbed feature block of the training image sample and the aligned central feature block of each category; updating model parameters of the general unsupervised defect detection model according to the surface defect detection results of the training image samples and the perturbed surface defect detection results; The above steps are iterated until the preset conditions are met to obtain a pre-trained general unsupervised defect detection model.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the fabric surface defect detection method according to any one of claims 1 to 6 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the fabric surface defect detection method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Anti-migration disturbance learning method and system based on adversarial generative model, and memory

    CN116152592A

  • Depth feature-based defect detection method, system and equipment and storage medium

    CN116385380A

  • Target detection method and device based on fixed point modeling and storage medium

    CN116824234A

  • Non-supervision defect detection method and system based on slice matching and medium

    CN116958153A

  • Fabric image unsupervised defect detection method and device

    CN118014941A