A fabric defect detection method, system, device, and medium

By using a multi-model fusion discrimination method, which combines anomaly detection, target detection, and edge detection models, the problem that traditional manual visual inspection and single algorithms are insufficient for detecting complex fabric defects is solved, achieving efficient and low-cost automated detection results.

CN116228651BActive Publication Date: 2025-12-05NINGBO HAITANG INFORMATION TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211660583.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-23
Publication Date
2025-12-05
Estimated Expiration
2042-12-23

AI Technical Summary

Technical Problem

Traditional manual visual defect detection methods are inefficient and costly. Existing image processing technologies are difficult to adapt to complex industrial inspection requirements, and single algorithms are insufficient to meet the complex needs of fabric defect detection.

Method used

A multi-model fusion discrimination method is adopted, which combines anomaly detection, target detection and edge detection models. Through preprocessing and result merging, false defects and unwanted detection results are filtered out, thereby improving detection accuracy and adaptability.

Benefits of technology

It enables efficient and automated detection of complex fabric defects, reduces labor costs, improves the reliability and adaptability of detection, and meets the needs of large-scale industrial production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116228651B_ABST
    Figure CN116228651B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of defect detection, and provides a cloth defect detection method, system, device and medium. An application software collects cloth images and transmits the cloth images to a detection system. The collected images are preprocessed according to the requirements of different detection models. The images after different preprocessing are respectively taken as inputs of an anomaly detection model, a target detection model and an edge detection model for defect detection. The detection results obtained by the detection models are combined, and after filtering out the crease detection results and the pseudo defect detection results, the final detection results are obtained. The application has the advantages that the defect detection method of multi-model fusion is beneficial to improving the cloth defect detection rate and reducing the false detection rate, thereby meeting the defect detection requirements in large-batch automatic industrial production and saving labor costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of defect detection technology, and in particular to a method, system, equipment and medium for detecting defects in fabrics. Background Technology

[0002] Surface defect detection is a crucial research area in machine vision. With the development of manufacturing, the quantity and variety of industrial products are increasing daily, and consumers' demands for product quality are also rising. Therefore, defective products can have a significant negative impact on businesses. In actual industrial production, various defects can appear on product surfaces due to factors such as process flow, production equipment, and the on-site environment. These surface defects not only affect the appearance quality of the product itself but also its performance and commercial value. For example, in the textile industry, one of the world's largest manufacturing sectors, defective fabrics can reduce a company's profits by only 45%-65%, representing a huge loss, especially for Chinese companies, which are the world's largest producers. Therefore, surface quality inspection is essential during product manufacturing to promptly detect and control defects, thereby improving the economic efficiency of enterprises.

[0003] Traditional manual visual defect inspection methods suffer from several drawbacks, including the need for training new employees, difficulty in maintaining focus and efficiency during inspections, limited inspection speed, high inspection costs, and difficulty in adapting manual inspection to product size. Therefore, traditional manual visual defect inspection methods are insufficient to meet the needs of enterprises.

[0004] In recent years, the rapid development of image processing technology and the increase in computer processing speed have enabled the application of machine vision methods in many industrial inspection scenarios. This has greatly improved inspection speed and automation, reduced labor costs significantly, and enhanced the reliability and objectivity of inspections. A typical industrial vision inspection system mainly consists of three parts: optical illumination, image acquisition, and image processing and defect detection. Among these, a good optical illumination platform and suitable image acquisition equipment are prerequisites for obtaining high-quality images and ultimately reliable inspection results. Image processing technology needs to be carefully designed according to actual inspection requirements and typically includes image denoising, image enhancement, and image detection, segmentation, and recognition. For example, Chinese invention patent application number CN201310437747.9 discloses a method for detecting fabric defects based on morphological analysis.

[0005] However, traditional image processing techniques are difficult to adapt to different task environments. When the detection scene changes, it is necessary to redesign the image processing algorithm at a high cost. At the same time, it is difficult to design suitable algorithms for some products with rich defect features.

