Fabric data enhancement method based on adaptive color enhancement

By optimizing the RGB color weight parameters through an adaptive color enhancement method, an adaptive defect image set is generated and a detection model is trained. This solves the problem of insufficient detection accuracy of traditional methods under changes in lighting and background interference, and achieves high-precision and robust fabric defect detection.

CN120953146APending Publication Date: 2025-11-14TIANJIN POLYTECHNIC UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511077296.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-01
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

Existing deep learning-based fabric defect detection models lack sufficient detection accuracy and robustness when faced with changes in lighting and fabric background interference, and traditional color enhancement methods lack the ability to adapt to different defect features.

Method used

An adaptive color enhancement method is adopted, which optimizes the RGB color weight parameters through a genetic algorithm to generate an adaptive defect image set, constructs a dataset and trains a detection model, and performs detection in combination with the YOLOv8 model architecture.

Benefits of technology

It significantly improves the model's accuracy and robustness in defect detection under complex lighting and background interference, meeting the needs of real-time industrial inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120953146A_ABST
    Figure CN120953146A_ABST
Patent Text Reader

Abstract

The invention discloses a fabric data enhancement method based on adaptive color enhancement, which comprises the following steps: 1) constructing a data set: collecting defect images, preprocessing the defect images, identifying defect categories of the defect images, constructing the data set, and dividing the data set into a training set, a verification set and a test set according to a preset proportion; 2) data enhancement: using a genetic algorithm to optimize RGB color weight parameters of various defect images in the data set, and generating an image set after color enhancement of the various defect images; 3) model training: training a detection model by using the image set after color enhancement; and 4) model verification: performing multi-dimensional visual analysis and verification on the performance of the detection model. According to the fabric data enhancement method disclosed by the invention, the color weight parameters during image transformation are continuously optimized by simulating a biological evolution process, a new defect image with an optimal color effect is generated, and the robustness and precision of a fabric defect detection model are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of automated inspection technology in the textile industry, and in particular to a fabric data enhancement method based on adaptive color enhancement. Background Technology

[0002] With the development of intelligent manufacturing, automated detection of fabric defects has become an important means to improve product quality. Currently, deep learning-based defect detection models perform well in terms of recognition accuracy and speed, but they lack sensitivity to color changes and different defect types. In particular, their detection performance is easily affected by changes in lighting and interference from the fabric background.

[0003] Color data augmentation, as an important means to improve the generalization ability of models, has attracted much research attention. However, traditional color augmentation methods are mostly based on fixed image processing operations, lacking the ability to adapt to target features and failing to take into account the differences in color distribution among various types of defects. Therefore, there is an urgent need for a color augmentation method that can automatically adapt to different defect features to improve the robustness and accuracy of detection models. Summary of the Invention

[0004] In view of the above-mentioned defects or deficiencies in the existing technology, it is desirable to provide a fabric data augmentation method based on adaptive color enhancement. By simulating the process of biological evolution, the color weight parameters during image transformation are continuously optimized to generate new defect images with the best color effect, thereby improving the robustness and accuracy of the fabric defect detection model.

[0005] This invention provides a fabric data augmentation method based on adaptive color enhancement, comprising the following steps:

[0006] 1) Constructing a dataset: Collect defect images containing common fabric defect categories, preprocess them, identify the defect categories of the defect images, construct a dataset, and divide it into training set, validation set and test set according to a preset ratio;

[0007] 2) Data augmentation: Genetic algorithms are used to optimize the RGB color weight parameters of various defect images in the dataset to generate image sets with enhanced colors for each type of defect image;

[0008] 3) Model training: The detection model is trained using the color-enhanced image set;

[0009] 4) Model Validation: Perform multi-dimensional visualization analysis and validation of the performance of the detection model.

[0010] Furthermore, in step 1), constructing the dataset includes the following steps:

[0011] 11) Use an industrial-grade high-resolution camera to capture defect images, and uniformly scale or crop the original images to a preset standard size;

[0012] 12) Perform filtering preprocessing on the defect image to suppress high-frequency noise and preserve the edge features of the defects;

[0013] 13) Accurately label the defect areas in the defect image and generate corresponding TXT format label files. Different defect types are identified by different labels.

[0014] 14) Generate a dataset from various defect images and divide it into training set, validation set and test set according to a preset ratio.

[0015] Furthermore, the preset standard size is 800×800 pixels.

