Print cloth defect classification model training method and print cloth defect detection method

Through machine learning-based methods, multiple features are extracted and SVM classifiers are used to train a defect classification model, which solves the problem of low accuracy in defect detection in complex printed patterns in the prior art, and achieves efficient and accurate defect classification and real-time feedback.

CN120198727APending Publication Date: 2025-06-24PEKING UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510269802.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-07
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

The prior art has low accuracy when detecting defects in complex printing patterns, making it difficult to accurately classify various types of defects, resulting in high error detection rates and missed detection rates.

Method used

Real-time image defect detection and classification method based on machine learning is adopted, and a defect classification model is trained to achieve accurate classification of different types of defects by extracting multiple features (color features, texture features and shape features) and combining with SVM classifiers.

Benefits of technology

It realizes efficient and accurate image defect classification, provides a fast and automated classification and feedback mechanism, helps the production line to adjust the process in a timely manner and reduces the production of defective products.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120198727A_ABST
    Figure CN120198727A_ABST
Patent Text Reader

Abstract

The invention relates to a print cloth defect classification model training method and a print cloth defect detection method, and belongs to the field of image processing and defect detection in a digital printing technology. The invention provides a printed cloth defect classification model training method, which comprises the following steps: acquiring a data set which comprises defect images and category labels corresponding to the defect images; extracting color features, texture features and shape features of the flaw image in parallel; the texture features are extracted through wavelet transform and a gray level co-occurrence matrix; and inputting the color features, the texture features, the shape features and the corresponding category labels into an SVM classifier for training to obtain a trained flaw classification model. The invention further provides a printed cloth defect detection method. The printed cloth defect detection method comprises the step of carrying out classified detection on printed cloth defects by using the defect classification model trained by the method. The model provides a rapid and automatic classification and feedback mechanism to help the production line to adjust the process in time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a defect classification model training method for printed cloth and a defect detection method for printed cloth, and belongs to the field of image processing and defect detection in digital printing technology. Background Art

[0002] With the rapid development of digital printing technology, especially in precision pattern printing, traditional manual detection methods can no longer meet the requirements of efficiency and accuracy. Currently, most defect detection systems rely on threshold-based image processing technology, but these methods have low detection accuracy when facing complex and changing patterns, and it is difficult to accurately classify various types of defects. Especially for complex printed patterns, traditional detection methods cannot accurately distinguish different types of defects, resulting in high false detection rates and missed detection rates.

[0003] Most defect detection methods in the existing technology are limited to detecting whether there are defects, but lack effective classification and feedback mechanisms for the types and properties of defects and how to make production adjustments based on this information. The response speed and accuracy of existing systems for real-time defect detection also need to be improved.

[0004] Therefore, how to achieve real-time and efficient image defect detection and accurate classification has become a key issue to be solved in the field of digital printing. The present invention proposes a real-time image defect detection and classification method based on machine learning. By extracting multiple features and combining a trained classification model, it can accurately classify different types of defects and provide real-time feedback for subsequent production.

[0005] Chinese invention patent application 202411704402X "Defect Detection Method for Printed Cloth" discloses a defect detection method for printed cloth. The present invention is incorporated in its entirety into this application. Based on the patent application, the present invention further classifies and detects different types of defects. Summary of the invention

[0006] The purpose of the present invention is to provide a defect classification model training method and a defect detection method for printed cloth, which can combine real-time image acquisition and preprocessing, traditional image processing algorithms, detect image defects in the production line in real time, and classify and process the detected defects, providing real-time feedback for the production process, thereby improving production efficiency and product quality. The method can not only detect the existence of defects, but also accurately identify the defect type and adjust the production process in a timely manner.

[0007] The present invention provides a method for training a defect classification model for printed cloth, comprising:

[0008] Acquire a data set, the data set comprising defect images and category labels corresponding to the defect images;

[0009] Extract the color features, texture features, and shape features of the defective images in parallel; the texture features are extracted by wavelet transform and gray-level co-occurrence matrix;