[0006] With the extensive research and development of deep learning models, represented by Convolutional Neural Networks (CNNs), many methods have been applied to the field of computer vision, including numerous defect detection methods. For example, Chinese invention patent application number CN202210654558.6 discloses a method for identifying insulation board defects based on YOLOx-s enhanced target feature detection. Some companies both domestically and internationally have even developed commercial industrial defect detection software based on deep learning, such as Aititron AI software from China, VIDI from Switzerland, and Halcon from Germany. Methods based on convolutional neural networks can learn deeper features of images through training, thereby improving the algorithm's adaptability and detection accuracy.

[0007] The above analysis reveals that neither morphological image processing techniques nor object detection methods can meet the more complex requirements of industrial inspection. This is because defects in industrial defect detection are often highly complex, and visual defects in a product are not necessarily recognized as product flaws. Therefore, a single algorithm is insufficient to satisfy these complex inspection requirements. Summary of the Invention

[0008] The purpose of this invention is to provide a method, system, device and medium for fabric defect detection using multi-model fusion discrimination, in order to solve the above-mentioned problems.

[0009] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0010] A method for detecting fabric defects includes:

[0011] S1. The application software acquires images of the fabric and transmits them to the detection system;

[0012] S2. Preprocess the images acquired in step S1 according to the requirements of different detection models;

[0013] S3. Using the preprocessed images as inputs to the anomaly detection model, target detection model, and edge detection model respectively, defect detection is performed. The line defect detection model and the point defect detection model together constitute the target detection model. The anomaly detection model detects the number of defects in the image, the target detection model detects the category of each defect in the image, and the edge detection model obtains the defect categories and false defect detection results that the anomaly detection model and target detection model cannot identify.

[0014] S4. Merge the detection results obtained from each detection model in step S3, and after filtering out the crease detection results and false defect detection results, obtain the final detection result.

[0015] Furthermore, the steps for constructing the anomaly detection model include:

[0016] A1. Collect fabric sample images, label some defective samples, use the labeled defective samples and some normal samples as the test dataset, and use the remaining normal samples as the training dataset.

[0017] A2. Build a network model based on the multi-scale feature distillation model, input the training dataset mentioned in A1 into the model to train the network model, and test the network model with the test dataset to generate an anomaly detection model.

[0018] Furthermore, the steps for constructing the target detection model include:

[0019] B1. Collect sample images of various types of defects in fabrics, label the corresponding defect targets, construct linear and dot defect datasets respectively, and divide the training dataset and test dataset.

[0020] B2. Based on the preset neural network model, establish a line defect detection network and a point defect detection network respectively. Input the linear training dataset in B1 into the line defect detection network for training and test the network with the linear test dataset to generate a line defect detection model. Input the point training dataset in B1 into the point defect detection network for training and test the network with the test set to generate a point defect detection model.

[0021] Furthermore, step S2 specifically includes:

[0022] S21. After performing preprocessing operations such as standardization, block cropping, size transformation and parallel stacking on the image described in S1, it is used as the input of the anomaly detection model.

[0023] S22. After performing preprocessing operations such as standardization, setting overlapping areas for block cropping, and size transformation on the image described in S1, it is used as the input to the target detection model;

[0024] S23. Use the image described in S1 directly as input to the edge detection model.

[0025] Furthermore, the steps for obtaining defect categories and pseudo-defect detection results that the anomaly detection model and the target detection model cannot identify from the edge detection model include:

[0026] C1. Construct an edge detection model based on the Canny operator, and perform a square transformation on the image input to the edge detection model;

[0027] C2. Apply Gaussian filtering to the image obtained in C1 to smooth out image noise;

[0028] C3. The horizontal template S using the Sobel algorithm x and vertical template S yCalculate the horizontal and vertical gradients of the image obtained from C2;