[0016] Furthermore, the ratio of the training set, validation set, and test set is 6:2:2.

[0017] Furthermore, in step 2), the genetic algorithm optimization process includes the following steps:

[0018] 21) Set initial RGB color weight parameters for each type of defect image in the dataset to form an initial color weight population, and set the mutation probability and mutation range;

[0019] 22) Using the fitness function f i Quantitatively evaluate the effect of RGB color weight parameters on the performance improvement of the detection model;

[0020] f i = w1×P + w2×R + w3×mAP 50 +w4×mAP 50-95 ;

[0021] Where i is the iteration number;

[0022] w1, w2, w3, and w4 are the set indicator weights;

[0023] P represents the detection accuracy after model data augmentation training;

[0024] R represents the detection recall rate;

[0025] 23) Iterative evolution of color weights for individual units;

[0026] 24) Iterative evolution of color weight mixing;

[0027] 25) Record the optimal color weight population, and perform channel-level dot product operation between each of its RGB color weight parameters and the defect images of the corresponding defect categories in the original training set to generate a color-enhanced image set.

[0028] Furthermore, in step 21), the initial RGB color weight parameters of various defect images are (1.0, 1.0, 1.0); the mutation probability is ≥70%; and the mutation range is [0.7, 1.2].

[0029] Furthermore, in step 23), the iterative evolution of color weights includes the following steps:

[0030] 231) Set the maximum number of iterations K;

[0031] 232) Apply mutation operations to each RGB color weight parameter of the current population to generate a new color weight population; wherein, in the first iteration, the initial color weight population is used as the current population;

[0032] 233) Perform channel-level dot product operations on each RGB color weight parameter in the new color weight population and the defect image of the corresponding defect category in the original training set to generate a new image after color transformation. Add the generated new image to the original training set to form the enhanced training set.

[0033] 234) The detection model was trained using the enhanced training set, and the P, R, mAP50 and mAP50-95 index values ​​corresponding to the RGB color weight parameters of various defect images were calculated.

[0034] 235) Calculate the fitness value f corresponding to the RGB color weight parameters of each type of defect in the newly generated color weight population. i Record the newly generated RGB color weight parameters and their corresponding fitness values ​​f. i ;

[0035] 236) If the number of iterations does not reach K, then select the M groups with the highest fitness values ​​from the RGB color weight parameters of various defect images in the evolutionary history. If there are fewer than M groups, then select all historical records; use the fitness value f as the basis for selection. i The probability selection mechanism p i From these M sets of RGB color weight parameters, one set is selected probabilistically. After all RGB color weight parameters for each type of defect image have been selected, this set is used as the current color weight population for the next iteration, and the process returns to step 232); where, when the fitness value f of the RGB color weight parameter for any type of defect image... i When the RGB color weight parameter is greater than or equal to the preset fitness threshold, it is locked and will not be changed in subsequent iterations.

[0036] p i =f i -f min +10 -6 ;

[0037] Where, p i To select weights; f min The minimum fitness value among the M groups of RGB color weight parameters;

[0038] If the number of iterations reaches K, proceed to step 24.

[0039] Among them, when the fitness value f of the RGB color weight parameter of various defect images is... i If all values ​​are greater than or equal to the preset fitness threshold, proceed to step 25.

[0040] Furthermore, in step 24), the color weight mixing iterative evolution includes the following steps:

[0041] 241) Set the maximum number of iterations L;

[0042] 242) Select fitness values ​​f from the historical evolution records of various defect images respectively. i The highest M groups of RGB color weight parameters are weighted and fused to generate new RGB color weight parameters I. m m = 1, 2, ..., L; the newly generated RGB color weight parameters of various defect images form a new color weight population;

[0043]

[0044] Among them, the selected M groups of color weight populations are reordered, x n p is one of the RGB color weight parameters for one set. n The corresponding selection weights;

[0045] 243) Perform channel-level dot product operations on each RGB color weight parameter in the new color weight population and the defect image of the corresponding defect category in the original training set to generate a new image after color transformation. Add the generated new image to the original training set to form the enhanced training set.

[0046] 244) The detection model is trained using the enhanced training set, and the P, R, mAP50 and mAP50-95 index values ​​corresponding to the RGB color weight parameters of various defect images are calculated.