[0010] Input the color features, the texture features, the shape features, and the corresponding class labels into an SVM classifier for training to obtain a trained defective classification model.

[0011] Further, obtain defective images by the following method: collect images of the printed fabric to be detected, and determine the height of the repeat pattern; intercept an image containing n repeat patterns from the collected images as a standard image, where n≥1; convert the standard image into the Lab color space and extract the L channel to obtain a first image; segment the first image to obtain first image subgraphs, and statistically save the sum of the pixel values of each column of the first image subgraphs; obtain at least one image to be detected of the printed fabric from the collected images; the height of the image to be detected is the same as that of the standard image; convert the image to be detected into the Lab color space and extract the L channel to obtain a second image; segment the second image to obtain second image subgraphs, and statistically save the sum of the pixel values of each column of the second image subgraphs; detect defects of the printed fabric based on the sum of the pixel values of each column of the first image subgraphs and the sum of the pixel values of each column of the second image subgraphs, so as to determine the defective images containing defects.

[0012] Further, the defective classification model adopts a streaming classification architecture; for one repeat pattern corresponding to one defective image, at least three computing units are configured.

[0013] Further, extract the color features based on the BGR channels, and extract the shape features based on the Canny edge detection algorithm.

[0014] Further, a weighted algorithm is adopted during extraction to weight different feature weights.

[0015] Further, the class labels include scratches, stains, draw marks, color unevenness, and overprint deviation.

[0016] The present invention also provides a method for detecting defects of printed fabric, including:

[0017] Use the defective classification model trained by the above method to classify and detect defects of the printed fabric.

[0018] Further, the defective classification model is fine-tuned through incremental learning.

[0019] The present invention also provides an electronic device, including a memory and a processor, where the memory stores a computer program, the computer program is configured to be executed by the processor, and the computer program includes instructions for any of the above methods.

[0020] The present invention also provides a storage medium storing a computer program, which, when executed by a computer, implements any of the above methods.

[0021] The beneficial effects of the present invention are as follows:

[0022] Through model training and defect image classification, the present invention can provide an efficient and accurate image defect classification function. The model provides a fast and automated classification and feedback mechanism to help the production line adjust the process in a timely manner and reduce the production of defective products. Through continuous optimization and adaptive learning, the system can continuously improve the accuracy of detection and classification and adapt to changes in the production environment.

[0023] 1. Strong real-time performance: It can collect images in real time on the production line, perform real-time defect detection and classification, quickly feedback production information, and adjust the production process in a timely manner.

[0024] 2. High accuracy and precision: By extracting multi-dimensional features of the image and combining with the SVM algorithm, it can accurately distinguish different types of defects, improve the precision of detection, and reduce the false detection rate and missed detection rate.

[0025] 3. Strong adaptive ability: The classification model of the present invention can be continuously trained and optimized, not only can it handle different types of defects, but also can be continuously adjusted according to the changes in actual production to ensure the adaptability and stability of the system.

[0026] 4. Classification and real-time feedback: The present invention can not only detect the existence of defects, but also accurately classify different types of defects and feedback the classification results to the production process in real time, providing accurate decision-making for subsequent production and reducing resource waste and production costs.

[0027] 5. Subsequent learning and optimization: By continuously optimizing each classification result, the system can be fine-tuned during each classification process, gradually improving the accuracy of classification and enhancing the long-term reliability of the system. Description of the Drawings

[0028] Figure 1 It is a flowchart of an embodiment of the present invention.

[0029] Figure 2 It is a defective image with defects in an embodiment of the present invention. Detailed Embodiments

[0030] The following further describes the present invention in detail with reference to the drawings. The examples given are only used to explain the present invention and are not intended to limit the scope of the present invention. The specific process of this embodiment is as Figure 1 shown.

[0031] S100 Obtain a data set