[0029] C4. Perform non-maximum suppression on the gradient obtained from C3 to remove non-edge values;

[0030] C5. Using dual threshold discrimination, we obtain real edges and potential edges, forming potential abnormal regions;

[0031] C6. Perform morphological dilation processing on the detection results obtained in C5, then find all contours and fill the inside of the contours. Next, perform morphological erosion processing on the filled results to find all eroded contours, forming defect categories that cannot be identified by the anomaly detection model and the target detection model.

[0032] Furthermore, step S4 includes:

[0033] S41. Standardize the format of the detection results of the three models to obtain the coordinates of the upper left corner and the lower right corner of the detection box detected by each model.

[0034] S42. Filter out the detection boxes that do not intersect with the detection boxes formed by the potential abnormal regions obtained by the edge detection model to eliminate false defects.

[0035] S43. The overlap between the crease detection box obtained by the line defect detection model and the defect detection box obtained by the edge detection model is determined. When the overlap is higher than the set threshold, it is considered to be a false crease detection box of the line defect detection model and the defect is not filtered out.

[0036] S44. The overlap between the crease detection box obtained by the discrimination line defect detection model and the defect detection box of the anomaly detection model. If the overlap is higher than the set threshold, the defect is filtered out to remove the crease detection result.

[0037] S45. Merge the detection boxes of the anomaly detection model, the line defect detection model, and the point defect detection model after crease filtering together as the final detection result.

[0038] Another aspect of the present invention provides a fabric defect detection system, comprising:

[0039] The data communication module is configured to receive fabric image data collected by the application software via the HTTP communication protocol, and transmit the detection results back to the application software via the HTTP communication protocol.

[0040] The image preprocessing module is configured to preprocess the image to be detected obtained by the data communication module according to the requirements of different detection models, and then use it as the input of the image detection module.

[0041] The image detection module is configured to use images with different preprocessing stages as inputs to anomaly detection models, target detection models, and edge detection models for defect detection.

[0042] The results post-processing module is configured to integrate the detection results from each model.

[0043] The logging module is configured to monitor and record the usage of the detection system. If the detection system is used abnormally, the information will be collected and stored in a local file.

[0044] Another aspect of the present invention provides an electronic device including a processor for executing a computer program stored in a memory to implement the steps of the fabric defect detection method.

[0045] Another aspect of the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the fabric defect detection method.

[0046] Compared with the prior art, the present invention has at least the following beneficial effects:

[0047] (1) The present invention adopts an unsupervised anomaly detection algorithm, which can detect various types of defects in fabrics by training with normal samples. It is suitable for fabric defect detection tasks with a wide variety of defect types and sizes, while reducing a lot of manual labeling costs.

[0048] (2) This invention combines actual industrial needs with target detection and edge detection algorithms on the basis of anomaly detection algorithms to improve the overall detection rate of the model. In addition, since creases are not considered defects in industrial production, creases detected by the target detection algorithm are used to filter out the crease detection results in the anomaly detection algorithm;

[0049] (3) Based on the above method, the present invention provides a detection system that can meet the requirements of large-scale automated industrial production, thereby replacing manual labor to a certain extent and saving labor costs. Attached Figure Description

[0050] Figure 1 This is a flowchart of the fabric defect detection method in an embodiment of the present invention;

[0051] Figure 2 This is a flowchart of the image detection method using the edge detection model in this embodiment of the invention;

[0052] Figure 3 This is a schematic diagram of edge detection with dual threshold discrimination based on the Canny operator in an embodiment of the present invention;

[0053] Figure 4This is a flowchart of the result fusion method of each detection model in the embodiments of the present invention. Detailed Implementation

