A color spun fabric image retrieval method based on dynamic feature contribution degree
Through multimodal feature decoupling and dynamic feature contribution quantification model, the problems of single feature matching and fixed weight fusion in traditional textile image retrieval are solved, and high-precision retrieval of colored yarn fabrics is achieved, which is in line with human visual perception.
Patent Information
- Application Number
- CN202511077808.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2045-08-01
AI Technical Summary
Traditional textile image retrieval methods have single visual feature matching and fixed weight fusion, which leads to deviations between the retrieval results of spun-dyed fabrics and human visual perception, and are unable to adapt to the changes in feature importance of fabric types.
Multimodal feature decoupling technology is used to separate color, texture and shape features, a dynamic feature contribution quantification model is designed, and the feature contribution ratio is calculated through gradient backpropagation to achieve adaptive weight adjustment.
The accuracy of color-spun fabric image retrieval is improved, and the retrieval results are more in line with human visual perception and adapt to the changes in feature importance of different fabric types.
Smart Images

Figure CN120596697B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent technology of textile industry, in particular to a color-woven fabric image retrieval method based on dynamic feature contribution. Background Art
[0002] In the textile industry, color-spun fabrics, with their unique "three-dimensional color blending" effect, have important application value in high-end clothing and home textiles. However, the complex characteristics of these fabrics pose significant challenges to traditional image retrieval methods:
[0003] (1) Limitations of single-feature retrieval
[0004] Traditional retrieval methods typically rely on a single visual feature for similarity matching. However, the visual appearance of spun-dyed fabrics is the result of a highly coupled set of features. This results in: fabrics of the same color but different blending structures (e.g., uniformly dyed and patterned yarns) being highly similar in color feature space, but exhibiting significant differences in their texture distribution; and variations in microscopic fiber arrangement (e.g., blending staple fibers with interwoven filaments) can cause algorithms based on a single texture feature to misjudge.
[0005] (2) Insufficient adaptability of fixed weight fusion
[0006] While some existing multi-feature fusion schemes consider multiple features, their contribution is fixed and unable to adapt to the varying importance of features across different fabric types. Furthermore, they lack a quantitative evaluation mechanism, and their weight distribution deviates from human visual perception, making them difficult to adapt to the diversity of color-spun fabrics. For example, for fabrics with gradient colors, the contribution of color features should be significantly higher than that of other features; for jacquard fabrics, shape and edge features may dominate. Existing methods also lack the ability to dynamically adjust feature weights, resulting in retrieval results that deviate from human visual perception. Summary of the Invention
[0007] In order to overcome the problems existing in the background technology, the present invention proposes a method for retrieval of dyed fabric images based on dynamic feature contribution, which specifically includes the following steps:
[0008] Step 1: Classify and collect the dyed fabric samples to obtain the dyed fabric inventory samples;
[0009] Step 2: collecting optical images of dyed fabric samples and preprocessing them to establish a standardized data set;
[0010] Step 3: Perform multimodal feature decoupling on the optical image to separate three independent feature maps: color, texture, and shape;
[0011] Step 4: Design three completely independent feature encoders for color, texture, and shape, encode the three independent feature maps of color, texture, and shape respectively, and obtain the predicted value of the type of the dyed fabric;
[0012] Step 5: Calculate the loss between the predicted value of the dyed fabric type and the true label of the dyed fabric type using a loss function, optimize the model parameters in step 4, and use the optimized feature encoder model to extract discrete feature vectors of color, texture, and shape of the dyed fabric inventory sample image;
[0013] Step 6: Design a feature contribution quantification model. This model aggregates discrete feature vectors and performs color-woven fabric category recognition to obtain category probability distributions. It also evaluates the contribution of each visual feature to color-woven fabric category recognition and achieves adaptive optimization of feature weight allocation.
[0014] Step 7: Calculate the loss of the probability distribution of the color textile category and the true label of the color textile category using the loss function, optimize the model parameters in step 6, and update only the relevant parameters of the feature contribution quantization model through backpropagation based on the frozen feature encoder in step 5. Then, use the optimized model to output the feature weights of the color, texture, and shape features in the color textile inventory sample image for color textile category identification.
[0015] Step 8: Process the dyed fabric sample to be retrieved according to the above steps 2-7 to obtain the corresponding feature weights, perform dynamic weighted fusion and search in the dyed fabric sample library to obtain the results.
[0016] Furthermore, in step 1, the yarn-dyed fabric samples are classified and collected according to the appearance pattern style to obtain yarn-dyed fabric inventory samples, and the corresponding relevant process parameters are collected at the same time, so as to facilitate the association of yarn-dyed fabric images with their process sheets while achieving fast and accurate retrieval;
[0017] The appearance pattern styles of color-dyed fabrics include slub yarn, phantom yarn, star-colored yarn, neon yarn, and siro-dyed yarn, while the process parameters include the type and proportion of fiber base colors, mixing method, coarse / fine yarn spindle speed, mechanical draft ratio, twist coefficient, roller gauge, and related environmental control parameters.
[0018] Furthermore, in step 2, the color feature decoupling process is first performed, and each channel of the RGB image is converted to the frequency domain by performing a two-dimensional fast Fourier transform, randomly disturbing the phase information, and restoring the image by a two-dimensional inverse fast Fourier transform to obtain a pure color feature map. ;
[0019] The texture feature decoupling process is performed on the images in the standardized dataset. First, the RGB image of the sample image is grayscaled to remove the color information. Then the grayscale image is divided into a group of square patches to destroy the original shape information. Then these patches are randomly re-sorted and connected to form a new texture image, and the texture feature map of the sample image is obtained. ;
[0020] The image in the standardized data set is decoupled from the shape features. After graying the image, a Gaussian low-pass filter is applied. The Sobel operator obtains the horizontal and vertical gradients, and then calculates the gradient amplitude and direction of the edge. The calculated gradient amplitude is normalized and combined with the direction to obtain the final shape feature map. .
[0021] Furthermore, the specific steps of color feature decoupling processing are as follows:
[0022] Given an image , for the image Perform a two-dimensional fast Fourier transform (2D FFT) on the j channel to get the output , the formula is as follows;
[0023] ;
[0024] in, , Indicates the size of the image, C is the number of channels, Representing an image The j channel, , j=1,2,...,C, represents the modulus, Indicates angle;
[0025] Furthermore, applying the 2D Fast Fourier Transform to the random matrix , and get the transformed result and its modulus s and angle , as follows:
[0026] ;
[0027] Among them, s refers to the modulus of the transformed component, using 、 and , construct a new subvariable , It is a disturbance factor. The secondary variable is mapped back through the two-dimensional inverse fast Fourier transform 2D IFFT, and the rescale operation is performed to rescale the result to the range of [0, 255] to obtain the color feature map. ,in and Showing the same pixel color value distribution, the specific formula is as follows:
[0028] ;
[0029] where j=1,2,...,C and yes The j channel.
[0030] Furthermore, in step 4, the color feature map , texture feature map , shape feature map The three types of feature maps are input into the feature encoder respectively, color, texture, and shape feature encoders 、 、 The structure is consistent. Its core structure is composed of stacked residual modules, which contains several layers of deep neural networks. The network structure is divided into the following modules:
[0031] Input preprocessing layer: The input data first passes through a 7×7 large kernel convolution layer, where the color encoder maintains three-channel input, and the texture and shape encoders change to single-channel input, outputting a multi-channel feature map. BatchNorm batch normalization and ReLU activation are then performed. The formula is as follows:
[0032] ;
[0033] In the above formula, Represents the feature map input to the encoder, H and W represent the size and height of the image, and C represents the number of channels. represents the 7×7 convolution kernel weight, represents the bias term;
[0034] Through the 3×3 maximum pooling layer, spatial downsampling is completed, and the feature map size is compressed to 1 / 4 of the original input. The formula is as follows:
[0035] ;
[0036] Residual module stacking structure: It consists of 4 stages, each stage contains 2 residual blocks, each residual block consists of two 3×3 convolution kernels, BatchNorm batch normalization and ReLU activation are inserted between convolution layers. When the feature map size is halved, convolution is used for downsampling. At the same time, when the number of input and output channels is inconsistent or the feature map size changes, the channel dimension of the jump connection shortcut is adjusted through a 1×1 convolution kernel. The formula for implementing residual connection is as follows:
[0037] ;
[0038] wherein represents the output of the jth neuron in the i th stage, represents the output of the jth neuron in the i th stage, , represents the output of the jth neuron in the i th stage, , respectively represent two 3x3 convolution kernel weights of each stage, , respectively represent the bias terms in the two convolution operations, shortcut is a dimension matching operation, and the final output to the fourth stage ;
[0039] The feature encoding output module: a global average pooling layer is used to compress the spatial dimension to 1x1, and then input to a fully connected layer FC suitable for the current task, and the output dimension is adjusted to the specified class number class_num, and the formula is as follows:
[0040] ;
[0041] wherein, is the predicted value of the three features for the color spun fabric category, is the weight of the fully connected layer, is the bias term of the fully connected layer.
[0042] Further, in step 5, the input layer receives feature map data of different categories of color spun yarns, containing color, shape, and texture multi-channel features, and generates a predicted label through a forward propagation process ; in the back propagation stage, the cross entropy loss between the predicted result and the real label is calculated, and the specific formula is as follows:
[0043] ;
[0044] wherein is the real label of the color, texture, and shape corresponding to the color spun fabric category; and the gradient descent algorithm is used to iteratively optimize the model parameters.
[0045] Further, in step 7, the class probability distribution is output through the fully connected classification layer, and the cross entropy loss function is used to measure the difference between the predicted distribution and the real label distribution.
[0046] Further, after the training of the three independent feature encoders is completed, the color feature map , the texture feature map , and the shape feature map are respectively mapped to the color feature vector , the texture feature vector , and the shape feature vector , and serves as the input to the feature contribution metric model, in which the multimodal feature vectors are first fused through a tensor concatenation layer:
[0047] ;
[0048] Then the average pooling layer Avgpool is used to compress the spatial dimension, and the feature dimension is expanded by the Flatten operation:
[0049] ;
[0050] For the multi-level structure of the fully connected layer, the linear layer, ReLU activation function, and linear layer connection are used in sequence:
[0051] ;
[0052] Where z is the output of the fully connected layer, W1, W2 are weight matrices, and b1, b2 are biases;
[0053] Finally, the Softmax function is used to output the category probability prediction value u, and the formula is as follows:
[0054] ;
[0055] in Color spinning category for models The predicted probability of is the output of the fully connected layer for category y, and K is the total number of categories.
[0056] Furthermore, based on the feature contribution quantification model training, the contribution of color, shape and texture features to the prediction results is quantified through gradient back propagation. 、 and , the specific steps are as follows: Assume that the model is for the color spinning category The predicted probability is ,but Shape features , texture features and color characteristics The gradients are:
[0057] , , ;
[0058] gradient , , These respectively reflect the degree of influence of slight changes in shape, texture and form characteristics on the prediction results of color-spun yarn types;
[0059] The gradient is then multiplied element-wise with the original features to obtain the preliminary contribution values:
[0060] , , ;
[0061] The contribution values are globally averaged and normalized by Softmax to obtain the final contribution proportions:
[0062] , , ;
[0063] At this point .
[0064] Further, in step 8, for each image in the database, the extracted color feature vector , texture feature vector , shape feature vector and its corresponding weight , , are normalized to ensure consistency in similarity calculation, and the normalized feature vectors and weights are stored in the database;
[0065] For the image provided by the user to be searched, three feature vectors , , and corresponding weights , , are extracted and normalized;
[0066] The dynamic weighted fusion step is performed, and the cosine similarity is used to measure the similarity sim of the query image and the database image in each feature direction, with the calculation formula as follows:
[0067] , , ;
[0068] Where , , represent the similarity in color, texture and shape respectively; then combined with the weights of the query and the database, the weighted score score is calculated:
[0069] ;
[0070] Finally, the database images are sorted in descending order of score, and the top K results with the highest similarity are returned.
[0071] The application provides a color spun fabric image retrieval method based on dynamic feature contribution degree, and innovatively improves the single feature limitation and fixed weight fusion defects of traditional retrieval technology. Color, texture and shape features are separated by a multi-modal feature decoupling technology to eliminate the coupling interference between features; a dynamic contribution quantification mechanism is innovatively constructed, the contribution proportion of features to retrieval results is calculated in real time by gradient backpropagation, and adaptive weight adjustment is realized. The method breaks through the retrieval deviation problem of color spun yarn fabrics caused by complex characteristics such as color gradient and blended structure difference, can intelligently match weight distribution according to the features of the query image (such as color gradient fabric focusing on color features and jacquard fabric focusing on shape edges), and makes the retrieval results more consistent with human visual perception. The technical scheme effectively improves the image retrieval accuracy of complex fabrics in the textile industry, and provides an intelligent solution for production process data association. BRIEF DESCRIPTION OF DRAWINGS
[0072] Figure 1 A method flowchart is provided for the application;
[0073] Figure 2 A color feature decoupling effect diagram is provided for the application;
[0074] Figure 3 A texture feature decoupling effect diagram is provided for the application;
[0075] Figure 4 A shape feature decoupling effect diagram is provided for the application;
[0076] Figure 5 A feature encoder module structure diagram is provided for the application;
[0077] Figure 6 A feature contribution quantification module structure diagram is provided for the application. DETAILED DESCRIPTION
[0078] The technical scheme of the application will be described in detail below with reference to the drawings in the application.
[0079] As shown in Figure 1 , the color spun fabric image retrieval method based on dynamic feature contribution degree provided by the embodiment of the application comprises the following steps:
[0080] Step 1: According to the appearance pattern style, the color spun fabric samples are classified and collected to obtain the color spun fabric inventory samples, and the corresponding related process parameters are collected, so that the color spun fabric image can be associated with the process sheet to realize fast and accurate retrieval, guide production by calling the process sheet, and save the process of manual sample analysis and trial weaving and marking.
[0081] In step 1, the appearance pattern styles of the dyed fabric may include slub yarn, phantom yarn, star-colored yarn, neon yarn, siro-dyed yarn, etc., and the process parameters include the type and proportion of fiber base colors, mixing method (package mixing, strip and fine mixing, strip mixing, etc.), coarse / fine yarn spindle speed, mechanical drafting multiple, twist coefficient, roller gauge and related environmental control parameters.
[0082] Step 2: Build an optical image acquisition system to complete the optical image acquisition of the dyed fabric samples under unified standard conditions, perform preprocessing, and establish a standardized data set.
[0083] In step 2, an optical camera (e.g., a Nikon D3X with a 35mm focal length lens) is used to build an acquisition system. The lighting conditions are a D65 standard light source environment, and a standard Pantone color chart is used for white balance and parameter calibration. The original image size is 6048×4032 pixels. The original image is cropped into a square with a 1:1 aspect ratio and a uniform resolution (scaled to 1024×1024 pixels) to ensure consistent image detail scale for all samples. This process establishes a reliable data foundation for subsequent image analysis and feature extraction through strict parameter control and standardized processing.
[0084] In step 3, multimodal feature decoupling is performed on the optical image in the standardized dataset in step 2 to separate three independent feature maps: color, texture, and shape.
[0085] In step 3, the images in the standardized dataset are subjected to multimodal feature decoupling. First, the color feature decoupling is performed. A two-dimensional fast Fourier transform (2DFFT) is performed on each channel of the RGB image to convert it to the frequency domain, and the phase information is randomly disturbed (destroying the shape and texture information while retaining the color statistical characteristics). The image is restored through a two-dimensional inverse fast Fourier transform (2DIFFT) to obtain a pure color feature map. The specific steps are as follows: Given an image , for the image The j channel performs 2DFFT transformation to get the output , the formula is as follows;
[0086] ;
[0087] in, , Indicates the size of the image, C is the number of channels, Representing an image The j channel, , j=1,2,...,C, represents the modulus, Indicates an angle.
[0088] Furthermore, applying the 2D FFT to a random matrix , and get the transformed result and its modulus s and angle , as follows:
[0089] ;
[0090] Among them, s refers to the modulus of the transformed component, using 、 and , construct a new subvariable , It is a disturbance factor. The variable is mapped back through 2D IFFT and rescaled to the range of [0, 255] to obtain the color feature map. ,like Figure 2 As shown, and Showing the same pixel color value distribution, the specific formula is as follows:
[0091] ;
[0092] where j=1,2,...,C and yes The j channel.
[0093] Furthermore, we perform texture feature decoupling on the images in the standardized dataset, grayscale the RGB image to remove color information, and randomly reconstruct the image in blocks (destroying the shape but preserving the texture). First, grayscale the sample RGB image to remove color information, then divide the grayscale image into a set of square patches to destroy the original shape information, and then randomly reorder and connect these patches to form a new texture image, thus obtaining the texture feature map of the sample image. like Figure 3 shown.
[0094] Furthermore, the shape features of the images in the standardized dataset are decoupled, the images are grayed out and then Gaussian low-pass filtered (to suppress texture high frequencies) and the Sobel operator is used to extract edge gradients (to enhance shape contours). Convert to grayscale , the two-dimensional Gaussian kernel formula used is as follows:
[0095] ;
[0096] Where (x,y) represents the coordinates of a point in the image. is the standard deviation, controlling the smoothing strength ( The larger the value, the stronger the texture suppression). The grayscale image is convolved with the Gaussian kernel to obtain a smoothed image. .
[0097] ;
[0098] Then the Sobel operator is used to obtain the gradient in the horizontal and vertical directions, retaining the intensity of the shape edge. The gradient calculation helps to highlight the shape. And vertical convolution kernel as follows:
[0099] , ;
[0100] Calculate the smoothed image through convolution operation At the level Directional gradient , and vertical Directional gradient :
[0101] , ;
[0102] The gradient magnitude G and direction of the edge can be calculated using the horizontal and vertical gradients. :
[0103] , ;
[0104] The calculated gradient amplitude G is normalized and combined with the direction Get the final shape feature map like Figure 4 shown.
[0105] Step 4: Simulate the individual neural pathways in the human brain, each of which is specialized in processing various forms of visual information. Design three completely independent feature encoders for color, texture, and shape. Encode the three independent feature maps of color, texture, and shape obtained in step 3 above, and obtain a predicted value for the type of the dyed fabric.
[0106] In step 4, the network structure of the feature encoding module is as follows Figure 5 As shown, the color feature map , texture feature map , shape feature map The three types of feature maps are input into the feature encoder respectively. In this embodiment, the color, texture and shape feature encoders 、 、 The structure is basically the same. Its core structure is composed of stacked residual modules and contains a total of 18 layers of deep neural networks (including weight layers). The network structure can be divided into the following modules: Input preprocessing layer (Input stem): The input data first passes through a 7×7 large kernel convolution layer, where the color encoder maintains three-channel input, and the texture and shape encoders change to single-channel input, outputting a 64-channel feature map. Batch normalization and ReLU activation are then performed. The formula is as follows:
[0107] ;
[0108] In the above formula, Represents the feature map input to the encoder, H and W represent the size and height of the image, and C represents the number of channels. represents the 7×7 convolution kernel weight, represents the bias term.
[0109] Through the 3×3 maximum pooling layer, spatial downsampling is completed, and the feature map size is compressed to 1 / 4 of the original input. The formula is as follows:
[0110] ;
[0111] Residual module stacking structure (Stage 1-Stage 4): The main body of the network consists of 4 stages, each stage contains 2 residual blocks, each residual block consists of two 3×3 convolution kernels, BatchNorm batch normalization and ReLU activation are inserted between convolution layers. When the feature map size is halved, convolution is used for downsampling. At the same time, when the number of input and output channels is inconsistent or the feature map size changes, the channel dimension of the jump connection (shortcut) is adjusted through the 1×1 convolution kernel to implement the residual connection formula:
[0112] ;
[0113] in Indicates the The output of the jth neuron in stage, Indicates the The output of the jth neuron in stage, 、 Represents the two 3×3 convolution kernel weights in each stage, 、 They represent the bias terms in the two convolution operations respectively, the shortcut is the dimension matching operation, and the final output to the fourth stage .
[0114] Feature encoding output module (Avgpool): A global average pooling layer is used at the end of the network to compress the spatial dimension to 1×1. The original fully connected layer (1000-dimensional ImageNet classification head) is replaced with a fully connected layer FC adapted to the current task. The output dimension is adjusted to the specified number of categories class_num. The formula is as follows:
[0115] ;
[0116] in, are the predicted values of the three features for the type of yarn-dyed fabric, is the weight of the fully connected layer, is the bias term of the fully connected layer. Except for the final fully connected layer, all convolutional layers inherit the ImageNet pre-trained weights and achieve feature adaptation in the target domain.
[0117] In step 5, the loss function is used to calculate the loss of the predicted value of the color textile fabric type and the true label of the color textile fabric type, the model parameters in step 4 are optimized, and the optimized feature encoder model is used to extract the discrete feature vectors of the color, texture and shape of the color textile fabric inventory sample image.
[0118] In step 5, the model was deployed on the server. Color, shape, and texture features were extracted from different types of spun-dyed yarn samples to construct a multimodal feature dataset. The training, test, and validation sets were divided into 80%, 15%, and 5% groups, respectively. The model was trained for 2000 rounds, with a batch size of 32 and a weight decay coefficient of 0.001.
[0119] The model adopts an end-to-end supervised learning framework. The input layer receives the feature map data of different categories of colored yarn (including color, shape, texture multi-channel features) and generates prediction labels through the forward propagation process. In the back propagation stage, the cross entropy loss between the predicted result and the true label is calculated. The specific formula is as follows:
[0120] ;
[0121] in The true labels for the color, texture, and shape of the dyed fabric are shown. Model parameters are iteratively optimized using a gradient descent algorithm. After each training batch, the classification accuracy and macro-average metrics for each category are calculated using the current validation set to assess model generalization. The validation set loss curve and accuracy metrics are monitored in real time. When the validation loss does not show a significant decrease for N consecutive epochs (N = 5-10 depending on the convergence rate), the early stopping mechanism is triggered to terminate training. A snapshot of the model parameters at the peak validation set performance is also saved to effectively prevent overfitting.
[0122] Step 6: Design a feature contribution quantification model, which aggregates the separated feature vectors and performs color-woven fabric category recognition to obtain category probability distribution. On this basis, it automatically evaluates the contribution of each visual feature to the color-woven fabric category recognition and realizes the adaptive optimization allocation of feature weights.
[0123] In step 6, the network structure of the feature contribution quantification module is as follows Figure 6 As shown, after the three independent feature encoders are trained, the color feature map , texture feature map , shape feature map Mapped to color feature vectors , texture feature vector , shape feature vector , and serves as the input to the feature contribution quantization model, in which the multimodal feature vectors are first fused through a tensor concatenation layer:
[0124] ;
[0125] Then the average pooling layer Avgpool is used to compress the spatial dimension, and the feature dimension is expanded by the Flatten operation:
[0126] ;
[0127] For the multi-level structure of the fully connected layer, Linear, ReLU activation function, and Linear connection are used in turn:
[0128] ;
[0129] Where z is the output of the fully connected layer, W1, W2 are weight matrices, and b1, b2 are biases.
[0130] Finally, the Softmax function is used to output the category probability prediction value u, and the formula is as follows:
[0131] ;
[0132] in Color spinning category for models The predicted probability of is the output of the fully connected layer for category y, and K is the total number of categories.
[0133] In step 7, the loss function is used to calculate the loss of the category probability distribution of the colored textile fabric and the true label of the colored textile fabric type, and the model parameters in step 6 are optimized. On the basis of freezing the feature encoder in step 5, only the relevant parameters of the feature contribution quantization model are updated through back propagation, and the optimized model is used to output the feature weights of the color, texture and shape features in the colored textile fabric inventory sample image for the identification of the colored textile fabric type.
[0134] In step 7, the model is deployed to the server using the partitioned dataset to ensure the underlying feature extraction capabilities are solidified. The model is based on the previously completed feature encoder training results, freezing the pre-trained multimodal feature encoder parameters. The input layer receives the processed multimodal feature vectors of the spun-dyed yarn. The model is trained for 2000 rounds, with a batch size of 16 and a weight decay coefficient of 0.001.
[0135] The fully connected classification layer in the feature contribution metricization module outputs the category probability distribution, and the cross entropy loss function is used to measure the difference between the predicted distribution and the true label distribution. Only the feature contribution metricization model and the classification layer parameters are updated through backpropagation (the basic encoder remains frozen).
[0136] Furthermore, based on the feature contribution quantification model training, the contribution of color, shape and texture features to the prediction results is quantified through gradient back propagation. 、 and , the specific steps are as follows: Assume that the model is for the color spinning category The predicted probability is ,but Shape features , texture features and color characteristics The gradients are:
[0137] , , ;
[0138] gradient , , These respectively reflect the extent to which slight changes in shape, texture, and form characteristics affect the prediction results of color-spun yarn types.
[0139] The gradient is then multiplied element-wise with the original feature to obtain the initial contribution value:
[0140] , , ;
[0141] Perform global average pooling and Softmax normalization on the contribution value to obtain the final contribution ratio:
[0142] , , ;
[0143] at this time .
[0144] Step 8: The color-woven fabric sample to be retrieved is operated according to the above steps 2-3 to obtain its optical image and color, texture and shape independent feature maps, and the images are input into the feature encoder model optimized in step 5 and the feature contribution quantization model optimized in step 7 respectively, to obtain the color, texture and shape feature vectors and corresponding feature weights of the color-woven fabric sample to be retrieved, perform dynamic weighted fusion and search in the color-woven fabric sample library to obtain the results.
[0145] In step 8, for each image in the database, use the above steps to extract the color , Texture ,shape The eigenvectors and their corresponding weights , , , each feature vector is normalized to ensure the consistency of similarity calculation, and the normalized feature vectors and weights are stored in the database.
[0146] Repeat the above steps for the image to be retrieved provided by the user to extract three feature vectors , , and the corresponding weights , , , and normalize the eigenvectors.
[0147] Perform the dynamic weighted fusion step and use cosine similarity to measure the similarity between the query image and the database image in each feature direction. The calculation formula is as follows:
[0148] , , ;
[0149] in, 、 、 Represents the similarity in color, texture, and shape respectively; then combines the weights of the query and the database to calculate the weighted score:
[0150] ;
[0151] Finally, the database images are sorted in descending order according to the scores and the Top-K results are returned.
[0152] To verify the effectiveness of the search method, this application selected six types of dyed textile samples produced by a dyed yarn spinning and weaving company: spring bud yarn, spring bud slub yarn, neon yarn, cotton hand-spun yarn, cotton water mosquito yarn, and star-colored yarn, and collected their production process parameters. After experimental verification, some experimental results are shown in the following table:
[0153] Table 1 Verification accuracy of feature contribution quantification module
[0154]
[0155] Table 2 TOP-10 recall
[0156]
[0157] Finally, the average TOP-10 recall rate for the retrieval of various colored textile samples was 98.09%, which effectively met the retrieval needs of enterprises in the preparation of colored textile samples.
[0158] It should be understood that the above description of the preferred embodiment is relatively detailed and cannot be regarded as limiting the scope of protection of the patent of the present invention. Ordinary technicians in this field can make substitutions and modifications under the guidance of the present invention, which all fall within the scope of protection of the present invention.
Claims
1. A method for retrieval of dyed fabric images based on dynamic feature contribution, characterized in that: The steps include: Step 1: Classify and collect the dyed fabric samples to obtain the dyed fabric inventory samples; Step 2: collecting optical images of dyed fabric samples and preprocessing them to establish a standardized data set; Step 3: Perform multimodal feature decoupling on the optical image to separate three independent feature maps: color, texture, and shape; Step 4: Design three completely independent feature encoders for color, texture, and shape, encode the three independent feature maps of color, texture, and shape respectively, and obtain the predicted value of the type of the dyed fabric; Step 5: Calculate the loss between the predicted value of the dyed fabric type and the true label of the dyed fabric type using a loss function, optimize the model parameters in step 4, and use the optimized feature encoder model to extract discrete feature vectors of color, texture, and shape of the dyed fabric inventory sample image; Step 6: Design a feature contribution quantification model. This model aggregates discrete feature vectors and performs color-woven fabric category recognition to obtain category probability distributions. It also evaluates the contribution of each visual feature to color-woven fabric category recognition and achieves adaptive optimization of feature weight allocation. Step 7: Calculate the loss of the probability distribution of the color textile category and the true label of the color textile category using the loss function, optimize the model parameters in step 6, and update only the relevant parameters of the feature contribution quantization model through backpropagation based on the frozen feature encoder in step 5. Then, use the optimized model to output the feature weights of the color, texture, and shape features in the color textile inventory sample image for color textile category identification. Step 8: Process the dyed fabric sample to be retrieved according to the above steps 2-7 to obtain the corresponding feature weights, perform dynamic weighted fusion and search in the dyed fabric sample library to obtain the results.
2. The method for retrieval of a yarn-dyed fabric image based on dynamic feature contribution as claimed in claim 1, characterized in that: In step 1, the yarn-dyed fabric samples are classified and collected according to the appearance pattern style to obtain the yarn-dyed fabric inventory samples, and the corresponding relevant process parameters are collected at the same time, so as to facilitate the rapid and accurate retrieval and associate the yarn-dyed fabric images with their process sheets; The appearance pattern styles of color-dyed fabrics include slub yarn, phantom yarn, star-colored yarn, neon yarn, and siro-dyed yarn. The process parameters include the type and proportion of fiber base colors, mixing method, coarse / fine yarn spindle speed, mechanical draft ratio, twist coefficient, roller gauge and related environmental control parameters.
3. The method for retrieval of a yarn-dyed fabric image based on dynamic feature contribution as claimed in claim 1, characterized in that: In step 2, the color feature decoupling process is first performed, and each channel of the RGB image is converted to the frequency domain by performing a two-dimensional fast Fourier transform, randomly disturbing the phase information, and restoring the image by a two-dimensional inverse fast Fourier transform to obtain a pure color feature map. ; The texture feature decoupling process is performed on the images in the standardized dataset. First, the RGB image of the sample image is grayscaled to remove the color information. Then the grayscale image is divided into a group of square patches to destroy the original shape information. Then these patches are randomly re-sorted and connected to form a new texture image, and the texture feature map of the sample image is obtained. ; The image in the standardized data set is decoupled from the shape features. After graying the image, a Gaussian low-pass filter is applied. The Sobel operator obtains the horizontal and vertical gradients, and then calculates the gradient amplitude and direction of the edge. The calculated gradient amplitude is normalized and combined with the direction to obtain the final shape feature map. .
4. The method for retrieval of a yarn-dyed fabric image based on dynamic feature contribution as claimed in claim 1, characterized in that: The specific steps of color feature decoupling processing are as follows: Given an image , for the image Perform a two-dimensional fast Fourier transform (2D FFT) on the j channel to get the output , the formula is as follows; ; in, , Indicates the size of the image, C is the number of channels, Representing an image The j channel, , j=1,2,...,C, represents the modulus, Indicates angle; Furthermore, applying the 2D Fast Fourier Transform to the random matrix , and get the transformed result and its modulus s and angle , as follows: ; Among them, s refers to the modulus of the transformed component, using 、 and , construct a new subvariable , It is a disturbance factor. The secondary variable is mapped back through the two-dimensional inverse fast Fourier transform 2D IFFT, and the rescale operation is performed to rescale the result to the range of [0, 255] to obtain the color feature map. ,in and Showing the same pixel color value distribution, the specific formula is as follows: ; where j=1,2,...,C and yes The j channel.
5. The method for retrieval of a yarn-dyed fabric image based on dynamic feature contribution as claimed in claim 1, characterized in that: In step 4, the color feature map , texture feature map , shape feature map The three types of feature maps are input into the feature encoder respectively, color, texture, and shape feature encoders 、 、 The structure is consistent. Its core structure is composed of stacked residual modules, which contains several layers of deep neural networks. The network structure is divided into the following modules: Input preprocessing layer: The input data first passes through a 7×7 large kernel convolution layer, where the color encoder maintains three-channel input, and the texture and shape encoders change to single-channel input, outputting a multi-channel feature map. BatchNorm batch normalization and ReLU activation are then performed. The formula is as follows: ; In the above formula, Represents the feature map input to the encoder, H and W represent the size and height of the image, and C represents the number of channels. represents the 7×7 convolution kernel weight, represents the bias term; Through the 3×3 maximum pooling layer, spatial downsampling is completed, and the feature map size is compressed to 1 / 4 of the original input. The formula is as follows: ; Residual module stacking structure: It consists of 4 stages, each stage contains 2 residual blocks, each residual block consists of two 3×3 convolution kernels, BatchNorm batch normalization and ReLU activation are inserted between convolution layers. When the feature map size is halved, convolution is used for downsampling. At the same time, when the number of input and output channels is inconsistent or the feature map size changes, the channel dimension of the jump connection shortcut is adjusted through a 1×1 convolution kernel. The formula for implementing residual connection is as follows: ; in Indicates the The output of the jth neuron in stage, Indicates the The output of the jth neuron in stage, 、 Represents the two 3×3 convolution kernel weights in each stage, 、 They represent the bias terms in the two convolution operations respectively, the shortcut is the dimension matching operation, and the final output to the fourth stage ; Feature encoding output module: The global average pooling layer is used to compress the spatial dimension to 1×1, and then input into the fully connected layer FC adapted to the current task. The output dimension is adjusted to the specified number of categories class_num. The formula is as follows: ; in, are the predicted values of the three features for the type of yarn-dyed fabric, is the weight of the fully connected layer, is the bias term of the fully connected layer.
6. The method for retrieval of a yarn-dyed fabric image based on dynamic feature contribution as claimed in claim 5, characterized in that: In step 5, the input layer receives the feature map data of different categories of colored yarns, including color, shape, and texture multi-channel features, and generates prediction labels through the forward propagation process. ; In the back propagation stage, the cross entropy loss between the predicted result and the true label is calculated. The specific formula is as follows: ; in The true labels of the dyed fabric types corresponding to the color, texture, and shape are obtained; and the model parameters are iteratively optimized using the gradient descent algorithm.
7. The method for retrieval of a yarn-dyed fabric image based on dynamic feature contribution as claimed in claim 1, characterized in that: In step 7, the category probability distribution is output through the fully connected classification layer, and the cross entropy loss function is used to measure the difference between the predicted distribution and the true label distribution.
8. The method for retrieval of a yarn-dyed fabric image based on dynamic feature contribution as claimed in claim 1, characterized in that: After the three independent feature encoders are trained, the color feature map , texture feature map , shape feature map Mapped to color feature vectors , texture feature vector , shape feature vector , and serves as the input to the feature contribution metric model, in which the multimodal feature vectors are first fused through a tensor concatenation layer: ; Then the average pooling layer Avgpool is used to compress the spatial dimension, and the feature dimension is expanded by the Flatten operation: ; For the multi-level structure of the fully connected layer, the linear layer, ReLU activation function, and linear layer connection are used in sequence: ; Where z is the output of the fully connected layer, W1, W2 are weight matrices, and b1, b2 are biases; Finally, the Softmax function is used to output the category probability prediction value u, and the formula is as follows: ; in Color spinning category for models The predicted probability of is the output of the fully connected layer for category y, and K is the total number of categories.
9. The method for retrieval of a yarn-dyed fabric image based on dynamic feature contribution as claimed in claim 1, characterized in that: After the feature contribution quantification model is trained, the contribution of color, shape and texture features to the prediction results is quantified through gradient back propagation. 、 and , the specific steps are as follows: Assume that the model is for the color spinning category The predicted probability is ,but Shape features , texture features and color characteristics The gradients are: , , ; gradient , , These respectively reflect the degree of influence of slight changes in shape, texture and form characteristics on the prediction results of color-spun yarn types; The gradient is then multiplied element-wise with the original feature to obtain the initial contribution value: , , ; Perform global average pooling and Softmax normalization on the contribution value to obtain the final contribution ratio: , , ; at this time .
10. The method for retrieval of a yarn-dyed fabric image based on dynamic feature contribution as claimed in claim 9, characterized in that: In step 8, for each image in the database, use the extracted color feature vector , texture feature vector , shape feature vector and its corresponding weight , , , normalize each feature vector to ensure the consistency of similarity calculation, and store the normalized feature vector and weight in the database; For the image to be retrieved provided by the user, three feature vectors are also extracted , , and the corresponding weights , , , and normalize the eigenvector; Perform the dynamic weighted fusion step and use cosine similarity to measure the similarity sim between the query image and the database image in each feature direction. The calculation formula is as follows: , , ; in, 、 、 Represents the similarity in color, texture, and shape respectively; then combines the weights of the query and the database to calculate the weighted score: ; Finally, the database images are sorted in descending order according to the scores, and the K results with the highest similarity are returned.
Citation Information
Patent Citations
Fabric image retrieval method and device based on deep learning
CN114579788A
Self-attention-based method for detecting defective area of color-textured fabric
WO2023070911A1