[0032] This step uses the method of the Chinese invention patent application 202411704402X, "Defect Detection Method for Printed Fabrics", to collect images on the production line in real time through the system, and detects the defect area through image processing methods, so that the subsequent classification module can identify different defect types.

[0033] S110 Real-time Image Acquisition

[0034] To ensure the quality and stability of the collected images, the present invention uses a line array camera to continuously collect images of the printed fabrics on the production line, and ensures the consistency of the collected images through the production line synchronization mechanism and the image acquisition frequency matching method. In the production line synchronization mechanism, the operation of the production line is driven by rollers, and the rollers are equipped with encoders that can generate regular electrical signals. After these signals are transmitted to the detection system, the system can calculate the running speed of the production line. In the image acquisition frequency matching mechanism, the system dynamically adjusts the acquisition frequency of the camera according to the speed of the production line to ensure that the images collected by the camera will not be longitudinally stretched or scaled, thereby maintaining the consistency of the images and improving the accuracy of subsequent defect detection.

[0035] S120 Standard Image Judgment

[0036] The design of printed fabrics usually contains periodically repeated pattern units, that is, "pattern repeats". After the production line starts and reaches a stable operating state, the system will automatically select the first image after the production line runs stably as the standard image, which is used as a reference for subsequent defect detection. The method for obtaining the standard image is as follows:

[0037] Extract a complete pattern repeat area from the standard image and store it as the standard image.

[0038] Adopt the template matching algorithm, extract a small area from the upper left corner of the standard image as the search template, and search within the corresponding enlarged image range on the left side of the image to find the best matching position and calculate the height of the pattern repeat.

[0039] In this way, the system can collect images in units of pattern repeats in subsequent image acquisitions, ensuring that each collected image corresponds to the standard image, thereby improving the detection accuracy and reducing misjudgment.

[0040] S130 Real-time Defect Detection

[0041] After the image is collected and the comparison relationship with the standard image is established, the system enters the real-time defect detection stage. The system uses the pixel statistics method to quickly analyze the currently collected image to determine whether there are defects.

[0042] Calculate the histogram of the currently acquired image and calculate the similarity with the histogram of the standard image. If the histogram similarity is lower than the set threshold, it indicates that the fabric may have been changed on the production line. At this time, the standard image needs to be reselected. Otherwise, continue with the defect detection.

[0043] Process the L channel (luminance channel) of the current image, calculate the sum of pixels in each column, and compare it with the corresponding column of the standard image. Then, use the sliding window method to compare the pixel sum of the current pixel column and several columns before and after it to reduce the error caused by the horizontal offset of the image.

[0044] Outlier analysis: Calculate the Z-score value of each column of pixels to measure the degree of deviation from the standard image. If the Z-score value of a certain column exceeds the set threshold, it is considered that there is a defect in that column.

[0045] Further screen out the area where the Z-score values of k consecutive columns are abnormal, and finally determine the defect area and output the defect image, as Figure 2 shown. In Figure 2 , the left figure is the standard image, the middle figure is the image to be detected, and the right figure is the schematic diagram of the corresponding detected defect.

[0046] S200 Build the monitoring architecture

[0047] To ensure real-time monitoring on the industrial production line, the present invention uses a streaming processing architecture to process large-scale image data streams. The streaming processing architecture allows each defect image to immediately enter the processing queue after being acquired, without waiting for the accumulation of all defect images. Specifically, by designing a streaming data pipeline, each image can pass through a series of processing steps and output results in real time. The input and output of each processing stage are continuously flowing, without waiting for the accumulation of batch data, thereby improving the real-time performance of the overall system.

[0048] I t represents the image acquired at time t, and P pipeline (·) is the streaming processing pipeline, and the processing process is as follows:

[0049] P pipeline (I t ) = f preprocess (f feature (f classify (I t )))

[0050] where f preprocess , f feature , f classify are the preprocessing, feature extraction, and classification steps respectively. Streaming processing allows each step to be seamlessly connected when the image data stream passes through.