[0054] It should be noted that in this invention, the use of terms such as "first," "second," and "a" is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0055] In this invention, unless otherwise explicitly specified and limited, the terms "connection," "fixed," etc., should be interpreted broadly. For example, "fixed" can mean a fixed connection, a detachable connection, or an integral part; it can mean a mechanical connection or an electrical connection; it can mean a direct connection or an indirect connection through an intermediate medium; it can mean the internal communication of two components or the interaction between two components, unless otherwise explicitly limited. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0056] Furthermore, the technical solutions of the various embodiments of the present invention can be combined with each other, but only if they are based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such combination of technical solutions does not exist and is not within the scope of protection claimed by the present invention.

[0057] The following are specific embodiments of the present invention, and the technical solutions of the present invention will be further described in conjunction with the accompanying drawings. However, the present invention is not limited to these embodiments.

[0058] like Figure 1 As shown, the fabric defect detection method using multi-model fusion discrimination in this embodiment includes:

[0059] S1. The application software collects images of the fabric and transmits them to the detection system.

[0060] S2. Preprocess the images acquired in step S1 according to the requirements of different detection models.

[0061] S3. Using different preprocessed images as inputs to the anomaly detection model, target detection model, and edge detection model respectively, defect detection is performed. The line defect detection model and the point defect detection model together constitute the target detection model. The anomaly detection model detects the number of defects in the image, the target detection model detects the category of each defect in the image, and the edge detection model obtains the defect categories and false defect detection results that the anomaly detection model and target detection model cannot identify.

[0062] S4. Merge the detection results obtained from each detection model in step S3, and after filtering out the crease detection results and false defect detection results, obtain the final detection result.

[0063] In a preferred example, an anomaly detection model is used to detect defects such as broken yarn, creases, holes, oil stains, scratches, and wool dust. The line defect detection model detects linear defects such as broken yarn and creases, while the point defect detection model detects point defects such as small oil stains and small lint balls. The edge detection model can detect defects such as artificial markings and long holes, and perform false defect identification.

[0064] Optionally, step S2 specifically includes:

[0065] S21. After performing preprocessing operations such as standardization, block cropping, size transformation and parallel stacking on the image described in S1, it is used as the input of the anomaly detection model.

[0066] S22. After performing preprocessing operations such as standardization, setting overlapping regions for block cropping, and size transformation on the image described in S1, it is used as the input to the target detection model.

[0067] S23. Use the image described in S1 directly as input to the edge detection model.

[0068] The standardization operation for the image described in S1 is as follows: Standardization is performed using the mean and standard deviation obtained from sampling statistics of the ImageNet dataset, resulting in image data with a mean of 0 and a standard deviation of 1. Parallel stacking involves stacking the resized image data in a new dimension to obtain a batch of detection samples, which can be used for parallel detection by anomaly detection models.

[0069] In one specific embodiment, the anomaly detection model is constructed in S3 by referring to the following operations:

[0070] A1. Collect fabric sample images, label some defective samples, use the labeled defective samples and some normal samples as the test dataset, and use the remaining normal samples as the training dataset.

[0071] A2. Build a network model based on the multi-scale feature distillation model, input the training dataset mentioned in A1 into the model to train the network model, and test the network model with the test dataset to generate an anomaly detection model.

[0072] When performing anomaly detection using the anomaly detection model, the two large images to be detected, each 4096x1024 pixels, are cropped into eight 1024x1024 pixel images. These images are then resized to obtain eight 512x512 pixel images. These eight 512x512 pixel images are then stacked in a new dimension to obtain a batch of detection samples for parallel detection by the anomaly detection model.

[0073] In this embodiment, an anomaly detection model is constructed based on a multi-scale distillation model. This leverages the ease of training and high detection rate of the multi-scale distillation model. Furthermore, the image to be detected is cropped and scaled to 512x512 pixels, and parallel processing further reduces the detection time, thus achieving rapid detection of fabric defects. Of course, other anomaly detection models can be used in other embodiments, and are not limited to the multi-scale distillation model.

[0074] In one specific embodiment, the construction of the line defect detection model and the point defect detection model in S3 can be carried out by referring to the following operations:

