A fabric defect detection model establishment method and a fabric defect detection method

Through the convolutional neural network with frequency domain augmentation processing and frequency domain channel attention mechanism, and combined with the cascade network, fabric defect detection is solved, and the problems of low efficiency and poor accuracy in traditional methods are achieved, and efficient and accurate fabric defect detection is achieved.

CN115661022BActive Publication Date: 2025-08-15WUHAN TEXTILE UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210737185.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-27
Publication Date
2025-08-15
Estimated Expiration
2042-06-27

AI Technical Summary

Technical Problem

In the prior art, fabric defect detection efficiency is low, high cost, and the detection results are susceptible to human factors. Traditional methods are sensitive to noise, limited to fabrics with regular textures or certain types of defects, and have poor applicability.

Method used

The convolutional neural network that uses frequency domain augmentation processing combined with the frequency domain channel attention mechanism is used for feature extraction, through pre-selected box screening and size adjustment, and the cascade network is used for defect classification and positioning, and model parameters are updated through backpropagation.

Benefits of technology

It improves the accuracy and accuracy of fabric defect detection, especially in the absence of data, and overcomes the problems of unbalanced sample number and low detection accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115661022B_ABST
    Figure CN115661022B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for establishing a fabric defect detection model and a fabric defect detection method. The method comprises the following steps: Step 1: obtaining fabric images corresponding to different defect types and performing frequency domain augmentation processing on the fabric images to obtain feature images with frequency domain preference characteristics; Step 2: extracting features from the feature images using a feature extraction network to obtain extracted features; Step 3: filtering and resizing preselected boxes based on the extracted features and target areas corresponding to the defects to obtain suggested boxes; Step 4: classifying and locating the defects using a preset cascade network based on the extracted features and suggested boxes; Step 5: repeating Steps 2 to 4, updating model parameters using a backpropagation method to obtain a fabric defect detection model. The technical solution of the present invention helps improve the accuracy and effectiveness of fabric defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer application technology, and in particular to a fabric defect detection model establishment method and a fabric defect detection method. Background Art

[0002] During the fabric production process, due to external environmental factors such as the production process, finished fabrics may contain defects, which can cause a 45%-65% drop in fabric price. Traditionally, fabric defects are often manually inspected by experienced personnel. However, manual inspection methods are not only inefficient and costly, but can also lead to missed inspections due to subjective factors, resulting in large fluctuations in test results.

[0003] Although automatic fabric defect detection methods have emerged, manual feature extraction is still required. They are generally sensitive to noise, limited to fabrics with regular textures or certain types of defects, and have low applicability. Summary of the Invention

[0004] In view of the deficiencies in the prior art, the present invention provides a fabric defect detection model, a fabric defect detection method and device, and a storage medium.

[0005] In a first aspect, the present invention provides a method for establishing a fabric defect detection model, the method comprising the following steps:

[0006] Step 1: Obtain fabric images corresponding to different defect types, and perform frequency domain augmentation processing on the fabric images to obtain feature images with frequency domain preference characteristics;

[0007] Step 2: extracting features from the feature image using a feature extraction network to obtain extracted features, wherein the feature extraction network includes a convolutional neural network combined with a frequency domain channel attention mechanism;

[0008] Step 3: Filter and resize the pre-selected box according to the extracted features and the target area corresponding to the defect to obtain a suggested box, wherein the pre-selected box is a box of a preset size set for each pixel of the feature image;

[0009] Step 4: Based on the extracted features and the suggested boxes, the defects are classified and located through a preset cascade network;

[0010] Step 5: Repeat steps 2 to 4, and use the back propagation method to update the model parameters to obtain a fabric defect detection model.

[0011] In a second aspect, the present invention provides a device for establishing a fabric defect detection model, which includes a memory and a processor; the memory is used to store a computer program; the processor is used to implement the fabric defect detection model establishment method described above when executing the computer program.

[0012] In a third aspect, the present invention provides a method for detecting fabric defects, the method comprising the following steps:

[0013] Acquire a fabric image, and perform frequency domain augmentation processing on the fabric image to obtain a feature image with frequency domain preference characteristics;