[0047] 245) Calculate the fitness value f corresponding to the RGB color weight parameters of each type of defect in the newly generated color weight population. i Record the newly generated RGB color weight parameters and their corresponding fitness values ​​f. i ;

[0048] 246) If the number of iterations has not reached L, return to step 242); where, when the fitness value f of the RGB color weight parameter of any type of defect image is...i When the RGB color weight parameter is greater than or equal to the preset fitness threshold, it is locked and will not be changed in subsequent iterations.

[0049] If the number of iterations reaches L, or the fitness value f of the RGB color weight parameters of various defect images... i If all values ​​are greater than or equal to the preset fitness threshold, proceed to step 25.

[0050] Furthermore, in step 3), the detection model adopts the YOLOv8 model architecture, and the key training parameters are set as follows: initial learning rate 0.01, batch size 16, momentum 0.937, weight decay 0.0005, and number of training rounds 300. After training, the final performance of the detection model is evaluated on the validation set.

[0051] Furthermore, in step 4), the visualization analysis and verification includes:

[0052] Confusion matrix analysis: Comparing the confusion matrices of the detection models before and after color enhancement on the validation set;

[0053] Grad-CAM heatmap analysis: Grad-CAM technology is used to generate feature attention heatmaps of the model on the input test set, and the feature attention heatmaps of the detection model before and after training are compared with those of the color-enhanced training set.

[0054] Compared with the prior art, the beneficial effects of the present invention are:

[0055] The fabric data augmentation method of this invention effectively overcomes the limitations and local optima problems of traditional fixed augmentation methods by optimizing color weights that are adaptive to defect types; the phased evolution strategy balances convergence speed and optimization capability; and significantly improves the model's defect detection accuracy and robustness under complex lighting and background interference, meeting the needs of real-time industrial detection.

[0056] It should be understood that the description in the Summary of the Invention is not intended to limit the key or essential features of the embodiments of the present invention, nor is it intended to restrict the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0057] Other features, objects, and advantages of the invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:

[0058] Figure 1 A flowchart illustrating the evolution of RGB color weight parameters;

[0059] Figure 2 Figure a shows the confusion matrix of the detection model before color enhancement, and Figure b shows the confusion matrix of the detection model after color enhancement.

[0060] Figure 3 The image shows a comparison of the Grad-CAM heatmap results of the detection model before and after color enhancement. Detailed Implementation

[0061] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0062] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0063] Please refer to Figures 1-3 The present invention provides a fabric data augmentation method based on adaptive color enhancement, comprising the following steps:

[0064] 1) Construct the dataset;

[0065] 11) Use an industrial-grade high-resolution camera to capture defect images containing common fabric defect categories, and uniformly scale or crop the original images to a standard size of 800×800 pixels;

[0066] 12) A Gaussian filter is used to preprocess the defect image to suppress high-frequency noise and preserve the edge features of the defects;

[0067] 13) Use labelimg software to accurately annotate the defect areas in the defect image and generate corresponding TXT format label files. Different defect types are identified by different labels.

[0068] 14) Generate a dataset from images of various defects and divide it into training, validation and test sets in a ratio of 6:2:2;

[0069] 2) Data augmentation;

[0070] 21) Set initial RGB color weight parameters (1.0, 1.0, 1.0) for each type of defect image in the dataset to form an initial color weight population, and set the mutation probability to 80% and the mutation range [0.7, 1.2];

[0071] Among them, a higher mutation probability is set to increase population diversity and avoid premature convergence, and each parameter in the RGB color weight parameter is independently and randomly mutated near its current value with a preset probability.

[0072] 22) Using the fitness function f iQuantitatively evaluate the effect of RGB color weight parameters on the performance improvement of the detection model;

[0073] f i = w1×P + w2×R + w3×mAP 50 +w4×mAP 50-95 ;

[0074] Where i is the iteration number;

[0075] w1, w2, w3, and w4 are the set indicator weights;

[0076] P represents the detection accuracy after model data augmentation training;

[0077] R represents the detection recall rate;

[0078] 23) Iterative evolution of color weights for individual units;

[0079] 231) Set the maximum number of iterations K;

[0080] 232) Apply mutation operations to each RGB color weight parameter of the current population to generate a new color weight population; wherein, in the first iteration, the initial color weight population is used as the current population;