[0075] B1. Collect sample images of various types of defects in fabrics, label the corresponding defect targets, construct linear and dot defect datasets respectively, and divide them into training datasets and test datasets.

[0076] B2. Based on the YOLOv5 network model, establish a line defect detection network and a point defect detection network respectively. Input the linear training dataset in B1 into the line defect detection network for training and test the network with the linear test dataset to generate a line defect detection model. Input the point training dataset in B1 into the point defect detection network for training and test the network with the test set to generate a point defect detection model.

[0077] Specifically, a line defect detection model and a point defect detection model can be constructed based on the YOLOv5m model and the YOLOv5s model, respectively. Of course, in other embodiments, other target detection models can also be used, and are not limited to the YOLOv5 model.

[0078] During detection, the two large images to be detected, each 4096x1024 pixels, are cropped into blocks with a 16-pixel overlap between adjacent blocks, resulting in 32 images of 526x520 pixels each. These images are then resized to obtain 32 images of 512x512 pixels each. These 32 images are then input into the line defect detection model and the point defect detection model for frame-by-frame detection.

[0079] In this embodiment, YOLOv5 models are used to construct linear and point models. The small size and good detection effect of YOLOv5 models can be used to improve the detection rate of broken yarn, small lint balls and small oil stains. At the same time, the crease detection results are used to filter out the crease detection results in the abnormal detection model to meet the actual industrial needs (in actual industry, creases are not fabric defects).

[0080] In a preferred embodiment, defects such as manually marked areas and long holes are detected using a traditional edge detection model, which can be based on the Canny operator. Of course, other edge detection methods can also be used in other embodiments, and are not limited to the Canny operator.

[0081] In one specific embodiment, such as Figure 2 As shown, the edge detection model based on the Canny operator for image detection can be performed by referring to the following operations:

[0082] C1. Perform a square transformation on the image to be detected to enhance the image edge characteristics.

[0083] I s =I⊙I / 255

[0084] Where I is the image, I s This is the result after square transformation, and ⊙ represents the matrix dot product.

[0085] C2. Apply Gaussian filtering to the image obtained in C1 to smooth out image noise.

[0086] Let the image be I s A 3x3 Gaussian kernel of size K is used for I. s Let there be a pixel e in the image, and let E be a 3x3 window centered on e. Then, the result e1 obtained after pixel e undergoes a 3x3 Gaussian filter is:

[0087] e1 = sum(E⊙K)

[0088]

[0089]

[0090] Here, sum() calculates the sum of matrix elements, and ⊙ represents matrix dot product. The filtered result of each element is obtained through the above calculation method.

[0091] C3, using the Sobel algorithm for the horizontal template S x and vertical template S y Calculate the horizontal and vertical gradients of the image obtained from C2.

[0092] Let the image after Gaussian filtering be I1. For pixel e1 in I1, let the 3x3 window centered on e1 be E1. Then the gradient magnitude G and gradient direction θ can be calculated using the following formula:

[0093]

[0094] G x =sum(E1⊙S x ),G y =sum(E1⊙S y )

[0095]

[0096] C4. Perform non-maximum suppression on the gradient obtained from C3 to remove non-edges and make the boundary clearer.

[0097] For each pixel, the obtained gradient direction is first approximated to the closest value in the {0, 45, 90, 135, 180, 225, 270, 315}. Then, the gradient values ​​G1 and G2 of two adjacent points along the gradient direction are compared to see if they are smaller than G. If they are, they are retained; otherwise, they are set to zero.

[0098] C5 uses a dual threshold to identify real and potential edges, forming potential anomalous regions.

[0099] like Figure 3 As shown, let the small threshold be T. min The large threshold is T max The dual threshold discrimination process is that the gradient of curve A is greater than T. max A1 is a strong edge, and the gradient of curve A is less than T. max A2 is a weak edge, and since it is adjacent to A1, it is also considered an edge. The gradient of curve B is less than T. max And greater than T min It belongs to a weak edge; it is not adjacent to a strong edge, therefore it is not considered an edge. The gradient of curve B is less than T. min Therefore, it does not belong to the edge.