[0014] The feature image is input into the fabric defect detection model established according to the fabric defect detection model establishment method as described above to obtain a fabric defect detection result.

[0015] In a fourth aspect, the present invention provides a fabric defect detection device, which includes a memory and a processor; the memory is used to store a computer program; the processor is used to implement the fabric defect detection method described above when executing the computer program.

[0016] In a fifth aspect, the present invention provides a computer-readable storage medium, characterized in that it stores a computer program, which, when executed by a processor, implements the above-mentioned method for establishing a fabric defect detection model, or implements the above-mentioned method for detecting fabric defects.

[0017] In the present invention, the method is applicable to fabric defects caused by changes in production conditions and other aspects. It can overcome the problems of unbalanced sample quantity, low fabric defect detection accuracy and poor positioning accuracy commonly found in current fabric defect detection methods, and performs well in fabric defect detection with scarce data. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0019] Figure 1 A schematic flow chart of a method for establishing a fabric defect detection model according to an embodiment of the present invention;

[0020] Figure 2 is a schematic diagram of a fabric defect detection process according to an embodiment of the present invention;

[0021] Figure 3A schematic flow chart of a method for establishing a fabric defect detection model according to another embodiment of the present invention;

[0022] Figure 4 Schematic diagram of the process of the fabric defect detection method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0023] The principles and features of the present invention are described below with reference to the accompanying drawings. The examples given are only used to explain the present invention and are not used to limit the scope of the present invention.

[0024] like Figure 1 As shown, a method for establishing a fabric defect detection model according to an embodiment of the present invention includes the following steps:

[0025] Step 1: Obtain fabric images corresponding to different defect types, and perform frequency domain augmentation processing on the fabric images to obtain feature images with frequency domain preference characteristics.

[0026] Specifically, in this embodiment, the Tianchi Xuelang manufacturing dataset can be used, which contains 1,168 defective images and 2,163 normal images. Each image contains at least one defect, and each image is sized at 2,560 × 1,920 pixels. It covers 59 categories of textile fabric defects, representing a total of 9 categories. After merging similar categories and discarding rare categories, the dataset is ultimately divided into 9 categories. Furthermore, the cleaned samples are divided into training, validation, and test sets in an 8:1:1 ratio, with at least 100 training samples for each defect type.

[0027] In addition, the original fabric image is augmented in the frequency domain so that the feature image has a frequency domain preference, so that the deep learning model can learn the relevant preference and have a better expression effect.

[0028] Step 2: Use a feature extraction network to extract features from the feature image to obtain extracted features, wherein the feature extraction network includes a convolutional neural network combined with a frequency domain channel attention mechanism.

[0029] Specifically, the frequency domain channel attention mechanism is integrated with the convolutional neural network to make the features extracted by the model more diverse and more focused on the defect parts in the image, enhancing the ability to extract subtle features in complex backgrounds, thereby further improving the detection performance of fabric defects.

[0030] Step 3: Screen and resize the pre-selected box according to the extracted features and the target area corresponding to the defect to obtain a suggested box, wherein the pre-selected box is a box of a preset size set for each pixel point of the feature image.

[0031] Specifically, by adjusting the size and proportion of the pre-selected box and screening it, the suggested box is obtained, which can be cropped to a uniform size for feature extraction through multi-scale training. The extraction network is combined with the frequency domain channel attention mechanism to make the extracted features more diverse and more concentrated in the target area, and a certain detection accuracy can be guaranteed even with a smaller sample size.

[0032] Step 4: Based on the extracted features and the suggested boxes, the defects are classified and located through a preset cascade network.

[0033] Specifically, the output of the preset cascade network is also the output of the subsequently obtained fabric defect detection model, which reflects the classification and positioning of fabric defects, that is, the fabric defect detection result, which can help to quickly and accurately determine the type and location of fabric defects.

[0034] Step 5: Repeat steps 2 to 4, and use the back propagation method to update the model parameters to obtain a fabric defect detection model.