[0081] 233) Perform channel-level dot product operations on each RGB color weight parameter in the new color weight population and the defect image of the corresponding defect category in the original training set to generate a new image after color transformation. Add the generated new image to the original training set to form the enhanced training set.

[0082] 234) The detection model was trained using the enhanced training set, and the P, R, mAP50 and mAP50-95 index values ​​corresponding to the RGB color weight parameters of various defect images were calculated.

[0083] 235) Calculate the fitness value f corresponding to the RGB color weight parameters of each type of defect in the newly generated color weight population. i Record the newly generated RGB color weight parameters and their corresponding fitness values ​​f. i ;

[0084] 236) If the number of iterations does not reach K, then select the M groups with the highest fitness values ​​from the RGB color weight parameters of various defect images in the evolutionary history. If there are fewer than M groups, then select all historical records; use the fitness value f as the basis for selection. i The probability selection mechanism p iFrom these M sets of RGB color weight parameters, one set is selected probabilistically. After all RGB color weight parameters for each type of defect image have been selected, this set is used as the current color weight population for the next iteration, and the process returns to step 232); where, when the fitness value f of the RGB color weight parameter for any type of defect image... i When the RGB color weight parameter is greater than or equal to the preset fitness threshold, it is locked and will not be changed in subsequent iterations.

[0085] p i =f i -f min +10 -6 ;

[0086] Where, p i To select weights; f min The minimum fitness value among the M groups of RGB color weight parameters;

[0087] If the number of iterations reaches K, proceed to step 24.

[0088] Among them, when the fitness value f of the RGB color weight parameter of various defect images is... i If all values ​​are greater than or equal to the preset fitness threshold, proceed to step 25.

[0089] 24) Iterative evolution of color weight mixing;

[0090] 241) Set the maximum number of iterations L;

[0091] 242) Select fitness values ​​f from the historical evolution records of various defect images respectively. i The highest M groups of RGB color weight parameters are weighted and fused to generate new RGB color weight parameters I. m m = 1, 2, ..., L; the newly generated RGB color weight parameters of various defect images form a new color weight population;

[0092]

[0093] Among them, the selected M groups of color weight populations are reordered, x n p is one of the RGB color weight parameters for one set. n The corresponding selection weights;

[0094] 243) Perform channel-level dot product operations on each RGB color weight parameter in the new color weight population and the defect image of the corresponding defect category in the original training set to generate a new image after color transformation. Add the generated new image to the original training set to form the enhanced training set.

[0095] 244) The detection model is trained using the enhanced training set, and the P, R, mAP50 and mAP50-95 index values ​​corresponding to the RGB color weight parameters of various defect images are calculated.

[0096] 245) Calculate the fitness value f corresponding to the RGB color weight parameters of each type of defect in the newly generated color weight population. i Record the newly generated RGB color weight parameters and their corresponding fitness values ​​f. i ;

[0097] 246) If the number of iterations has not reached L, return to step 242); where, when the fitness value f of the RGB color weight parameter of any type of defect image is... i When the RGB color weight parameter is greater than or equal to the preset fitness threshold, it is locked and will not be changed in subsequent iterations.

[0098] If the number of iterations reaches L, or the fitness value f of the RGB color weight parameters of various defect images... i If all values ​​are greater than or equal to the preset fitness threshold, proceed to step 25.

[0099] 25) Record the optimal color weight population, and perform channel-level dot product operation between each of its RGB color weight parameters and the defect images of the corresponding defect categories in the original training set to generate a color-enhanced image set;

[0100] Among them, the optimal color weight population is the highest fitness value f of various defect images in the historical evolutionary record. i The population composed of the corresponding RGB color weight parameters;

[0101] 3) Model training: The detection model is trained using the color-enhanced image set;

[0102] The detection model adopts the YOLOv8 model architecture, and the key training parameters are set as follows: initial learning rate 0.01, batch size 16, momentum 0.937, weight decay 0.0005, and number of training epochs 300. After training, the final performance of the detection model is evaluated on the validation set.

[0103] Preferably, the detection model can also be YOLOv5, Faster-rcnn or SSD.

[0104] 4) Model Validation: The performance of the detection model is analyzed and validated through multi-dimensional visualization, including:

[0105] Confusion matrix analysis compares the confusion matrices of the detection models before and after color enhancement on the validation set; for example... Figure 2As shown in the figure, the analysis shows that after the enhancement by this method, the misjudgment rate of the detection model for weft shrinkage defects is significantly reduced, and the confusion between weft shrinkage defects and coarse weft defects is significantly reduced, proving that the detection model's ability to classify defects has been effectively improved.