[0100] C6. Perform 5x5 morphological dilation on the detection results obtained in C5 to connect closely spaced breakpoints; then find all contours and fill the interior of the contours; next, perform 7x7 morphological erosion on the filled results to find all eroded contours, forming defect categories that cannot be identified by the anomaly detection model and the target detection model, namely, defects such as artificial markings and long holes.

[0101] In this embodiment, an edge detection model based on the Canny operator is used. This can take advantage of the Canny operator's characteristics of not requiring prior training, fast computation, and strong robustness. At the same time, the size of the image to be detected can be calculated without cropping, which reduces the time consumption of the preprocessing process.

[0102] In a preferred embodiment, step S4 filters out crease detection results that are unnecessary for actual industrial use by standardizing the result format of each detection model, and also filters out false defects. In actual production, there are many good product samples that resemble foreign object defects in imaging but are not actually defects, such as creases. Deep creases are easily detected by anomaly detection models, but these models lack defect classification capabilities, significantly increasing the false detection rate. Therefore, it is necessary to filter out crease detection results from line defect detection models.

[0103] Line defect detection models are prone to misdetecting defects such as manually marked defects and long holes as creases. Therefore, when filtering out creases, it is also necessary to combine the detection results of edge detection models to avoid missed detections.

[0104] Finally, due to reasons such as the fabric inspection machine not fully flattening the fabric and uneven lighting in actual applications, the collected images of the fabric to be inspected contain false defects. It is necessary to obtain potential abnormal areas through the edge detection model and filter out the false defect detection results in the abnormality detection model.

[0105] In one specific embodiment, such as Figure 4 As shown, the process of standardizing the result format of various detection models, filtering out crease detection results that are not needed in actual industrial applications, and filtering out false defects can be referred to the following steps:

[0106] S41. Standardize the format of the detection results of the three models to obtain the coordinates of the upper left corner and the lower right corner of the detection box detected by each model.

[0107] S42. Filter out the detection boxes that do not intersect with the detection boxes formed by the potential abnormal regions obtained by the edge detection model to eliminate false defects.

[0108] S43. The overlap between the crease detection box obtained by the line defect detection model and the defect detection box obtained by the edge detection model is determined. When the overlap is higher than the set threshold, it is considered to be a false crease detection box of the line defect detection model and the defect is not filtered out.

[0109] S44. The overlap between the crease detection box obtained by the discrimination line defect detection model and the defect detection box of the anomaly detection model. If the overlap is higher than the set threshold, the defect is filtered out to remove the crease detection result.

[0110] S45. Merge the detection boxes of the anomaly detection model, the line defect detection model, and the point defect detection model after crease filtering together as the final detection result.

[0111] In this embodiment, by filtering out the crease detection boxes in the anomaly detection model, the false detection rate of defects is reduced. By using the detection boxes of the edge detection model, the false detection of defects caused by creases in the line defect detection model is avoided. Furthermore, by filtering out false defects through potential anomaly areas obtained by edge detection, the false detection rate of this method is further reduced.

[0112] Based on the same technical concept described above, another embodiment of the present invention provides a fabric defect detection system, comprising:

[0113] The data communication module is configured to receive fabric image data collected by the application software via the HTTP communication protocol, and transmit the detection results back to the application software via the HTTP communication protocol.

[0114] The image preprocessing module is configured to preprocess the image to be detected obtained by the data communication module according to the requirements of different detection models, and then use it as the input of the image detection module.

[0115] The image detection module is configured to use images with different preprocessing stages as inputs to anomaly detection models, target detection models, and edge detection models for defect detection.

[0116] The results post-processing module is configured to integrate the detection results from each model.