[0051] S300 Feature Extraction

[0052] In the traditional real-time image processing pipeline, image preprocessing and feature extraction are usually executed serially, which causes bottlenecks and affects real-time performance. By parallelizing these steps, the present invention can significantly improve the processing speed and adapt to high-frequency image acquisition. Specifically, the parallelization design divides the defective image into multiple regions and simultaneously processes the images of different regions on multiple computing units, enabling multiple image preprocessing tasks to be executed concurrently, including denoising, color normalization, and contrast enhancement. For each region, multiple computing units are adapted, and each computing unit is responsible for one type of feature extraction.

[0053] Image I is segmented into N sub-regions, and the parallel processing process can be expressed as:

[0054]

[0055] where I i is the image of the i-th sub-region, and f i (·) is the preprocessing and feature extraction operation for this sub-region.

[0056] When performing parallel feature extraction, the feature calculation formulas for each sub-task are as follows:

[0057]

[0058] where Feature i is the feature extracted by the i-th processing unit.

[0059] S310 Color Feature Extraction

[0060] Traditional color feature extraction generally relies on the mean and standard deviation of the BGR channels of the image. To enhance the flexibility and accuracy of color feature extraction, the present invention adopts a method of adaptive color contrast adjustment. It is dynamically adjusted according to each region, thereby improving the sensitivity to complex patterns or subtle color differences. By calculating the color contrast of each region of the image and using weighted mean and standard deviation, the extraction of color features becomes more adaptable to different pattern backgrounds.

[0061]

[0062] where x i represents the pixel value of the local region, n is the number of pixels in this local region, μ local and σ local are the local region mean and standard deviation respectively. The local mean μ local describes the average brightness or color of the local region of the image. The local standard deviation σ local measures the volatility of pixel values in the local region of the image, that is, the color difference or brightness difference in this region.

[0063] Local contrast generally refers to the degree of light and dark contrast in a certain area of an image, which reflects the difference or variability of the pixel value distribution within that area. It is defined as the ratio of the standard deviation to the mean, representing the degree of brightness change in that area. It can reflect the color or light and dark changes in the local area of the image.

[0064] Then, dynamically adjust the weights of the color channels according to the calculated local contrast:

[0065] w adjusted = w original ×(1 + λ × contranst)

[0066] where λ is the adjustment coefficient, contranst is the contrast value of the local area, w original is the initial weight, and w adjusted is the weight after dynamic adjustment.

[0067] When the local contrast is high, contranst > 0.5 and contranst tends to a larger value, the increment of the weight, λ·contranst, becomes smaller, reducing the influence on the color channels.

[0068] When the local contrast is low, for example, contranst < 0.2, the weight increment becomes larger, increasing the influence on the color channels and enhancing the color sensitivity of that area.

[0069] To prevent the weights from being over-adjusted, resulting in over-enhancement or over-suppression, a threshold range is set to limit the adjustment range of the weights. The weight adjustment is restricted within a reasonable range:

[0070] min_weight ≤ w adjusted ≤ max_weight

[0071] where min_weight and max_weight are the preset minimum and maximum weight values, used to prevent the weights from being over-amplified or over-reduced.

[0072] S320 Texture Feature Extraction

[0073] The gray-level co-occurrence matrix (GLCM) is a classic method for extracting texture features. However, for the diversity of complex patterns and defects, multi-scale texture analysis can more effectively capture the detailed texture changes. The present invention combines the gray-level co-occurrence matrix with wavelet transform to extract texture features at different scales.

[0074] First, decompose the image into sub-images of multiple set scales through wavelet transform to capture multi-scale information. Then, calculate the gray-level co-occurrence matrix at each scale and extract texture features.

[0075]

[0076] Among them, W j,k (x, y) is the sub-image of wavelet transform, h j,k (m, n) is the wavelet filter, and I(m, n) is the pixel value of the original image.