[0106] Grad-CAM heatmap analysis: Grad-CAM technology is used to generate feature attention heatmaps of the model on the input test set. These heatmaps are then compared with the feature attention heatmaps of the detection model before and after training on the color-enhanced training set. Figure 3 As shown, the enhanced detection model shows a significant increase in its focus on actual defect areas (brighter colors indicate higher focus), while its focus on irrelevant areas such as the background decreases, indicating that the model can more accurately locate and identify defect features.

[0107] In this embodiment, the present application adopts a phased evolution strategy. In the early stage, individual evolution is carried out to achieve rapid convergence. In the later stage, hybrid evolution based on historically superior parameters is carried out to improve global exploration capabilities, integrate historically superior genes, and explore a better parameter combination space.

[0108] Taking a dataset consisting of 1000 defect images of 7 common defect categories (coarse warp, coarse weft, slurry spots, broken warp, three threads, weft shrinkage, and star jump) as an example, the initial RGB color weight parameters (1.0, 1.0, 1.0) are set for each type of defect image, forming an initial color weight population [(1.0, 1.0, 1.0), (1.0, 1.0, 1.0), (1.0, 1.0, 1.0), (1.0, 1.0, 1.0), (1.0, 1.0, 1.0), (1.0, 1.0, 1.0), (1.0, 1.0, 1.0), (1.0, 1.0, 1.0)];

[0109] Set the maximum number of iterations for a single iteration to 100 and the maximum number of iterations for a mixed iteration to 40.

[0110] The initial color weight population is subjected to a mutation operation. Each initial RGB color weight parameter is mutated with an 80% mutation probability within the mutation range of [0.7, 1.2] to generate a new color weight population [(1.0123, 0.9541, 1.0613), (1.0413, 0.8150, 1.0542), (0.8403, 1.0672, 1.1043), (1.0605, 0.8204, 1.0217), (1.1304, 1.0282, 0.7608), (1.0257, 0.8806, 0.9033), (1.0524, 0.9125, 1.0103)];

[0111] Each RGB color weight parameter is multiplied by the corresponding defect image of the defect category in the original training set (600 images) at the channel level to generate 600 new images after color transformation. The generated new images are added to the original training set to form the enhanced training set (1200 images).

[0112] The detection model was trained using the enhanced training set, and the P, R, mAP50 and mAP50-95 index values ​​corresponding to the RGB color weight parameters of various defect images were calculated.

[0113] Calculate the fitness value f for each type of defect in the newly generated color weight population, corresponding to the RGB color weight parameters. i Record the newly generated RGB color weight parameters and their corresponding fitness values ​​f. i ;

[0114] If the number of iterations does not reach 100, select the 5 groups with the highest fitness values ​​from the RGB color weight parameters of various defect images in the evolutionary history. If there are fewer than 5 groups, select all historical records. Use the fitness value f as the basis for selection. i The probability selection mechanism p i Select one set of RGB color weight parameters from these 5 sets according to probability; select a population of RGB color weight parameters for each type of defect image and use it as the current color weight population for the next iteration;

[0115] During the iteration process, if the fitness value calculated by the RGB color weight parameters (1.0605, 0.8204, 1.0217) of the broken meridian is greater than or equal to the preset fitness threshold of 0.9, then the RGB color weight parameter is locked and will not be changed in subsequent iterations; the RGB color weight parameters of other types of defects continue to mutate.

[0116] After entering the hybrid iteration, fitness values ​​f are selected from the historical evolution records of various defect images respectively. i The top 5 RGB color weight parameters are weighted and fused to generate new RGB color weight parameters; the newly generated RGB color weight parameters for various defect images form a new color weight population; the newly generated color weight population is used for image color transformation (dot product), model training and fitness calculation, and the results are recorded.

[0117] After the iteration is complete, the optimal RGB color weight parameters (fitness value f) of various defect images in the evolutionary history will be used. i The optimal color weight population is formed by combining the maximum number of images (see Table 1). The optimal color weight population is then used to perform image color transformation (dot product) on 600 original training images to obtain a color-enhanced image set (600 images). This image set is then used for model training.

[0118] Table 1. Optimal Color Weight Parameters Corresponding to Defect Types