[0117] The logging module is configured to monitor and record the usage of the detection system. If the detection system is used abnormally, the information will be collected and stored in a local file.

[0118] The specific implementation techniques of each module in the above-described multi-model fusion discrimination fabric defect detection system embodiment of the present invention can be referred to the corresponding steps of the method, and will not be repeated here. The above-described embodiments of the present invention, through multi-model fusion discrimination, are beneficial to improving the defect detection rate and reducing the false detection rate, thereby meeting the defect detection requirements in large-scale automated industrial production and saving labor costs.

[0119] The computer-readable storage medium provided in this application is used to store a computer program, which, when executed by a processor, is used to implement the fabric defect detection method in the above embodiments.

[0120] Those skilled in the art will understand that embodiments of the present invention can be provided as methods or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied 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.

[0121] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0122] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0123] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0124] The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to substitute them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.

Claims

1. A method of detecting defects in a cloth, characterized by, The method comprises the following steps: S1, collecting a cloth image by application software and transmitting the image to a detection system; S2, preprocessing the image collected in step S1 according to the requirements of different detection models; S3, inputting the images after different preprocessing into an anomaly detection model, a target detection model and an edge detection model respectively for defect detection, wherein the line defect detection model and the point defect detection model jointly constitute the target detection model; the anomaly detection model is used to detect the number of defects in the image, the target detection model is used to detect the category of each defect in the image, and the edge detection model is used to obtain the defect category and the pseudo defect detection result which cannot be recognized by the anomaly detection model and the target detection model; S4, merging the detection results obtained by each detection model in step S3, and obtaining the final detection result after filtering out the crease detection result and the pseudo defect detection result; Step S2 specifically comprises: S21, after the image in S1 is subjected to preprocessing operations of standardization, block cropping, size transformation and parallel stacking, the image is inputted into the anomaly detection model; S22, after the image in S1 is subjected to preprocessing operations of standardization, block cropping with an overlapping area and size transformation, the image is inputted into the target detection model; S23, the image in S1 is directly inputted into the edge detection model; The step of obtaining the defect category and the pseudo defect detection result which cannot be recognized by the anomaly detection model and the target detection model by the edge detection model comprises: C1, constructing an edge detection model based on a Canny operator, and performing square transformation on the image inputted into the edge detection model; C2, performing Gaussian filtering on the image obtained in C1 to smooth image noise; C3, calculating the horizontal gradient and the vertical gradient of the image obtained in C2 by using a horizontal template Sx and a vertical template Sy of a Sobel algorithm; C4, performing non-maximum suppression on the gradient obtained in C3 to remove non-edges; C5, using a double-threshold judgment to obtain real edges and potential edges, and forming a potential anomaly area; C6, performing morphological dilation processing on the detection result obtained in C5, then finding all contours and filling the inside of the contours, then performing morphological erosion processing on the filling result, finding all eroded contours, and forming the defect category which cannot be recognized by the anomaly detection model and the target detection model.

2. The fabric defect detection method according to claim 1, wherein The step of constructing the anomaly detection model comprises: A1, collecting cloth sample images, labeling part of the defect samples, using the labeled defect samples and part of the normal samples as a test data set, and using the remaining normal samples as a training data set; A2, establishing a network model based on a multi-scale feature distillation model, inputting the training data set in A1 into the model to train the network model, testing the network model through the test data set, and generating an anomaly detection model.

3. The fabric defect detection method according to claim 1, wherein The step of constructing the target detection model comprises: B1, collecting sample images of each category of cloth defects, labeling corresponding defect targets, constructing line and point defect data sets respectively, and dividing training data sets and test data sets; B2, based on the preset neural network model, a line defect detection network and a point defect detection network are established, the line-shaped training data set in B1 is input into the line defect detection network for training and the network is tested by the line-shaped test data set to generate a line defect detection model; the point-shaped training data set in B1 is input into the point defect detection network for training and the network is tested by the test set to generate a point defect detection model.