[0035] Specifically, when training the model, the stochastic gradient descent method can be used for back propagation to update the model parameters, and the iterations can be repeated multiple times until the corresponding conditions are met. All the model parameters are saved to obtain the fabric defect detection model.

[0036] In this embodiment, the method is applicable to fabric defects caused by changes in production conditions and other aspects. It can overcome the common problems of unbalanced sample size, low fabric defect detection accuracy and poor positioning accuracy in current fabric defect detection methods, and performs well in fabric defect detection with scarce data.

[0037] Optionally, performing frequency domain augmentation processing on the fabric image to obtain a feature image with frequency domain preference characteristics includes:

[0038] Fourier transform is performed on the single-channel pixel matrix of the fabric image and then centered to obtain a relatively low-frequency pixel matrix close to the center and a relatively high-frequency pixel matrix far from the center.

[0039] Specifically, a fabric image typically contains three channels (RGB). Let the pixel matrix of a single channel be x. First, perform a Fourier transform on x and center it, making the pixel matrix near the center relatively low-frequency and the pixel matrix near the periphery relatively high-frequency.

[0040] A circular area is determined by using the center of gravity of the relatively high-frequency pixel matrix and a preset radius, and relatively low-frequency information and relatively high-frequency information are determined according to the circular area.

[0041] Specifically, a circle is drawn with the center of gravity of y as the center and r as the radius. The relatively low-frequency information y is inside the circle. l , the outside of the circle is the relatively high-frequency information y h, described by the formula:

[0042]

[0043]

[0044] Where (i, j) represents the value of position (i, j) in pixel matrix y, (I i ,I j ) represents the centroid of y, and d() represents the function that calculates the distance between two vectors.

[0045] Performing an inverse Fourier transform on the relatively low-frequency information or the relatively high-frequency information to obtain the feature image with frequency domain preference characteristics.

[0046] Specifically, the relatively low-frequency information y l (or relatively high frequency information y h ) After an inverse Fourier transform, we can obtain the pixel matrix x' containing the frequency domain preference. Performing the same operation on each channel separately can obtain the feature image.

[0047] Optionally, extracting features from the feature image using a feature extraction network includes:

[0048] The feature map obtained by downsampling the convolutional neural network is divided into a plurality of parts that are divisible by the channel according to the channel dimension.

[0049] Specifically, a calibrated number of feature images, preferably 16, are fed into a feature extraction network consisting of a ResNet50 network combined with a frequency-domain channel attention mechanism, with parameters initialized using weights pre-trained on ImageNet. The frequency-domain channel attention mechanism refers to combining a 2D discrete cosine transform with channel attention.

[0050] More specifically, for the feature map X obtained in the convolutional neural network downsampling, it is first divided into n parts that are divisible by the channel according to the channel dimension, and each part can be expressed as [X 0 ,X 1 ,…,X n-1 ].

[0051] For each part, two-dimensional discrete cosine transform is used to convert it into multiple frequency domain components.

[0052] Specifically, for each part X i , converted into 7×7 block frequency domain components using two-dimensional discrete cosine transform.

[0053] Each of the frequency domain components is tested separately as a result of the channel attention processing, and the frequency domain result that meets the preset standard is selected as the final channel attention preprocessing result.

[0054] Specifically, each frequency domain component is tested as the result of channel attention processing, and the top-16 performance frequency domain results Freq i As the preprocessing result of the final channel attention.

[0055] All the preprocessing results are sequentially connected by channel to obtain preprocessing frequency domain components.

[0056] Specifically, all preprocessing results are connected in sequence by channel to obtain the final preprocessing frequency domain component Freq, which can be expressed as:

[0057] Freq=cat([Freq 0 ,Freq 1 ,…,Freq n-1 ]).

[0058] It can be seen that the extracted features are frequency domain features.

[0059] Optionally, the aspect ratio of the pre-selected box includes: 0.02, 0.1, 0.2, 0.5, 1, 2, 5, 10 and 50.

[0060] Specifically, a pre-selected box of different proportions and sizes is preset for each pixel of the input image. The aspect ratio of the pre-selected box is adjusted to 0.02, 0.1, 0.2, 0.5, 1, 2, 5, 10 and 50 according to the sample target box format. The pre-selected box is screened and adjusted according to the extracted features and target area in step S2 to obtain 2000 suggested boxes with higher accuracy after adjustment.