[0119] Color channel coarse diameter coarse weft Pulp spot amenorrhea Three shreds weft contraction Star Jump R 0.9684 1.0000 1.0912 1.1693 1.0304 1.2000 0.7753 G 0.7000 1.0385 1.0975 1.1157 1.0069 1.0318 0.9886 B 1.0705 1.0902 0.7893 1.1303 1.0217 0.8810 0.9573

[0120] Analysis of the data in Table 1 shows that the optimal color adjustment strategies obtained from the evolution of different defect types are significantly different (e.g., broken warp requires a significant increase in R, G, and B channels, star jump requires a decrease in the R channel, and weft shrinkage requires an increase in the R channel), which fully demonstrates the necessity and effectiveness of independent color adaptive evolution for each defect type.

[0121] Quantitative evaluation on the validation set shows that, compared with the base model, the method of this invention improves the mAP50 index of the YOLOv8 model by 6.5% (reaching 80.5%), and improves the detection accuracy of specific defects such as weft shrinkage and warp breakage by up to 13.4%. Confusion matrix analysis further confirms that the model can achieve 100% accuracy in classifying pulp stain defects.

[0122] The fabric data augmentation method proposed in this application effectively overcomes the limitations and local optima problems of traditional fixed augmentation methods by optimizing color weights that are adaptive to defect types. The phased evolution strategy balances convergence speed and optimization capability. It significantly improves the model's defect detection accuracy and robustness under complex lighting and background interference, meeting the needs of real-time industrial detection.

[0123] In the description of this specification, the terms "one embodiment," "some embodiments," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0124] The above are merely preferred embodiments of this application and are not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A fabric data augmentation method based on adaptive color enhancement, characterized in that, Includes the following steps: 1) Constructing a dataset: Collect defect images containing common fabric defect categories, preprocess them, identify the defect categories of the defect images, construct a dataset, and divide it into training set, validation set and test set according to a preset ratio; 2) Data augmentation: Genetic algorithms are used to optimize the RGB color weight parameters of various defect images in the dataset, generating image sets with enhanced colors for each type of defect image; 3) Model training: The detection model is trained using the color-enhanced image set; 4) Model Validation: Perform multi-dimensional visualization analysis and validation of the performance of the detection model.

2. The fabric data augmentation method based on adaptive color enhancement according to claim 1, characterized in that, Step 1) involves constructing the dataset, which includes the following steps: 11) Use an industrial-grade high-resolution camera to capture defect images, and uniformly scale or crop the original images to a preset standard size; 12) Perform filtering preprocessing on the defect image to suppress high-frequency noise and preserve the edge features of the defects; 13) Accurately label the defect areas in the defect image and generate corresponding TXT format label files. Different defect types are identified by different labels. 14) Generate a dataset from various defect images and divide it into training set, validation set and test set according to a preset ratio.

3. The fabric data augmentation method based on adaptive color enhancement according to claim 2, characterized in that, The preset standard size is 800×800 pixels.

4. The fabric data augmentation method based on adaptive color enhancement according to claim 2, characterized in that, The ratio of the training set, validation set, and test set is 6:2:

2.

5. The fabric data augmentation method based on adaptive color enhancement according to claim 1, characterized in that, In step 2), the genetic algorithm optimization process includes the following steps: 21) Set initial RGB color weight parameters for each type of defect image in the dataset to form an initial color weight population, and set the mutation probability and mutation range; 22) Using the fitness function f i Quantitatively evaluate the effect of RGB color weight parameters on the performance improvement of the detection model; f i =w1×P+w2×R+w3×mAP 50 +w4×mAP 50-95 ; Where i is the iteration number; w1, w2, w3, and w4 are the set indicator weights; P represents the detection accuracy after model data augmentation training; R represents the detection recall rate; 23) Iterative evolution of color weights for individual units; 24) Iterative evolution of color weight mixing; 25) Record the optimal color weight population, and perform channel-level dot product operation between each of its RGB color weight parameters and the defect images of the corresponding defect categories in the original training set to generate a color-enhanced image set.

6. The fabric data augmentation method based on adaptive color enhancement according to claim 5, characterized in that, In step 21), the initial RGB color weight parameters of various defect images are (1.0, 1.0, 1.0); the mutation probability is ≥70%; and the mutation range is [0.7, 1.2].