[0077] Then calculate the GLCM at each scale,

[0078]

[0079] where P(i, j, d, θ) is the probability of the gray-level co-occurrence matrix, d is the distance between pixels, and θ is the direction.

[0080] Finally, extract the texture features.

[0081] Contrast:

[0082]

[0083] Energy:

[0084]

[0085] Homogeneity:

[0086]

[0087] S330 Shape Feature Extraction

[0088] Although traditional shape feature extraction methods such as the Canny edge detection method are effective, for some complex or irregular defects, morphological operations can provide better shape restoration and enhancement effects. The present invention combines morphological operations and edge detection to enhance the contour information of the defects, thereby improving the extraction accuracy of shape features. Specifically, morphological operations are used to remove noise and enhance the defect edges, so as to obtain clearer shape features, mainly using dilation and erosion operations:

[0089]

[0090] Among them, and respectively represent the erosion and dilation operations. I(x, y) is the original image, and B is the structure element. By performing morphological dilation on the edge image, the defect edges are enhanced to obtain more stable shape information, thereby improving the classification accuracy.

[0091] The Canny edge detection algorithm detects edges in the image through the following steps:

[0092] 1. Gaussian filtering: Apply Gaussian filtering to the image to reduce the influence of noise.

[0093] G(x,y) = I(x,y) * σ(x,y)

[0094] Where G(x,y) is the filtered image, I(x,y) is the input image, and * is the convolution operation.

[0095] 2. Calculate gradients: Calculate the gradient magnitude and direction of each pixel in the image:

[0096]

[0097] 3. Non-maximum suppression: Perform non-maximum suppression at each pixel point to ensure that only edge points are left at the positions with the maximum gradients.

[0098] 4. Double-threshold detection and edge connection: Use two thresholds for edge connection to determine strong edges and weak edges in the image.

[0099] S340 Dynamic adjustment

[0100] Traditional feature extraction methods usually use fixed feature selection strategies. This invention adopts an adaptive feature selection method, which dynamically adjusts the feature weights according to the color features, texture features, and shape features of the image to improve the detection effect of different types of defects. Specifically, by analyzing the influence of each feature on the classification performance at different times of the image, a weighted algorithm is used to dynamically select and weight different features, thereby improving the robustness of the model.

[0101]

[0102] Where f i is the i-th feature, ω i is the weight of this feature, which is dynamically adjusted according to the importance of the feature in the current image.

[0103] The rule for dynamically adjusting the feature weights is to calculate the statistical information of each feature in the image and dynamically adjust the weights according to the distribution of the features. The specific adjustment rules include:

[0104] 1. Feature variance or standard deviation

[0105] The variance or standard deviation of a feature can usually reflect the variability of the feature in the image. If the standard deviation of a certain feature is large, it means that the feature has a high variability in the image and may provide more information. Therefore, a higher weight can be given to the feature with a larger variance.

[0106] The specific formula is:

[0107]

[0108] Among them, σ i is the standard deviation of the i-th feature, and ω i is the dynamic weight of this feature. The calculation method of this weight will make the features with larger variances obtain higher weights.

[0109] 2. Information gain

[0110] Information gain measures the contribution degree of a certain feature in classification. If a certain feature can provide more information (i.e., a large information gain), it indicates that this feature makes a greater contribution to classification, so a higher weight can be assigned.

[0111] The specific formula is as follows:

[0112]

[0113] Among them, IG(f i ) is the information gain of the i-th feature, and ω i is the dynamic weight of this feature. The importance of features is evaluated through information gain, and the weights of features are adjusted.

[0114] S400 model training

[0115] After feature extraction is completed, category annotation is performed on it to obtain corresponding labels, including scratches, stains, draw marks, color unevenness, and overprint deviation.