[0061] Optionally, the preset cascade network includes three R-CNN networks, wherein the IoU thresholds of the three R-CNN networks are different.

[0062] Optionally, the IoU thresholds of the three R-CNN networks are 0.5, 0.6 and 0.7 respectively.

[0063] Specifically, if Figure 2 As shown in the figure, the input image is first processed by frequency domain augmentation, and then passes through a convolutional neural network combined with a frequency domain channel attention mechanism to obtain extracted features. The final proposal box (Proposals) obtained by combining it with the pre-selected box then enters the cascade network, which includes three R-CNN networks. After the data enters each network, it first passes through the ROI pooling layer, and then classification and regression are performed, and the regression result of the adjacent previous network enters the ROI pooling layer of the adjacent subsequent network.

[0064] During model training, repeat steps S2 through S4 to update the model. Stochastic gradient descent (SGD) is used for backpropagation to update model parameters. The initial learning rate is 0.0025, the weight decay factor is 0.0001, and the momentum is set to 0.9. The base model is trained for 70 iterations, with the learning rate reduced at the 40th and 60th iterations, respectively. Subsequent models can be adjusted based on the base model, with 12 or 24 iterations selected as appropriate.

[0065] like Figure 3 As shown, a specific example is given below to introduce it.

[0066] The fabric images corresponding to different defect types, or the labeled training images, are frequency-domain augmented. Initialize i=0 and determine whether i>iteration holds, that is, whether iteration has been repeated. If not, batch_size sample images are extracted from the training set and the training samples are input into ResNet50 combined with frequency-domain channel attention to extract features. The suggestion box is adjusted according to the preset pre-selected box. The defect classification and regression results are generated by combining the extracted features and the suggestion box in a cascade manner. During the iteration process, i+1 is continuously achieved until i>iteration. At this time, the model-related parameters are saved to obtain the fabric defect detection model.

[0067] To verify the effectiveness of the improved cascaded convolutional neural network based on frequency domain processing proposed in this paper, ablation experiments were conducted on the basic networks Faster R-CNN and Cascade R-CNN. The experimental results are shown in Table 1. The method improves the inspection accuracy of the basic network on the Tianchi Xuelang manufacturing dataset, which has fewer samples but a wider variety of samples, by 16.5% on Faster R-CNN and 8.4% on Cascade R-CNN, reaching 55.8 mAP. By leveraging frequency domain features and the advantages of deep learning methods, the method achieves significant performance in fabric defect detection.

[0068] Table 1

[0069]

[0070]

[0071] It should be noted that “√” in Table 1 indicates that the model adopts the corresponding settings, for example, the training set is subjected to frequency domain augmentation, and the blank part indicates that the model does not adopt the corresponding settings.

[0072] In another embodiment of the present invention, a fabric defect detection model establishment device includes a memory and a processor; the memory is used to store a computer program; the processor is used to implement the fabric defect detection model establishment method described above when executing the computer program.

[0073] It should be noted that the device may be a computer device such as a server or a mobile terminal.

[0074] In another embodiment of the present invention, a computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned method for establishing a fabric defect detection model is implemented.

[0075] like Figure 4 As shown, a fabric defect detection method according to an embodiment of the present invention includes the following steps:

[0076] A fabric image is obtained, and frequency domain augmentation processing is performed on the fabric image to obtain a feature image with frequency domain preference characteristics.

[0077] Specifically, the fabric image can be preprocessed, using the frequency domain augmentation process described above. In this case, the fabric image does not have a label, but can instead be, for example, a real-time image with detection. Furthermore, the aforementioned validation and test sets can also be used to validate and test the model.

[0078] The feature image is input into the fabric defect detection model established according to the fabric defect detection model establishment method as described above to obtain a fabric defect detection result.

[0079] Specifically, the fabric defect detection results mainly include the classification and location of fabric defects, which can help to quickly and accurately determine the type and location of fabric defects.