7. The fabric data augmentation method based on adaptive color enhancement according to claim 3, characterized in that, In step 23), the iterative evolution of individual color weights includes the following steps: 231) Set the maximum number of iterations K; 232) Apply mutation operations to each RGB color weight parameter of the current population to generate a new color weight population; wherein, in the first iteration, the initial color weight population is used as the current population; 233) Perform channel-level dot product operations on each RGB color weight parameter in the new color weight population and the defect image of the corresponding defect category in the original training set to generate a new image after color transformation. Add the generated new image to the original training set to form the enhanced training set. 234) The detection model is trained using the enhanced training set, and the P, R, mAP50 and mAP50-95 index values ​​corresponding to the RGB color weight parameters of various defect images are calculated. 235) Calculate the fitness value f corresponding to the RGB color weight parameters of each type of defect in the newly generated color weight population. i Record the newly generated RGB color weight parameters and their corresponding fitness values ​​f. i ; 236) If the number of iterations does not reach K, then select the M groups with the highest fitness values ​​from the RGB color weight parameters of various defect images in the evolutionary history. If there are fewer than M groups, then select all historical records; use the fitness value f as the basis for selection. i The probability selection mechanism p i From these M sets of RGB color weight parameters, one set is selected probabilistically. After all RGB color weight parameters for each type of defect image have been selected, this set is used as the current color weight population for the next iteration, and the process returns to step 232); where, when the fitness value f of the RGB color weight parameter for any type of defect image... i When the RGB color weight parameter is greater than or equal to the preset fitness threshold, it is locked and will not be changed in subsequent iterations. p i =f i -f min +10 -6 ; Where, p i To select weights; f min The minimum fitness value among the M groups of RGB color weight parameters; If the number of iterations reaches K, proceed to step 24. Among them, when the fitness value f of the RGB color weight parameter of various defect images is... i If all values ​​are greater than or equal to the preset fitness threshold, proceed to step 25.

8. The fabric data augmentation method based on adaptive color enhancement according to claim 7, characterized in that, In step 24), the color weight mixing iterative evolution includes the following steps: 241) Set the maximum number of iterations L; 242) Select fitness values ​​f from the historical evolution records of various defect images respectively. i The highest M groups of RGB color weight parameters are weighted and fused to generate new RGB color weight parameters I. m m = 1, 2, ..., L; the newly generated RGB color weight parameters of various defect images form a new color weight population; Among them, the selected M groups of color weight populations are reordered, x n p is one of the RGB color weight parameters for one set. n The corresponding selection weights; 243) Perform channel-level dot product operations on each RGB color weight parameter in the new color weight population and the defect image of the corresponding defect category in the original training set to generate a new image after color transformation. Add the generated new image to the original training set to form the enhanced training set. 244) The detection model is trained using the enhanced training set, and the P, R, mAP50 and mAP50-95 index values ​​corresponding to the RGB color weight parameters of various defect images are calculated. 245) Calculate the fitness value f corresponding to the RGB color weight parameters of each type of defect in the newly generated color weight population. i Record the newly generated RGB color weight parameters and their corresponding fitness values ​​f. i ; 246) If the number of iterations has not reached L, return to step 242); where, when the fitness value f of the RGB color weight parameter of any type of defect image is... i When the RGB color weight parameter is greater than or equal to the preset fitness threshold, it is locked and will not be changed in subsequent iterations. If the number of iterations reaches L, or the fitness value f of the RGB color weight parameters of various defect images... i If all values ​​are greater than or equal to the preset fitness threshold, proceed to step 25.

9. The fabric data augmentation method based on adaptive color enhancement according to claim 1, characterized in that, In step 3), the detection model adopts the YOLOv8 model architecture, and the key training parameters are set as follows: initial learning rate 0.01, batch size 16, momentum 0.937, weight decay 0.0005, and number of training rounds 300. After training, the final performance of the detection model is evaluated on the validation set.

10. The fabric data augmentation method based on adaptive color enhancement according to claim 1, characterized in that, In step 4), the visualization analysis and verification include: Confusion matrix analysis: Comparing the confusion matrices of the detection models before and after color enhancement on the validation set; Grad-CAM heatmap analysis: Grad-CAM technology is used to generate feature attention heatmaps of the model on the input test set, and the feature attention heatmaps of the detection model before and after training are compared with those of the color-enhanced training set.