[0116] The present invention uses a support vector machine (SVM) as the classification model. SVM has strong classification ability and is especially suitable for processing high-dimensional data and complex classification tasks. After the model is selected, the extracted features and corresponding labels are input into the SVM classifier for model training. During the training process, SVM distinguishes different types of defects by finding the optimal hyperplane. This process will use methods such as cross-validation to adjust the model parameters to ensure the generalization ability of the classifier.

[0117] During the image classification process of the SVM classifier (support vector machine), SVM separates different types of defects by constructing an optimal hyperplane. The relevant steps are as follows:

[0118] Given an input sample x, whose corresponding label is y ∈ {-1, 1}, SVM obtains the optimal hyperplane by solving the following optimization problem:

[0119]

[0120] Among them, w is the normal vector of the hyperplane, b is the bias, N is the number of samples, and x i is the feature vector of the i-th sample. The trained SVM model can be predicted through the following decision function:

[0121] f(x) = sign(w T x + b)

[0122] After the final training is completed, the generated SVM classification model is saved.

[0123] S500 Model Detection and Model Update

[0124] Use the trained model to perform defect classification detection on defect images. The feedback of the classification results is used to adjust the production line parameters, and the adaptive optimization further improves the model performance through incremental learning. Incremental learning allows the system to gradually update the SVM classifier when new image data is received without retraining the entire model. Incremental learning ensures that the SVM classifier can adapt to new defect types and changes in the production environment by fine-tuning and updating the existing model. The incremental learning update formula is:

[0125]

[0126] where η is the learning rate, is the gradient of the loss function with respect to the weights.

[0127] The defect classification model trained by the method of the present invention has a detection time of 1s - 2s and a detection success rate of 90% - 95% for known defect images.

Claims

1. A method for training a defect classification model for printed cloth, comprising: Acquire a data set, the data set comprising defect images and category labels corresponding to the defect images; Extracting color features, texture features and shape features of the defect image in parallel; the texture features are extracted by wavelet transform and gray-level co-occurrence matrix; The color feature, the texture feature, the shape feature and the corresponding category labels are input into an SVM classifier for training to obtain a trained defect classification model.

2. The method according to claim 1, characterized in that Get the defect image by the following method: Collect the image of the printed fabric to be tested and determine the height of the printed fabric; Intercepting an image containing n flower turns from the collected image as a standard image, where n≥1; Convert the standard image into Lab color space and extract the L channel to obtain a first image; Dividing the first image into first image sub-images, and statistically saving the sum of pixels in each column of the first image sub-images; Acquire at least one image to be detected of the printed cloth from the collected images; the height of the image to be detected is consistent with that of the standard image; Convert the image to be detected into Lab color space and extract the L channel to obtain a second image; Segmenting the second image to obtain second image sub-images, and counting the sum of pixels in each column of the second image sub-images; The defects of the printed cloth are detected based on the sum of the pixels in each column of the first image sub-image and the sum of the pixels in each column of the second image sub-image, so as to determine the defective image containing the defects.

3. The method according to any one of claims 1 to 2, characterized in that: The defect classification model adopts a stream classification architecture; corresponding to a pattern of the defect image, at least three computing units are configured.

4. The method according to any one of claims 1 to 2, characterized in that: The color feature is extracted based on the BGR channel, and the shape feature is extracted based on the Canny edge detection algorithm.

5. The method according to any one of claims 1 to 2, characterized in that: During the extraction, a weighted algorithm is used to weight different features.

6. The method according to any one of claims 1 to 2, characterized in that: The category labels include scratches, stains, pulls, color unevenness and overprint deviation.

7. A method for detecting defects in printed cloth, comprising: The defects of printed cloth are classified and detected using the defect classification model trained by the method described in any one of claims 1 to 6.

8. The method according to claim 7, characterized in that The defect classification model is fine-tuned through incremental learning.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, the computer program is configured to be executed by the processor, and the computer program comprises instructions for executing the method according to any one of claims 1 to 8.

10. A storage medium storing a computer program, wherein when the computer program is executed by a computer, the method according to any one of claims 1 to 8 is implemented.