4. The fabric defect detection method of claim 1, wherein Step S4 includes: S41, the detection results of the three models are unified in format to obtain the left upper corner coordinates and the right lower corner coordinates of the detection frames detected by each model; S42, the detection frame obtained by the anomaly detection model is filtered out from the detection frame formed by the potential anomaly area obtained by the edge detection model without intersection to eliminate pseudo defects; S43, the crease detection frame obtained by the line defect detection model is subjected to coincidence degree determination with the defect detection frame obtained by the edge detection model, and when the coincidence degree is higher than a set threshold, it is considered that the crease detection frame of the line defect detection model is false detection, and the defect is not filtered out; S44, the coincidence degree of the crease detection frame obtained by the line defect detection model and the defect detection frame of the anomaly detection model is determined, and if the coincidence degree is higher than a set threshold, the defect is filtered out to filter out the crease detection result; S45, the anomaly detection model detection frame, the line defect detection model detection frame and the point defect detection model detection frame after crease filtering are combined together as the final detection result.

5. A fabric defect detection system characterized by, Comprise: a data communication module configured to receive the cloth image data collected by the application software through the http communication protocol, and transmit the detection result back to the application software through the http communication protocol; an image preprocessing module configured to preprocess the to-be-detected image obtained by the data communication module according to the requirements of different detection models, and then input the image into the image detection module; an image detection module configured to input the images after different preprocessing into the anomaly detection model, the target detection model and the edge detection model respectively for defect detection; a result post-processing module configured to integrate the detection results of each model; a log module configured to monitor and record the use of the detection system, and if the detection system is used abnormally, information will be collected and stored in a local file; In the image preprocessing module, the steps of preprocessing the collected image include: after the image is subjected to standardization, block cropping, size transformation and parallel stacking preprocessing operations, the image is input into the anomaly detection model; after the image is subjected to standardization, block cropping with overlapping area setting and size transformation preprocessing operations, the image is input into the target detection model; the image is directly input into the edge detection model; The image detection module detects the number of defects in the image by the anomaly detection model, detects the category of each defect in the image by the target detection model, and obtains the defect category and the pseudo defect detection result that cannot be identified by the anomaly detection model and the target detection model by the edge detection model; and the step of obtaining the defect category and the pseudo defect detection result that cannot be identified by the anomaly detection model and the target detection model by the edge detection model comprises: C1, constructing an edge detection model based on a Canny operator, and performing square transformation on an image input by the edge detection model; C2, performing Gaussian filtering on the image obtained in C1 to smooth image noise; C3, calculating the horizontal gradient and the vertical gradient of the image obtained in C2 by using a horizontal template Sx and a vertical template Sy of a Sobel algorithm; C4, performing non-maximum suppression on the gradient obtained in C3 to remove non-edges; C5, using a double-threshold judgment to obtain real edges and potential edges, and forming a potential anomaly area; C6, performing morphological dilation on the detection result obtained in C5, then finding all contours, filling the inside of the contours, then performing morphological erosion on the filling result, finding all eroded contours, and forming the defect category that cannot be identified by the anomaly detection model and the target detection model.

6. An electronic device, comprising: The electronic device comprises a processor configured to implement the steps of the cloth defect detection method according to any one of claims 1-4 when executing a computer program stored in a memory.

7. A computer readable storage medium characterized in that, The computer program is stored in the memory and is configured to implement the steps of the cloth defect detection method according to any one of claims 1-4 when executed by the processor.

Citation Information

Patent Citations

  • Piece goods blemish detecting method based on morphological analysis

    CN103456021A

  • A method for identifying insulation board defects based on YOLOx_s enhanced target feature detection

    CN115049607B

  • Cloth defect detection method based on multi-modal fusion deep learning

    CN111028204A

  • Cloth linear defect detection method and system based on feature enhancement

    CN114881960A