[0080] In another embodiment of the present invention, a fabric defect detection device includes a memory and a processor; the memory is used to store a computer program; and the processor is used to implement the fabric defect detection method described above when executing the computer program.

[0081] It should be noted that the device may be a computer device such as a server or a mobile terminal.

[0082] In another embodiment of the present invention, a computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the fabric defect detection method described above is implemented.

[0083] The reader should understand that in the description of this specification, reference to the terms "one embodiment", "some embodiments", "examples", "specific examples" or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, different embodiments or examples described in this specification and features of different embodiments or examples can be combined and combined by those skilled in the art without contradiction.

[0084] Although the embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and are not to be construed as limitations on the present invention. A person skilled in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.

Claims

1. A method for establishing a fabric defect detection model, characterized in that: include: Step 1: Obtain fabric images corresponding to different defect types, and perform frequency domain augmentation processing on the fabric images to obtain feature images with frequency domain preference characteristics; Step 2: extracting features from the feature image using a feature extraction network to obtain extracted features, wherein the feature extraction network includes a convolutional neural network combined with a frequency domain channel attention mechanism; Step 3: Filter and resize the pre-selected box according to the extracted features and the target area corresponding to the defect to obtain a suggested box, wherein the pre-selected box is a box of a preset size set for each pixel of the feature image; Step 4: Based on the extracted features and the suggested boxes, the defects are classified and located through a preset cascade network; Step 5, repeating steps 2 to 4, updating the model parameters using a back propagation method to obtain a fabric defect detection model; The performing frequency domain augmentation processing on the fabric image to obtain a feature image with frequency domain preference characteristics comprises: Performing Fourier transform and centering processing on a single-channel pixel matrix of the fabric image to obtain a relatively low-frequency pixel matrix close to the center and a relatively high-frequency pixel matrix far from the center; Determine a circular area using the center of gravity of the relatively high-frequency pixel matrix and a preset radius, and determine relatively low-frequency information and relatively high-frequency information based on the circular area; Performing an inverse Fourier transform on the relatively low-frequency information or the relatively high-frequency information to obtain the feature image having a frequency domain preference feature; The extracting features from the feature image using a feature extraction network includes: Dividing the feature map obtained by downsampling the convolutional neural network into a plurality of parts divisible by the channel according to the channel dimension; For each part, two-dimensional discrete cosine transform is used to convert it into multiple frequency domain components; Testing each of the frequency domain components as a result of channel attention processing, and selecting a frequency domain result that meets a preset standard as a final channel attention preprocessing result; Connect all the preprocessing results in sequence by channel to obtain preprocessing frequency domain components; The preset cascade network includes three R-CNN networks, wherein the IoU thresholds of the three R-CNN networks are different.

2. The method for establishing a fabric defect detection model according to claim 1, wherein: The aspect ratios of the pre-selected box include: 0.02, 0.1, 0.2, 0.5, 1, 2, 5, 10 and 50.

3. The method for establishing a fabric defect detection model according to claim 1, wherein: The IoU thresholds of the three R-CNN networks are 0.5, 0.6 and 0.7 respectively.

4. A fabric defect detection model building device, characterized in that: including memory and processor; The memory is used to store computer programs; The processor is configured to implement the method for establishing a fabric defect detection model according to any one of claims 1 to 3 when executing the computer program.

5. A fabric defect detection method, characterized in that: include: Acquire a fabric image, and perform frequency domain augmentation processing on the fabric image to obtain a feature image with frequency domain preference characteristics; The feature image is input into a fabric defect detection model established according to the fabric defect detection model establishment method according to any one of claims 1 to 3 to obtain a fabric defect detection result.

6. A fabric defect detection device, characterized in that: including memory and processor; The memory is used to store computer programs; The processor is configured to implement the fabric defect detection method according to claim 5 when executing the computer program.

7. A computer-readable storage medium, characterized in that A computer program is stored, and when the computer program is executed by a processor, the method for establishing a fabric defect detection model according to any one of claims 1 to 3 is implemented, or the fabric defect detection method according to claim 5 is implemented.