Intelligent Color Matching and Dyeing Quality Prediction Method and System for Yarn Packages
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-08
- Publication Date
- 2026-08-11
AI Technical Summary
这种割裂的优化模式,无法保障染色“一次成功”这一工业生产的最终目标
1、通过构建包含并行L*a*b*与光谱反射率双输出分支的Transformer网络架构,并在损失函数中引入光学理论约束,使得颜色预测模型兼具数据驱动的非线性拟合能力和物理模型的光学一致性,从而在复杂染色条件和数据稀疏区域均能保持稳定可靠的预测精度,提升了模型在筒子纱低浴比、高浓度等非线性染色场景下的适用性。
Smart Images

Figure CN122334627B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic digital data processing technology, specifically to a method and system for intelligent color matching and dyeing quality prediction of yarn packages. Background Technology
[0002] In the field of packaged yarn dyeing, color matching is a crucial step that relies entirely on the personal experience of the colorist. Given a standard color sample from a client, the colorist, based on their accumulated experience, estimates the types of dyes to be used and the concentration ratios of each dye. This is followed by a complete physical sampling process involving winding, pretreatment, dyeing, post-treatment, dehydration, and drying to verify the effect. This process has an extremely low success rate on the first attempt, often requiring repeated, iterative "trial and error" corrections to gradually approach the target color. This not only results in sampling cycles lasting several days but also consumes significant amounts of manpower, utilities, and material costs, constituting a core bottleneck for companies' rapid-response production.
[0003] To address this issue, the industry has attempted to introduce data-driven color prediction models, utilizing deep neural networks to learn the complex nonlinear mapping relationship between dyeing formulas and final colors from historical sampling data. However, purely data-driven models exhibit a significant decrease in generalization ability in new color regions with sparse data, and the prediction results may even violate basic optical principles, leading to physically unreliable predictions. This not only limits the practical application value of the model in scenarios such as new color development and small-batch, multi-variety orders, but also means that when subsequently optimizing formulas based on the predicted color, the optimization direction may deviate from physical reality from the outset, causing potential quality risks.
[0004] Furthermore, current technologies generally treat color matching and subsequent dyeing quality control as two independent, sequential steps. The color matching stage only aims to achieve a close approximation between the formulated color and the target color, while dyeing quality indicators are affected not only by the dyeing formula but also by multiple dyeing process parameters. Due to the lack of a systematic prediction of the overall quality of the dyeing result at the color matching stage, even if a formula is qualified in terms of color, it often needs to be reworked or scrapped after actual dyeing due to quality problems such as substandard color fastness and severe color differences between inner and outer layers. This fragmented optimization model cannot guarantee the ultimate goal of industrial production: dyeing "success on the first try." Summary of the Invention
[0005] This application provides a method and system for intelligent color matching and dyeing quality prediction of packaged yarn, which can improve the accuracy of the dyeing quality prediction results of packaged yarn, so that the output formula can not only approach the target in the color dimension, but also meet the quality standards.
[0006] The first aspect of this application provides a method and system for intelligent color matching and dyeing quality prediction of yarn packages, the method comprising: Obtain the yarn dyeing database; An improved Transformer deep neural network was constructed and trained to obtain a hybrid-driven color prediction model; The hybrid-driven color prediction model is used as a positive evaluation function to construct a smart color matching model; Obtain target color data and input the target color data into the intelligent color matching model for solution to obtain color matching parameters; Based on the color matching parameters and dyeing process parameters, a dyeing quality prediction model is constructed; The color matching parameters and dyeing process parameters acquired in real time are input into the dyeing quality prediction model for quality verification, and the dyeing quality prediction results are obtained.
[0007] In one possible implementation, the improvement of the Transformer deep neural network to construct and train a hybrid-driven color prediction model includes: The architecture of the Transformer deep neural network is improved to obtain an improved Transformer deep neural network; The loss function of the Transformer deep neural network is constructed to obtain the hybrid driving loss function; The improved Transformer deep neural network is trained with the hybrid driving loss function as the target to obtain a hybrid driving color prediction model.
[0008] In one possible implementation, improving the architecture of the Transformer deep neural network to obtain an improved Transformer deep neural network includes: The input embedding layer is reconstructed to obtain a multimodal input fusion layer for categorical and numerical variables; A multi-head self-attention mechanism is introduced to calculate the attention weight matrix between input features, resulting in a multi-dimensional feature representation after residual connection and layer normalization. The multidimensional feature representation is flattened into a one-dimensional flattened vector, and a shared feature vector is output through four hidden layers using an expansion-then-compression approach. Construct parallel L*a*b* output branches and spectral reflectance output branches, and input the shared feature vector into the L*a*b* output branches and spectral reflectance output branches respectively to obtain L*a*b* color prediction values and spectral reflectance prediction values; A non-trainable color space conversion module is constructed, and the predicted spectral reflectance value is input into the color space conversion module to obtain the L*a*b* color conversion value.
[0009] In one possible implementation, constructing the loss function of the Transformer deep neural network to obtain a hybrid driving loss function includes: Construct a data-driven loss term based on the predicted L*a*b* color values; A physical consistency loss term is constructed based on the L*a*b* color conversion value and the spectral reflectance prediction value. Construct a concentration-color depth monotonicity constraint loss term; The L*a*b* data-driven loss term, the spectral reflectance physical consistency loss term, and the concentration-color depth monotonicity constraint loss term are weighted and summed to obtain the hybrid driving loss function.
[0010] In one possible implementation, the step of using the hybrid-driven color prediction model as a positive evaluation function to construct a smart color matching model includes: The hybrid-driven color prediction model is used as a positive evaluation function, with the optimization objectives being to minimize the CMC color difference between the predicted color and the target color, minimize the metamerism index, minimize the formulation cost, and maximize the color fastness prediction score. A smart color matching model is obtained by using constraints such as dye concentration range, total dye concentration upper limit, color difference tolerance, compatibility, low liquor ratio solubility, and formulation cost upper limit.
[0011] In one possible implementation, the step of inputting the target color data into a smart color matching model for solving to obtain color matching parameters includes: The target color data is matched with historical formulas in the yarn dyeing database; Select the solution path based on the matching results; When global optimization is triggered, an adaptive multi-group cooperative search algorithm is used to solve the multi-objective constrained optimization problem and obtain the Pareto optimal solution set. The Pareto optimal solution set is filtered, and the color matching parameters are output.
[0012] In one possible implementation, the step of using an adaptive multi-group cooperative search algorithm to solve the multi-objective constrained optimization problem to obtain a Pareto optimal solution set includes: Construct a main population, a compatibility-oriented auxiliary population, and a domain knowledge-guided auxiliary population; We introduce a Pareto front based on crowding distance to guide individual selection, and provide differentiated guidance for three foraging strategies: chain foraging, whirlwind foraging, and tumbling foraging. The execution probability of each foraging strategy is adaptively adjusted based on the population convergence state. Boundary constraints in the constraints are repaired by boundary mapping, compatibility constraints and low bath ratio solubility constraints are handled by adaptive penalty functions, and color difference tolerance constraints are handled by feasibility criteria. Elite individuals migrate periodically between the three groups; When the termination condition is met, output the Pareto optimal solution set in the external archive.
[0013] In one possible implementation, constructing a dyeing quality prediction model based on the color matching parameters and dyeing process parameters includes: Extract a sample set of color matching parameters, dyeing process parameters, and corresponding dyeing quality index data from the yarn dyeing database; Construct a candidate model pool containing multiple heterogeneous regression models; The models in the candidate model pool are evaluated from multiple dimensions and scored according to preset evaluation indicators. According to the preset screening mode, the model with the best score is selected from the candidate model pool as the staining quality prediction model.
[0014] In one possible implementation, the step of inputting the real-time acquired color matching parameters and dyeing process parameters into the dyeing quality prediction model for quality verification to obtain the dyeing quality prediction result includes: The color matching parameters and dyeing process parameters acquired in real time are input into the dyeing quality prediction model to obtain the predicted values of various dyeing quality indicators; The predicted values of each staining quality indicator are compared with the preset quality tolerance. When the predicted value meets the quality tolerance, the decision is passed, and the corresponding color matching parameters and dyeing process parameters are released to the production stage. If the predicted value does not meet the quality tolerance, the result is deemed unsuccessful, and the formula is corrected.
[0015] This example proposes a method for intelligent color matching and dyeing quality prediction of packaged yarn. First, a hybrid-driven color prediction model incorporating physical constraints is constructed to achieve a precise positive mapping from formula to color. Then, the hybrid-driven color prediction model is embedded into a multi-objective intelligent color matching model as an evaluation function to solve for the optimal formula under constraints. Finally, a dyeing quality prediction model is introduced to predict the quality of the recommended formula; only when the predicted quality meets the standards is the formula released to production. This invention mainly includes the following beneficial effects: 1. By constructing a Transformer network architecture that includes parallel L*a*b* and spectral reflectance dual output branches, and introducing optical theory constraints into the loss function, the color prediction model combines data-driven nonlinear fitting capabilities with the optical consistency of the physical model. This enables the model to maintain stable and reliable prediction accuracy under complex dyeing conditions and in data-sparse regions, thereby improving its applicability in nonlinear dyeing scenarios such as low bath ratio and high concentration of yarn.
[0016] 2. By incorporating the color fastness prediction score into the color matching optimization objective and establishing yarn-specific constraints such as compatibility constraints and low liquor ratio solubility constraints, the color matching process is no longer solely focused on color matching. The output recommended formula achieves comprehensive optimization in terms of color accuracy, fastness performance, and process feasibility. A feasible formula that balances visual quality and intrinsic quality can be obtained in a single color matching process.
[0017] 3. By using the dyeing quality prediction model as a virtual sampling engine, the candidate formula is verified for quality before production. A decision mechanism of verification before dyeing is constructed. In this way, the formula is released to production only when the predicted values of quality indicators meet the preset conditions, thereby greatly reducing the number of invalid physical samplings and reducing the rework rate.
[0018] A second aspect of this application provides a smart color matching and dyeing quality prediction system for yarn packages, the system comprising: The first module is used to obtain the yarn dyeing database; The second module is used to improve the Transformer deep neural network, build and train a hybrid-driven color prediction model; The third module is used to construct a smart color matching model by using the hybrid-driven color prediction model as a positive evaluation function. The fourth module is used to acquire target color data and input the target color data into the intelligent color matching model for solving to obtain color matching parameters; The fifth module is used to construct a dyeing quality prediction model based on the color matching parameters and dyeing process parameters; The sixth module is used to input the real-time acquired color matching parameters and dyeing process parameters into the dyeing quality prediction model for quality verification, and to obtain the dyeing quality prediction result.
[0019] A third aspect of this application provides a terminal including a processor, an input device, an output device, and a memory, wherein the processor, input device, output device, and memory are interconnected, and the memory is used to store a computer program, the computer program including program instructions, and the processor is configured to invoke the program instructions to execute the steps of the intelligent color matching and dyeing quality prediction method for yarn packages in the first aspect of this application.
[0020] A fourth aspect of this application provides a computer-readable storage medium storing a computer program for electronic data interchange, wherein the computer program causes a computer to perform some or all of the steps described in the intelligent color matching and dyeing quality prediction method for yarn packages in the first aspect of this application.
[0021] A fifth aspect of this application provides a computer program product, comprising a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps described in the intelligent color matching and dyeing quality prediction method for yarn packages in the first aspect of this application. The computer program product may be a software installation package. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This application provides a schematic diagram of the overall process for a method of intelligent color matching and dyeing quality prediction for yarn packages. Figure 2 This application provides a schematic diagram of the overall structure of a smart color matching and dyeing quality prediction system for yarn packages. Figure 3 This application provides a schematic diagram of the structure of a terminal. Figure label: Module 1-1, Module 2-2, Module 3-3, Module 4-4, Module 5-5, Module 6-6. Detailed Implementation
[0024] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] The terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0026] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application can be combined with other embodiments.
[0027] The intelligent color matching and dyeing quality prediction method for packaged yarn is applied to the intelligent color matching and dyeing quality prediction system for packaged yarn. Figure 1 A schematic diagram of the overall process for a method of intelligent color matching and dyeing quality prediction for packaged yarn is shown. Figure 1 As shown, it includes: S1. Obtain the yarn dyeing database.
[0028] Before building the database, it is necessary to first clarify the complete process flow of package yarn dyeing, because the data acquisition nodes must correspond to the actual production process. The standard process for package yarn dyeing is: winding (loosening) → loading yarn → dyeing (pretreatment → dyeing → posttreatment) → dehydration → drying → inspection.
[0029] Brief descriptions of each process and data acquisition nodes: 1) Winding (loosening the cone): The raw yarn is wound at a set density (generally 0.30~0.40 g / cm for cone dyeing). 3 It is wound onto a porous bobbin. This process generates basic yarn attribute data (yarn type, count, bobbin density, etc.).
[0030] 2) Loading yarn: Thread the yarn cones into the yarn cage core of the dyeing machine. Record the loading information at this stage.
[0031] 3) Pretreatment: Removes impurities and oils from the yarn surface to achieve good water absorption and whiteness. This step determines the amount of chemical auxiliaries used and the process parameters for pretreatment.
[0032] 4) Dyeing: The core process. The dye liquor repeatedly penetrates the yarn layer under the drive of the main pump. This process generates dynamic process parameters such as dye formulation, auxiliary agent formulation, temperature rise curve, holding time, main pump frequency / flow rate, and forward and reverse circulation cycles. The pump flow rate is generally required to be in the range of 25~60 L / kg·min, and the head water column is 10~20 m.
[0033] 5) Post-treatment: Washing, soaping, and color fixing after dyeing. This step determines the amount of chemical auxiliaries used and the process parameters for post-treatment.
[0034] 6) Dehydration and drying: After centrifugal dehydration, the product enters the drying equipment (radio frequency drying or hot air drying).
[0035] 7) Inspection: Conduct quality inspection on the finished yarn packages to generate color data (spectral reflectance / L*a*b* value) and various quality indicators (color difference, color fastness grade, color difference between inner and outer layers, strength, etc.).
[0036] Furthermore, based on the data from the above steps, a yarn dyeing database is constructed. The following table presents the complete structure of the database and marks the role of each data item in the color prediction model and the dyeing quality prediction model (★ indicates model input, ● indicates model output, and - indicates no participation in the model), as shown in Table 1.
[0037] Table 1. Overall Database Structure and Model Input / Output Comparison Table All color data and measured values of quality indicators are obtained by the inspection process using equipment such as spectrophotometers, standard gray cards, and strength testers, and are stored in association with the corresponding formula batch numbers to ensure a one-to-one correspondence between input and output data.
[0038] S2. Improve the Transformer deep neural network to construct and train a hybrid-driven color prediction model.
[0039] In traditional dyeing formulation design, color prediction models are the core engine for achieving "given formulation → predicted color". Existing color prediction methods are mainly divided into two categories: Pure physical model: Based on the Kubelka-Munk (KM) optical theory, this model predicts spectral reflectance by calculating the linear relationship between the K / S ratio and dye concentration. The KM theory assumes the dyeing layer is an ideal, uniform plane where light only undergoes absorption and scattering. However, the linear assumption of the pure KM model fails in scenarios involving fluorescent dyes and high-concentration dyeing. Furthermore, under low liquor ratio (1:3~1:11) conditions in yarn packages, the nonlinear characteristics of dye solubility and adsorption behavior become more pronounced, leading to decreased prediction accuracy. In addition, the KM theory requires establishing separate baseline data for each dye, resulting in a significant workload.
[0040] Pure data-driven models: These models use deep neural networks to directly learn the mapping from recipe parameters to color values. While these methods can capture non-linear interactions, they require large amounts of high-quality training data, have insufficient generalization ability in sparse data regions, and their predictions may violate fundamental optical principles.
[0041] This example proposes a hybrid-driven color prediction model. By embedding KM optical theory as a physical constraint into the loss function of a deep neural network, a deep neural network is constructed. This allows the model to both learn complex nonlinear mapping relationships from data and adhere to the laws of optical physics. In the scenario of yarn dyeing and color matching, this method can fully utilize historical sampling data while maintaining the physical rationality of predictions in data-sparse color gamut regions. Existing research shows that physical information methods can integrate domain knowledge (such as the CMC color difference formula) into multi-output regression models, enabling the model to learn the subtle relationships between dyeing process variables and the final color output, thereby improving overall prediction accuracy. The input parameters of the hybrid-driven color prediction model are the yarn basic properties and dyeing formula data in Table 1, and the output parameters are the color data in Table 1.
[0042] This example uses a deep neural network based on the Transformer attention mechanism as its main architecture. Compared with traditional fully connected networks, the Transformer's self-attention mechanism can effectively capture the complex interactions between input variables (yarn properties, dye types, and dye concentrations).
[0043] Step S2 includes the following sub-steps: S201. Improve the architecture of the Transformer deep neural network to obtain the improved Transformer deep neural network.
[0044] Step S201 includes: S2011. Reconstruct the input embedding layer to obtain a multimodal input fusion layer for categorical and numerical variables.
[0045] Specifically, categorical variables (yarn type, dye type) are mapped to low-dimensional dense vectors through an embedding layer, and then concatenated with numerical variables (yarn count, winding density, dye concentration) to form a unified input feature representation. .
[0046] S2012. Introduce a multi-head self-attention mechanism to calculate the attention weight matrix between input features, and obtain a multi-dimensional feature representation after residual connection and layer normalization.
[0047] This approach incorporates a multi-head self-attention mechanism, calculating the attention weight matrix between input features to adaptively focus on key variables that significantly contribute to color formation (such as the concentration of the dominant hue dye). The output of the self-attention layer is then processed through residual connections and layer normalization to obtain the feature representation. .
[0048] S2013. The multidimensional feature representation is flattened into a one-dimensional flattened vector, and a shared feature vector is output through four hidden layers using a method of first expanding and then compressing.
[0049] In this design, a multi-layer fully connected network is used in the feedforward layer to perform a nonlinear transformation on the output of the self-attention layer, with GELU as the activation function. The network depth is set to four hidden layers, with 256, 128, 128, and 64 neurons in each layer, forming a "expansion-then-compression" structure to fully extract the deep features between the staining formula and the color. This part is a shared feature extraction layer for L*a*b* output and spectral reflectance output.
[0050] S2014. Construct parallel L*a*b* output branches and spectral reflectance output branches, and input the shared feature vector into the L*a*b* output branches and spectral reflectance output branches respectively to obtain L*a*b* color prediction values and spectral reflectance prediction values.
[0051] In this example, two parallel output branches are designed after the shared feature layer: The L*a*b* output branch contains a fully connected hidden layer (32 neurons), activated by ReLU, followed by three independent linear output heads that output the predicted values of L*, a*, and b*, respectively. For L* values, the output layer is scaled to [0, 100] using the Sigmoid function; for a* and b* values, it is scaled to [-128, 127] using the Tanh function.
[0052] The spectral reflectance output branch consists of a fully connected hidden layer (64 neurons) with the ReLU activation function, followed by a linear output layer (16 neurons), where each neuron corresponds to a wavelength point. Spectral reflectance prediction The output layer uses the Sigmoid function to constrain the reflectivity within the range of [0,1].
[0053] S2015. Construct an untrainable color space conversion module, and input the predicted spectral reflectance value into the color space conversion module to convert it into L*a*b*color conversion value.
[0054] Among them, the spectral reflectance output branch prediction The corresponding L*a*b* value is calculated using the standard CIE color space conversion formula and denoted as . This module is only used to calculate the physical loss and does not participate in the backpropagation of model parameters, thus avoiding nonlinear interference from color space conversion during backbone network training.
[0055] S202. Construct the loss function of the Transformer deep neural network to obtain the hybrid driving loss function.
[0056] Step S202 includes the following steps: S2021. Construct a data-driven loss term based on the predicted L*a*b* color values.
[0057] For the L*a*b* output branch, the CMC color difference formula is used to measure the difference between the predicted and measured values. The CMC color difference formula is: (1) in, These are the color difference values, where ΔL*, ΔC*, and ΔH* represent the difference in lightness, saturation, and hue, respectively. c are adjustable parameters (in textile dyeing, l=2 and c=1 are usually taken). , , This is the weighting factor.
[0058] The L*a*b* data loss term is defined as: (2) in, The number of training samples, The L*a*b* value predicted by the model. These are measured values. For L*a*b* data-driven loss term, This is the nth sample.
[0059] S2022. Construct a physical consistency loss term based on the L*a*b* color conversion value and the spectral reflectance prediction value.
[0060] Among them, the physical consistency loss term is used to constrain the prediction results of the spectral reflectance branch to be consistent with the reflectance calculated based on KM theory, thereby realizing the integration of physical information.
[0061] The basic relationships in KM theory are: (3) In the formula, Let K be the spectral reflectance for infinite thickness, K be the absorption coefficient, and S be the scattering coefficient. For dyeing formulations, the K / S value approximately has a linear superposition relationship with the concentrations of each dye: (4) In the formula, The contribution coefficient of the i-th dye per unit concentration (K / S) at wavelength λ (can be pre-calibrated by a single-color dye dyeing experiment). This refers to the dye concentration. The K / S value is for the undyed yarn base (white yarn).
[0062] Further, the calculation process for physical consistency loss: For each training sample, based on the input dye concentration and pre-calibrated Based on the substrate K / S ratio, the theoretical K / S value is calculated using the KM linear superposition formula, and then the theoretical spectral reflectance is obtained by inverse calculation. : (5) In the formula, Theoretical spectral reflectance, This is the wavelength parameter.
[0063] Calculate the predicted value of the output branch of spectral reflectance. Compared with theoretical reflectivity Mean square error between: (6) in It is a set of wavelength points (16 wavelengths).
[0064] In the formula, Predicted value for the spectral reflectance output branch Compared with theoretical reflectivity The mean square error between them For n samples, predict the reflectance at wavelength λ using a model. The model outputs the predicted value. Let KM reflectance be the theoretical KM reflectance of the nth sample at wavelength λ, and the target value be calculated theoretically. It is a set of wavelength points (16 wavelengths).
[0065] To further enhance physical consistency, the L*a*b* values obtained by color space transformation from the spectral reflectance branch were also calculated. CMC color difference between the measured L*a*b* values and the actual values: (7) In the formula, This represents the CMC color difference loss value. For the prediction L*a*b* of the nth sample, Let L*a*b* be the measured value of the nth sample.
[0066] The physical consistency loss term for spectral reflectance combines the above two parts: (8) In the formula, These represent the weights of the mean square error term for spectral reflectance and the weights of the CMC color difference term after color space conversion (recommended values: ), This represents the mean square error of spectral reflectance.
[0067] S2023, Construct a concentration-color depth monotonicity constraint loss term.
[0068] According to the basic physical laws of dyeing, the higher the total dye concentration, the deeper the color, i.e., the lower the L* value. This loss term penalizes predictions that violate this monotonicity law.
[0069] For each training sample, calculate the total dye concentration. Compared with the predicted L* value The Pearson correlation coefficient between them. Due to the monotonicity requirement, L* and Negative correlation, the monotonicity loss is defined as: (9) In the formula, For monotonicity-constrained loss terms, The brightness value predicted by the model. This represents the total dye concentration. The correlation coefficient is the Pearson correlation coefficient. When the correlation coefficient is positive (i.e., the higher the concentration, the higher the L*), the loss is positive, and the model is penalized; when the correlation coefficient is negative, the loss is zero.
[0070] In actual batch training, It is calculated from all samples in the current batch. Gradient penalty can also be used, but the correlation coefficient form is more stable and easier to implement.
[0071] S2024. The L*a*b* data-driven loss term, the spectral reflectance physical consistency loss term, and the concentration-color depth monotonicity constraint loss term are weighted and summed to obtain the hybrid driving loss function.
[0072] The above three losses are weighted and combined to form a hybrid driving loss function: (10) In the formula, For hybrid driving loss function, To control the strength of the physical consistency constraint (an initial value of 0.3 is recommended, which can be appropriately increased in the later stages of training); To control the strength of the monotonicity constraint (recommended value 0.1), a dynamic weighting strategy can be used during training: initially, data-driven approaches should be prioritized. The physical constraint weights are gradually increased as training progresses, allowing the model to fully learn data patterns when data is plentiful, and to maintain the reasonableness of predictions by relying on physical constraints when data is sparse. This is the physical consistency loss term for spectral reflectance. This is a loss term constrained by monotonicity.
[0073] S203. Using the hybrid driving loss function as the target, train the improved Transformer deep neural network to obtain the hybrid driving color prediction model.
[0074] The process involves extracting the input and output data required for the color prediction model from the yarn dyeing database. Numerical variables (yarn count, winding density, dye concentration) are standardized using Z-scores; categorical variables (yarn type, dye type) are encoded with integers and then processed through an embedding layer.
[0075] Furthermore, the KM baseline coefficients need to be calibrated. Before model training, the K / S contribution coefficient per unit concentration of each dye at different wavelengths needs to be calibrated. And the base K / S value. The calibration method is as follows: For each dye, prepare single-color package yarn dyeing samples with different concentrations (e.g., 0.5%, 1.0%, 2.0%, 3.0%, 4.0% owf), measure the spectral reflectance and convert it into K / S value, and obtain the unit concentration K / S coefficient by fitting the linear relationship between K / S value and concentration through the least squares method.
[0076] Furthermore, during model training, the preprocessed dataset was divided into training, validation, and test sets in a 70%:15%:15% ratio; the AdamW optimizer was used for parameter updates, with an initial learning rate of 1×10⁻⁶. -3 The weight decay coefficient is set to 1×10. -5 The learning rate is scheduled using a cosine annealing strategy, decaying the learning rate to 0.5 every 200 training epochs. During training, the total loss on the validation set is monitored; if no improvement is observed after 50 consecutive epochs, an early stopping mechanism is triggered. The maximum number of training epochs is set to 1000, and the batch size is selected between 32 and 128 based on the actual data size. During training, the CMC color difference and spectral reflectance consistency loss of the L*a*b* branch outputs on both the training and validation sets are recorded synchronously. and monotonicity constraint loss When the color difference of the validation set CMC continues to decrease and the various physical loss terms tend to stabilize, it indicates that the model has fully learned the data patterns and effectively followed the optical physical constraints, and the training is complete.
[0077] In practical applications, simply enabling the L*a*b* output branch and inputting the staining formula will quickly yield the predicted L*, a*, and b* values. When metamerism needs to be evaluated or further analysis is required, the spectral reflectance output branch can be additionally invoked.
[0078] S3. Using the hybrid-driven color prediction model as a positive evaluation function, construct a smart color matching model.
[0079] Building upon the established "hybrid-driven color prediction model," the intelligent color matching model's task is to search for the optimal dye combination in the dyeing formula solution space, using the target color data provided by the customer as input and the pre-trained hybrid-driven color prediction model as the positive evaluation function. Essentially, the intelligent color matching model is a multi-objective constrained optimization model that transforms the traditional manual color matching process into an intelligent reverse optimization process. The multi-objective constrained intelligent color matching model proposed in this example adopts the following three-stage architecture: Phase 1: Multi-objective optimization solution -- Using dye concentration as the decision variable and minimizing CMC color difference, minimizing formulation cost, and minimizing metamerism index as optimization objectives, the fast non-dominated sorting genetic algorithm (NSGA-II) is used to globally search in the formulation space to generate a set of Pareto optimal solutions.
[0080] Phase Two: Formula Screening Based on a Comprehensive Weighting of Subjective and Objective Factors – For the Pareto optimal solution set, the best formula combination is selected from the optimal solution set and recommended to the colorist by combining expert scoring and entropy weighting methods, and using the ideal solution similarity ranking technique (TOPSIS).
[0081] Phase 3: Multi-constraint verification – Verify the compatibility and process feasibility of the selected recommended formulations to ensure their industrial feasibility.
[0082] Step S3 includes the following sub-steps: S301. The hybrid-driven color prediction model is used as a positive evaluation function, with the optimization objectives being to minimize the CMC color difference between the predicted color and the target color, minimize the metamerism index, minimize the formulation cost, and maximize the color fastness prediction score.
[0083] The first step is to define the decision variables and the objective function.
[0084] For the decision variables, the mixed-driven color prediction model is used as the positive evaluation function, and the decision variables of the smart color matching model are the concentrations of each dye in the dyeing formula: (11) In the formula, This refers to the number of dyes used in the formulation (usually 2 to 4). For the first The concentration of each dye is expressed as %owf. The range of concentration values for each dye is as follows: (12) In the formula, and The first The minimum and maximum recommended concentrations for branched dyes are determined by the dye characteristics and fiber type. The total dye concentration constraints are: (13) Furthermore, a system of objective functions is constructed. This example constructs a multi-objective optimization system containing the following four core objective functions: Objective function one: Using the hybrid-driven color prediction model as a positive evaluation function, minimizes the CMC color difference. (14) In the formula, To make the formula Input the predicted L*a*b* values obtained from the hybrid-driven color prediction model. The measured L*a*b* values represent the target color. The CMC (2:1) color difference formula is used. The CMC color difference formula has better visual relevance than the CIELAB color difference formula and has been widely used in the evaluation of color difference in textiles.
[0085] Objective function two: minimizing the metamerism index. The Metamerism Index (MI) is used to evaluate the color consistency of a formulation under different light sources. The calculation method is as follows: (15) In the formula, and These represent the L*a*b* values of the target color and the formulated color under three standard light sources (D65, A, F11) (derived from their spectral reflectance curves using standard colorimetric formulas). A smaller MI value indicates better color consistency of the formulation under different lighting conditions. For textiles, the MI is generally required to be no more than 1.0.
[0086] Objective function 3: Minimize formulation cost (16) In the formula, For the first Price per unit of dye (RMB / kg) This refers to the dye concentration. and The first The unit price and dosage of various auxiliaries. In actual industrial applications, dye costs account for approximately 60% to 80% of the total formulation cost, and the price difference between different dyes can be several times.
[0087] Objective Function 4: Maximizing the Predicted Score for Colorfastness Traditional color matching methods focus only on the accuracy of the color itself, neglecting the quality of color matching. This application integrates the output of a color matching quality prediction model into the intelligent color matching stage, constructing a color fastness prediction scoring objective function: (17) in, , , These represent the predicted grades of colorfastness to washing, colorfastness to rubbing, and colorfastness to sunlight, respectively, output by the dyeing quality prediction model. , , These are the weighting coefficients for each fastness index.
[0088] S302. Using constraints such as dye concentration range, total dye concentration upper limit, color difference tolerance, compatibility, low liquor ratio solubility, and formulation cost upper limit as constraints, a smart color matching model is obtained.
[0089] The intelligent color matching model needs to meet several constraints to ensure the industrial feasibility of the recommended formulas.
[0090] Color difference tolerance constraints: (18) in, This is a preset color difference tolerance threshold (typically 1.0 under the CMC 2:1 standard). This constraint ensures that the predicted color difference of the recommended formulation is within an acceptable range for the customer. To make the formula Input the predicted L*a*b* values obtained from the hybrid-driven color prediction model. The measured L*a*b* values represent the target color.
[0091] Dye concentration constraints: As mentioned above, the concentration of each dye must be within the recommended range, and the total dye concentration must not exceed the upper limit.
[0092] Compatibility constraints: The compatibility constraint is a specific constraint designed for the characteristics of package yarn dyeing in this application, used to prevent color difference between the inner and outer layers of the package yarn due to excessive differences in dye uptake rates. The special physical form of package yarn dyeing—the yarn is tightly wound on a porous bobbin, and the dye liquor needs to penetrate the yarn layers by the pressure of the main pump—makes the compatibility constraint particularly critical.
[0093] The compatibility factor D is defined as follows: (19) in, For the first The half-dyeing time of a dye (i.e., the time required for the dye uptake rate to reach 50% equilibrium uptake rate). For the first The half-dyeing time of branched dyes is a core indicator of dye compatibility. The half-dyeing time of each dye can be determined through isothermal dyeing rate curve experiments. Compatibility constraints are expressed as: (20) in The compatibility threshold (e.g., 2 min) ensures that the dyeing behavior of each dye in the recommended formulation is similar, avoiding uneven dyeing caused by competitive dyeing.
[0094] Low bath ratio solubility constraint Package dyeing typically employs low liquor ratio conditions (1:4~1:11), where the dye concentration in the dye bath is much higher than in conventional dyeing, making the constraint of dye solubility particularly important. This constraint is expressed as: (twenty one) in, For the first Solubility of branched dyes at the highest dyeing temperature (g / L). This refers to the liquor ratio. If the dye concentration exceeds the solubility, dye particles will precipitate on the yarn surface, forming color spots.
[0095] Cost constraints (twenty two) in, The maximum acceptable formula cost (RMB / kg yarn).
[0096] S4. Obtain the target color data and input the target color data into the intelligent color matching model for solution to obtain the color matching parameters.
[0097] Step S4 includes the following sub-steps: S401. Match the target color data with the historical formulas in the yarn dyeing database.
[0098] The system retrieves the historical recipe that most closely matches the target color from the established color-recipe mapping knowledge base. The retrieval is based on the CMC color difference value. Color difference <0.5: Considered a high match. Reuse historical formulas directly, skipping subsequent optimization steps, and label the output as "Reused historical formula".
[0099] 0.5 ≤ color difference < 1.5: considered a medium match. Starting from this historical formula, proceed to the second stage of incremental optimization.
[0100] Color difference ≥ 1.5: considered a low match. Insufficient references in the knowledge base; proceed to the third stage for complete multi-objective optimization.
[0101] Within the neighborhood of the historical formula (with each dye concentration fluctuating by 15%), a small-scale fine-tuning search is performed. Due to the small search space, a Bayesian optimization method with fast convergence is adopted, targeting the CMC color difference, requiring only 10-15 iterations to find the optimal fine-tuning ratio within the neighborhood. After optimization, the formula is directly output and labeled "fine-tuned based on historical formula".
[0102] S402. Select the solution path based on the matching results.
[0103] For entirely new colors without historical reference, the AMRFO-CS algorithm from Part 4 is invoked for a global search to obtain a set of Pareto optimal solutions. The final decision is then made based on the user's preset preference pattern.
[0104] S403. When global optimization is triggered, an adaptive multi-group cooperative search algorithm is used to solve the multi-objective constrained optimization problem and obtain the Pareto optimal solution set.
[0105] This example proposes an Adaptive Manta Ray Foraging Optimization with Cooperative Search (AMRFO-CS) algorithm to solve the aforementioned multi-objective constrained optimization problem. Compared with traditional evolutionary algorithms such as Genetic Algorithms (GA), the MRFO algorithm has significant advantages such as fast convergence speed, strong global exploration capability, and parameter adaptation. However, the original MRFO algorithm is designed for a single-objective optimization problem, and its search strategy does not consider the handling of multiple constraints. Considering the multi-objective, multi-constraint, and complex decision space characteristics of yarn dyeing formula optimization, this example makes the following specialized improvements to the MRFO algorithm for yarn dyeing.
[0106] Step S403 includes: S4031. Construct a main population, a compatibility-oriented auxiliary population, and a domain knowledge-oriented auxiliary population.
[0107] The primary population (population P1) employs the aforementioned multi-objective MRFO search strategy and is responsible for global exploration. The population size is set to... .
[0108] Auxiliary Population 1 (Population P2) -- Compatibility-Oriented Population: Population size set to The search strategy of this population differs from the traditional MRFO: during individual updates, it considers not only the objective function value but also introduces a compatibility factor D as a preference guide. Specifically, the "optimal individual" of this population is randomly selected from the top 20% of individuals with the smallest D value (i.e., optimal compatibility) in the current feasible solution set of P2. Simultaneously, all individuals in this population must satisfy the following after the update: Otherwise, a repair operation will be triggered—the concentration of each dye will be reduced proportionally until the compatibility constraint is met.
[0109] Auxiliary Population 2 (Population P3) -- Domain Knowledge Guided Population: Population size set to This population utilizes accumulated historical high-quality recipe data and employs a domain knowledge-guided strategy based on KNN. Specifically, in each iteration, it retrieves the historical recipe from the base database that is closest in color to the current individual (with the smallest CMC color difference), and updates the individual's position using this historical recipe as a reference direction. (twenty three) In the formula, Let be the position vector of the i-th individual in the (t+1)-th generation (i.e., the next generation). For the current position of the individual, The value is a random number, which controls the step size for moving towards historical recipes. For historical high-quality formulas retrieved, The value is a small Gaussian perturbation (0.05 in this application). To and A standard normally distributed random vector of the same dimension.
[0110] S4032. Introduce a Pareto front-based crowding distance-based mechanism to guide individual selection, and provide differentiated guidance for three foraging strategies: chain foraging, whirlwind foraging, and tumbling foraging.
[0111] The three foraging strategies of the original MRFO algorithm are described as follows: Chain foraging: Manta rays are arranged in a chain, with each individual moving towards the individual in front (a better solution) and the current best solution. (twenty four) in, For the first The position of an individual in the current generation Let be the position vector of the i-th individual in the (t+1)-th generation (i.e., the next generation). As the current optimal individual, A random number in the range [0,1]. For adaptive step size coefficient, Let r be the natural logarithm of r. The role of log(r) is: when the random number r is small, it generates a larger step size, which enhances the global exploration ability of the algorithm; when r is large, it reduces the step size, which enhances the local fine search ability.
[0112] Cyclone Foraging: Individual manta rays form a spiral search path around the current optimal solution. (25) In the formula, Let be the updated position vector of the i-th individual, i.e., the updated candidate staining formula. Let r be the position vector of the optimal reference individual selected in the current population, where r is a random number between [0,1]. Let i be the position vector of the (i-1)th individual in the current population. The term is the exponential term, and β is the spiral shape control parameter. It is a cosine function with a range of [-1, 1].
[0113] Tumbling foraging: Manta rays perform tumbling jumps near the optimal solution to explore new areas. (26) in, The tumble factor (set to 2 in this example). and It is a random number in the range [0,1].
[0114] The original MRFO algorithm is a typical single-objective optimization algorithm, and the update formulas for its three foraging strategies (chain, whirlwind, and roll) all depend on a single globally optimal individual. In single-target scenarios, It is the individual with the optimal objective function value, and its selection method is explicit. However, in multi-objective optimization, there is no single optimal solution, but rather a set of non-dominant Pareto optimal solutions. The selection method determines the search behavior of the algorithm. The core improvement of the original MRFO in this application lies in reconstructing the selection mechanism of the guiding individual and introducing adaptive search preferences, enabling it to effectively solve multi-objective constrained optimization problems.
[0115] Improvement Mechanism 1: Pareto Front Based on Crowding Distance to Guide Individual Choice In the original MRFO, It is the individual with the optimal objective function value in the population. In this example of multi-objective expansion, Instead of being a fixed individual, it is dynamically selected from the non-dominated solution set (Pareto front) of the current population. The selection rules are as follows: Perform a fast non-dominated sort on the current population and extract the set of individuals in the first non-dominated layer. .
[0116] calculate Crowding distance of each individual The greater the crowding distance, the sparser and more diverse the area where the individual is located.
[0117] Tournament selection based on crowd distance was used to determine the leading individuals. Each time from Two individuals are randomly selected from the pool, and the individual with the larger crowding distance is chosen as a candidate. This process is repeated until the final guiding individual is selected.
[0118] The design intent of this selection mechanism is to prioritize the movement of individuals towards sparser regions on the Pareto front while maintaining population convergence towards it, thereby enhancing the uniformity of the solution set distribution. Compared to traditional random or fixed selection, tournament selection based on crowding distance effectively avoids excessive population aggregation on the Pareto front, increasing the diversity of the final solution set—which is particularly important for color matching scenarios, as colorists need to see multiple differentiated candidate formulas (such as cost-priority, fastness-priority, etc.) to choose from.
[0119] Improvement Mechanism 2: Differentiated Guidance of Three Foraging Strategies in Multi-Objective Scenarios In the original MRFO, the chain, whirlwind, and tumble strategies all use the same... This invention further differentiates the guidance methods for the three strategies: Chain foraging (focusing on convergence): guiding individuals to adopt the above-mentioned selection method based on crowding distance. Chain foraging has strong guiding properties, with individuals moving rapidly towards the Pareto front, ensuring the algorithm's convergence speed.
[0120] Cyclone foraging (emphasizing diversity): guiding individuals to not follow... Instead of selecting from the population, an individual is randomly selected from the entire population as... However, the selection probability of an individual is inversely proportional to its non-dominated level—the smaller the level (the better), the higher the probability of selection, but individuals with larger levels still have a certain probability of being selected. This design allows whirlwind foraging to maintain a tendency to cluster towards high-quality solutions while also possessing a certain degree of random jumping ability, which helps to escape the local Pareto front.
[0121] Rolling for food (focusing on global exploration): This strategy involves large-scale positional jumps. This example maintains its random exploration characteristics, without setting a single guiding individual, but instead updating based on the difference between the current individual's position and another random individual in the population: (27) in, and Two different individuals were randomly selected from the population. For the tumbling factor, For the first random individual, a random number between [0,1] is used. The location is randomly scaled to increase the randomness and diversity of the search. For the second random individual, a random number between [0,1] is used. The position is randomly scaled.
[0122] This double-random individual difference-guided approach enhances the population's global exploration ability in the decision space, which is particularly suitable for the characteristics of multiple local optima in the solution space of yarn dyeing formulas—the same target color may correspond to multiple different dye combinations, and tumbling foraging helps to discover these scattered high-quality areas.
[0123] S4033. Adaptively adjust the execution probability of each foraging strategy based on the population convergence state.
[0124] In the original MRFO (Match-Oriented Foraging Field), the probabilities of invoking the three foraging strategies are fixed. This example introduces an adaptive switching mechanism based on the population convergence state: the switching is based on the proportion of non-dominant individuals in the current population. The execution probability of the three strategies is dynamically adjusted.
[0125] when (Population has not yet converged): Increase the probability of chain foraging (from 40% to 60%), reduce the probability of rolling foraging, and accelerate convergence to the Pareto front.
[0126] when (Population has reached a high degree of convergence): Increase the probability of rolling foraging (from 30% to 50%), reduce the probability of chain foraging, and enhance global exploration to avoid getting trapped in local optima.
[0127] The probability of whirlwind foraging is dynamically balanced between the two, maintaining a fixed range of 20% to 30%.
[0128] The adaptive probability calculation formulas for the three strategies are as follows: (28) In the formula, Let be the probability of chain foraging being executed. The probability of whirlwind foraging being executed. The probability of rolling over to forage. This represents the proportion of non-dominant individuals in the current population.
[0129] Through the above three improvements, the original single-objective MRFO has been successfully extended into the AMRFO-CS core search operator, which can solve multi-objective optimization problems.
[0130] S4034. Boundary constraints in the constraints are repaired by boundary mapping, compatibility constraints and low bath ratio solubility constraints are handled by adaptive penalty functions, and color difference tolerance constraints are handled by feasibility criteria.
[0131] Among them, when the individual's dye concentration Beyond the recommended range In this case, the boundary mapping method is used to directly project it back to the feasible region boundary: (29) In the formula, The concentration of the i-th dye after repair. Let i be the minimum recommended concentration for the i-th dye. This represents the maximum recommended concentration for the i-th dye. Let be the current concentration value of the i-th dye.
[0132] This hard-fix method ensures that all individuals remain within the physically feasible range of dye concentration.
[0133] Among them, compatibility constraints and low bath ratio solubility constraint An adaptive penalty function is used for processing. Penalty coefficient. Adjust dynamically as the iteration process progresses: (30) in, This is the initial penalty strength (100 in this example). This is the minimum penalty strength (10 in this example). Let the current iteration algebra be... This represents the maximum number of generations. Physically, it means that in the early stages of optimization, before the population converges, a large penalty is imposed to force individuals into the feasible region; in the later stages of optimization, after the population has converged, the penalty intensity is appropriately reduced to avoid excessive squeezing of the Pareto front.
[0134] The constraint violation amount is calculated as follows: Compatibility constraint violation amount: (31) In the formula, For the quantity of compatibility constraint violation, For the portion exceeding the threshold, As a compatibility factor, This is the compatibility threshold.
[0135] Solubility constraint violation amount: (32) In the formula, For the amount of solubility constraint violation, The number of dyes used in the formula. Let be the concentration of the i-th dye. This is the highest temperature for staining. Let be the solubility of the i-th dye at Tmax. For bath ratio, This represents the upper limit of the converted concentration.
[0136] Total constraint violation penalty value: (33) In the formula, The total penalty value for constraint violation. For adaptive penalty coefficient, For the quantity of compatibility constraint violation, For the amount of solubility constraint violation, This represents the decision vector for the current individual, i.e., a candidate staining recipe. Let be the current iteration algebra.
[0137] Color difference tolerance constraint -- objective function embedding Color difference tolerance constraints Color difference tolerance has a special property in dyeing formulation optimization: solutions that exceed the tolerance are considered industrially unacceptable even if other indicators are excellent. Therefore, this example uses color difference tolerance as a feasibility criterion rather than a penalty—before non-dominated ranking, individuals that do not meet the color difference tolerance are marked as "infeasible solutions," and their Pareto level is forcibly set to the lowest.
[0138] S4035. Periodic migration of elite individuals among the three groups.
[0139] In this example, the cooperative mechanism is to carry out an elite migration between populations once every generation (10 in this invention): the two individuals with the smallest D value in P2 are migrated to P1 and replaced by the two individuals with the largest constraint violation in P1. The two individuals with the smallest CMC color difference in P3 are migrated to P1, replacing the two individuals with the worst objective function values in P1. The three individuals with the best overall performance in P1 (lowest non-dominated level and largest crowding distance) are migrated to P2 and P3 respectively.
[0140] The algorithm parameter settings and algorithm flow are as follows: Parameter settings: Total population size: (P1=60, P2=20, P3=20) Maximum number of iterations: Adaptive weights: ,in It is a random number.
[0141] Tumbling factor: Elite migration cycle: External archive capacity: Retain historical non-dominated solutions, with a capacity of 100.
[0142] Compatibility threshold: Color difference tolerance threshold: Algorithm flow: Initialization: Randomly generate initial populations P1, P2, and P3 within the dye concentration range, and calculate the objective function value and constraint satisfaction of each initial individual.
[0143] Non-dominated sorting and external archive update: Perform non-dominated sorting on each population and store Pareto front individuals in an external archive.
[0144] Main population update (P1): Individuals are updated using three strategies: chain foraging (40% probability), whirlwind foraging (30% probability), and rolling foraging (30% probability).
[0145] P2 Update: Updated using a compatibility preference-guided MRFO strategy, with concentration ratio repair triggered by individuals violating compatibility constraints.
[0146] P3 Update: Updated using the KNN domain knowledge-guided strategy.
[0147] Boundary repair and constraint handling: Boundary mapping repair is performed on each subpopulation, adaptive penalty is calculated and objective function value is updated.
[0148] Elite migration: Elite migration between populations occurs once per generation.
[0149] Update external archive: Incorporate the current Pareto fronts of the three populations into the external archive, sort them in a non-dominated manner, and truncate them to the capacity limit.
[0150] S4036. When the termination condition is met, output the Pareto optimal solution set in the external archive.
[0151] If the maximum number of iterations is reached, the Pareto optimal solution set in the external archive is output.
[0152] S404. Filter the Pareto optimal solution set and output the color matching parameters.
[0153] In this invention, the selection of the Pareto optimal solution set does not employ traditional pure mathematical sorting methods (such as TOPSIS). Instead, it fully utilizes the historical formula data accumulated by yarn dyeing enterprises over a long period, proposing a three-stage selection strategy of "matching first, then optimizing, and then deciding." The core idea is: for a new target color, first search the historical database for identical or similar successful dyeing formulas; if found, reuse or fine-tune them directly; only when no reference formula is available is the complete multi-objective optimization algorithm in the fourth part invoked. This design transforms historical data assets into intelligent decision-making basis, significantly reducing redundant calculations and improving industrial applicability.
[0154] Three-stage screening process: First paragraph: Quick matching of historical recipes.
[0155] The system retrieves the historical recipe that most closely matches the target color from the established color-recipe mapping knowledge base. The retrieval is based on the CMC color difference value. Color difference <0.5: Considered a high match. Reuse historical formulas directly, skipping subsequent optimization steps, and label the output as "Reused historical formula".
[0156] 0.5 ≤ color difference < 1.5: considered a medium match. Starting from this historical formula, proceed to the second stage of incremental optimization.
[0157] Color difference ≥ 1.5: considered a low match. Insufficient references in the knowledge base; proceed to the third stage for complete multi-objective optimization.
[0158] Second section: Incremental optimization (triggered only during matching) A small-scale fine-tuning search is performed within the neighborhood of the historical formulation (with each dye concentration fluctuating by 15%). Due to the small search space, a Bayesian optimization method with fast convergence is adopted, targeting the CMC color difference, and the optimal fine-tuning ratio within the neighborhood can be found in only 10-15 iterations. After optimization, the formulation is directly output and labeled "fine-tuned based on historical formulation".
[0159] Section 3: Complete Multi-Objective Optimization and Decision Making (Triggered Only in Low-Fit Situations) For entirely new colors with no historical reference, the AMRFO-CS algorithm from Part 4 is invoked for a global search, yielding a set of Pareto optimal solutions. The final decision is then made based on the user's preset preference pattern. Precision first: Select the formula with the smallest color difference.
[0160] Cost priority: Choose the formula with the lowest cost, provided that the color difference meets the tolerance (ΔE ≤ 1.0).
[0161] Fastness priority: Select the formula with the highest predicted color fastness score.
[0162] Comprehensive balancing: After normalizing each objective, the formula with the highest comprehensive score is selected based on weighted ranking.
[0163] Formula output Regardless of which path it is generated from, the final output recommended recipe will contain the following information: Names and concentrations (% owf) of each dye Formula source identification (historical reuse / minor adjustments / new optimization) Predicted color difference value and color fastness grade Compatibility index D value and low bath ratio solubility verification results S5. Based on the color matching parameters and dyeing process parameters, construct a dyeing quality prediction model.
[0164] First, the data in the yarn dyeing database is preprocessed. After data preprocessing, a candidate pool containing six base models, including random forest and XGBoost, is established. A nine-dimensional evaluation index system covering accuracy, efficiency, and generalization ability is designed. The comprehensive total score of each model is obtained by summarizing the independent scores during the training and testing phases. Finally, based on actual production needs, an accuracy-first, generalization-first, efficiency-first, or comprehensive balance mode is selected, and the optimal model is output with index ranking and recommendation reasons, providing a quantitative quality prediction engine for subsequent closed-loop virtual prototyping.
[0165] Step S5 includes the following sub-steps: S501. Extract a sample set of color matching parameters, dyeing process parameters and corresponding dyeing quality index data from the yarn dyeing database.
[0166] The process involved extracting all historical batch data from the yarn dyeing database, with each record containing complete color matching parameters, dyeing process parameters, and corresponding measured quality indicators. Data preprocessing included three steps: missing value handling, outlier handling, and standardization. The preprocessed dataset was then divided into training, validation, and test sets in a 70%:15%:15% ratio to ensure a reasonable distribution of samples of different fiber types and color depths across the three sets.
[0167] S502. Construct a candidate model pool containing multiple heterogeneous regression models.
[0168] The following six machine learning models, which have complementary performance in regression prediction tasks, were selected as the base model pool: Random Forest (RF), Extreme Gradient Boosting (XGBoost), Support Vector Regression (SVR), Gradient Boosting Decision Tree (GBDT), Lightweight Gradient Boosting Machine (LightGBM), and K-Nearest Neighbors Regression (KNN). These six models cover three major categories: ensemble tree models, kernel methods, and instance-based learning, and are complementary in feature representation and generalization ability.
[0169] S503. Evaluate each model in the candidate model pool from multiple dimensions and score them according to preset evaluation indicators.
[0170] Nine evaluation indicators were constructed, as shown in Table 2: Table 2 Evaluation Indicators Among them, WMAPE assigns greater weight to high-concentration samples, which is consistent with the physical law that the higher the dye concentration in low bath ratio dyeing of yarn packages, the greater the contribution to color difference.
[0171] S504. According to the preset screening mode, select the model with the best score from the candidate model pool as the staining quality prediction model.
[0172] Five-fold cross-validation was used to calculate the specific values of each evaluation metric for each model during the training and testing phases. Performance in the training and testing phases was ranked and scored separately: for positive metrics, the top-ranked model received a score of 6 (based on the number of base models), and the bottom-ranked model received a score of 1; for negative metrics, the top-ranked model received a score of 6 (based on the number of base models), and the bottom-ranked model received a score of 1. After independent scoring in the training and testing phases, the scores from both phases were added together to obtain the final overall score for each model.
[0173] To meet the needs of different dyeing production scenarios, this example provides four screening modes: Precision-first mode: Filtering R 2 Five accuracy metrics—MAE, RMSE, WMAPE, and VAF—were used to select the model with the highest total score during the testing phase.
[0174] Generalization-first mode: Based primarily on CV Std, and combined with the difference between training and test scores, select the model with the best generalization performance.
[0175] Efficiency-first mode: Prioritizes training time as the primary criterion in R... 2 The fastest model to train is selected from the subset of models with a value ≥0.85.
[0176] Comprehensive Balanced Mode: Directly sort by overall score and select the model with the highest overall score.
[0177] After screening, the selected optimal model will be deployed as a staining quality prediction model for subsequent closed-loop validation and production quality prediction.
[0178] S6. Input the real-time acquired color matching parameters and dyeing process parameters into the dyeing quality prediction model for quality verification, and obtain the dyeing quality prediction result.
[0179] Step S6 includes the following sub-steps: S601. The color matching parameters and dyeing process parameters acquired in real time are input into the dyeing quality prediction model to obtain the predicted values of various dyeing quality indicators.
[0180] The color matching parameters and dyeing process parameters acquired in real time are input into the constructed dyeing quality prediction model to obtain the predicted values of various quality indicators.
[0181] S602. Compare the predicted values of the various dyeing quality indicators with the preset quality tolerances.
[0182] The predicted values are compared with the preset quality tolerances, as shown in Table 3: Table 3: Comparison of predicted values and preset quality tolerances for staining quality indicators S603. When the predicted value meets the quality tolerance, the determination is passed, and the corresponding color matching parameters and dyeing process parameters are released to the production stage.
[0183] S604. When the predicted value does not meet the quality tolerance, it is determined to fail and the formula is modified.
[0184] Specifically, when the predicted CMC color difference is between 1.0 and 2.0 and other required indicators meet the standards, Bayesian optimization is initiated to perform a small-scale fine search within the neighborhood of the recommended formulation (with each dye concentration fluctuating by 15%), with a maximum of 15 iterations. After completion, virtual sampling verification is performed again.
[0185] Re-optimization: When the color difference exceeds 2.0 or fails to meet the standard after two consecutive corrections, the prediction deviation vector is fed back to the intelligent color matching model, triggering the AMRFO-CS algorithm to re-perform global multi-objective optimization.
[0186] Once the formula has been actually dyed and quality tested, complete data records (color matching parameters, process parameters, and measured quality indicators) are stored in the historical database. When the cumulative number of new samples reaches 50 batches or more than 30 days have passed since the last update, the online update of the dyeing quality prediction model is triggered.
[0187] The update method employs incremental fine-tuning: the parameters of the deployed staining quality prediction model are fine-tuned using new samples, rather than retraining. For tree ensemble models (such as XGBoost and LightGBM), incremental learning is achieved by continuing training for several rounds (e.g., 10-20 rounds) using new samples; for non-incremental models such as SVR, new samples are added and retrained while retaining most of the original model's support vectors.
[0188] After the update, perform regression testing using the historical validation set. Only if the updated model achieves good results on the validation set in terms of key metrics (R², R², Rd²) will the regression be tested. 2 The online model is officially replaced only when both the staining quality prediction model (MAE) and the staining quality prediction model are no worse than the previous model; otherwise, the original model is retained and an early warning is issued. This mechanism enables the staining quality prediction model to have self-evolution capabilities, continuously adapting to dynamic changes in production conditions and raw material characteristics.
[0189] This example proposes a method for intelligent color matching and dyeing quality prediction of packaged yarn. First, a hybrid-driven color prediction model incorporating physical constraints is constructed to achieve a precise positive mapping from formula to color. Then, the hybrid-driven color prediction model is embedded into a multi-objective intelligent color matching model as an evaluation function to solve for the optimal formula under constraints. Finally, a dyeing quality prediction model is introduced to predict the quality of the recommended formula; only when the predicted quality meets the standards is the formula released to production. This invention mainly includes the following beneficial effects: 1. By constructing a Transformer network architecture that includes parallel L*a*b* and spectral reflectance dual output branches, and introducing optical theory constraints into the loss function, the color prediction model combines data-driven nonlinear fitting capabilities with the optical consistency of the physical model. This enables the model to maintain stable and reliable prediction accuracy under complex dyeing conditions and in data-sparse regions, thereby improving its applicability in nonlinear dyeing scenarios such as low bath ratio and high concentration of yarn.
[0190] 2. By incorporating the color fastness prediction score into the color matching optimization objective and establishing yarn-specific constraints such as compatibility constraints and low liquor ratio solubility constraints, the color matching process is no longer solely focused on color matching. The output recommended formula achieves comprehensive optimization in terms of color accuracy, fastness performance, and process feasibility. A feasible formula that balances visual quality and intrinsic quality can be obtained in a single color matching process.
[0191] 3. By using the dyeing quality prediction model as a virtual sampling engine, the candidate formula is verified for quality before production. A decision mechanism of verification before dyeing is constructed. In this way, the formula is released to production only when the predicted values of quality indicators meet the preset conditions, thereby greatly reducing the number of invalid physical samplings and reducing the rework rate.
[0192] For those consistent with the above, please refer to Figure 2 , Figure 2 This application provides a schematic diagram of the structure of a smart color matching and dyeing quality prediction system for yarn packages. For example... Figure 2 As shown, the system includes: Module 1 is used to obtain the yarn dyeing database; The second module 2 is used to improve the Transformer deep neural network, build and train a hybrid-driven color prediction model; The third module 3 is used to construct a smart color matching model by using the hybrid-driven color prediction model as a positive evaluation function. The fourth module 4 is used to acquire target color data and input the target color data into the intelligent color matching model for solving to obtain color matching parameters; Module 5 is used to construct a dyeing quality prediction model based on the color matching parameters and dyeing process parameters. Module 6 is used to input the real-time acquired color matching parameters and dyeing process parameters into the dyeing quality prediction model for quality verification, and obtain the dyeing quality prediction result.
[0193] For examples consistent with the above embodiments, please refer to... Figure 3 , Figure 3 A schematic diagram of a terminal structure provided in an embodiment of this application is shown in the figure. It includes a processor, an input device, an output device, and a memory. The processor, input device, output device, and memory are interconnected. The memory is used to store a computer program, which includes program instructions. The processor is configured to call the program instructions. The program includes instructions for performing the following steps. Obtain the yarn dyeing database; An improved Transformer deep neural network was constructed and trained to obtain a hybrid-driven color prediction model; The hybrid-driven color prediction model is used as a positive evaluation function to construct a smart color matching model; Obtain target color data and input the target color data into the intelligent color matching model for solution to obtain color matching parameters; Based on the color matching parameters and dyeing process parameters, a dyeing quality prediction model is constructed; The color matching parameters and dyeing process parameters acquired in real time are input into the dyeing quality prediction model for quality verification, and the dyeing quality prediction results are obtained.
[0194] The above mainly describes the solutions of the embodiments of this application from the perspective of the method execution process. It is understood that, in order to achieve the above functions, the terminal includes the corresponding hardware structure and / or software modules for executing each function. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments provided herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0195] This application embodiment can divide the terminal into functional units according to the above method example. For example, each function can be divided into a separate functional unit, or two or more functions can be integrated into one processing unit. The integrated unit can be implemented in hardware or as a software functional unit. It should be noted that the unit division in this application embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.
[0196] This application also provides a computer storage medium storing a computer program for electronic data interchange, which causes a computer to perform some or all of the steps of any of the intelligent color matching and dyeing quality prediction methods for yarn packages as described in the above method embodiments.
[0197] This application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program that causes a computer to perform some or all of the steps of any of the intelligent color matching and dyeing quality prediction methods for yarn packages as described in the above method embodiments.
[0198] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0199] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0200] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical or other forms.
[0201] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0202] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software program module.
[0203] If the integrated unit is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0204] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage device, which may include: a flash drive, a read-only memory, a random access memory, a magnetic disk, or an optical disk, etc.
[0205] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for predicting the quality of color matching and dyeing of a cheese, characterized in that, include: Obtain the yarn dyeing database; An improved Transformer deep neural network was constructed and trained to obtain a hybrid-driven color prediction model; The hybrid-driven color prediction model is used as a positive evaluation function to construct a smart color matching model; Obtain target color data and input the target color data into the intelligent color matching model for solution to obtain color matching parameters; Based on the color matching parameters and dyeing process parameters, a dyeing quality prediction model is constructed; The color matching parameters and dyeing process parameters acquired in real time are input into the dyeing quality prediction model for quality verification, and the dyeing quality prediction results are obtained. The improvement of the Transformer deep neural network to construct and train a hybrid-driven color prediction model includes: The architecture of the Transformer deep neural network is improved to obtain an improved Transformer deep neural network; The loss function of the Transformer deep neural network is constructed to obtain the hybrid driving loss function; The improved Transformer deep neural network is trained with the hybrid driving loss function as the target to obtain a hybrid driving color prediction model; The improvement of the architecture of the Transformer deep neural network to obtain the improved Transformer deep neural network includes: The input embedding layer is reconstructed to obtain a multimodal input fusion layer for categorical and numerical variables; A multi-head self-attention mechanism is introduced to calculate the attention weight matrix between input features, resulting in a multi-dimensional feature representation after residual connection and layer normalization. The multidimensional feature representation is flattened into a one-dimensional flattened vector, and a shared feature vector is output through four hidden layers using an expansion-then-compression approach. Construct parallel L*a*b* output branches and spectral reflectance output branches, and input the shared feature vector into the L*a*b* output branches and spectral reflectance output branches respectively to obtain L*a*b* color prediction values and spectral reflectance prediction values; A non-trainable color space conversion module is constructed, and the predicted spectral reflectance value is input into the color space conversion module to obtain the L*a*b*color conversion value. The construction of the loss function for the Transformer deep neural network, resulting in a hybrid driving loss function, includes: Construct a data-driven loss term based on the predicted L*a*b* color values; A physical consistency loss term is constructed based on the L*a*b* color conversion value and the spectral reflectance prediction value. Construct a concentration-color depth monotonicity constraint loss term; The L*a*b* data-driven loss term, the spectral reflectance physical consistency loss term, and the concentration-color depth monotonicity constraint loss term are weighted and summed to obtain the hybrid driving loss function.
2. The cheese intelligent matching and dyeing quality prediction method according to claim 1, characterized in that, The step of using the hybrid-driven color prediction model as a positive evaluation function to construct a smart color matching model includes: The hybrid-driven color prediction model is used as a positive evaluation function, with the optimization objectives being to minimize the CMC color difference between the predicted color and the target color, minimize the metamerism index, minimize the formulation cost, and maximize the color fastness prediction score. A smart color matching model is obtained by using constraints such as dye concentration range, total dye concentration upper limit, color difference tolerance, compatibility, low liquor ratio solubility, and formulation cost upper limit.
3. The intelligent color matching and dyeing quality prediction method for packaged yarn according to claim 1, characterized in that, The step of inputting the target color data into the intelligent color matching model for solving to obtain color matching parameters includes: The target color data is matched with historical formulas in the yarn dyeing database; Select the solution path based on the matching results; When global optimization is triggered, an adaptive multi-group cooperative search algorithm is used to solve the multi-objective constrained optimization problem and obtain the Pareto optimal solution set. The Pareto optimal solution set is filtered, and the color matching parameters are output.
4. The intelligent color matching and dyeing quality prediction method for packaged yarn according to claim 3, characterized in that, The adaptive multi-group cooperative search algorithm is used to solve the multi-objective constrained optimization problem to obtain a Pareto optimal solution set, including: Construct a main population, a compatibility-oriented auxiliary population, and a domain knowledge-guided auxiliary population; We introduce a Pareto front based on crowding distance to guide individual selection, and provide differentiated guidance for three foraging strategies: chain foraging, whirlwind foraging, and tumbling foraging. The execution probability of each foraging strategy is adaptively adjusted based on the population convergence state. Boundary constraints in the constraints are repaired by boundary mapping, compatibility constraints and low bath ratio solubility constraints are handled by adaptive penalty functions, and color difference tolerance constraints are handled by feasibility criteria. Elite individuals migrate periodically between the three groups; When the termination condition is met, output the Pareto optimal solution set in the external archive.
5. The intelligent color matching and dyeing quality prediction method for packaged yarn according to claim 1, characterized in that, The step of constructing a dyeing quality prediction model based on the color matching parameters and dyeing process parameters includes: Extract a sample set of color matching parameters, dyeing process parameters, and corresponding dyeing quality index data from the yarn dyeing database; Construct a candidate model pool containing multiple heterogeneous regression models; The models in the candidate model pool are evaluated from multiple dimensions and scored according to preset evaluation indicators. According to the preset screening mode, the model with the best score is selected from the candidate model pool as the staining quality prediction model.
6. The intelligent color matching and dyeing quality prediction method for packaged yarn according to claim 1, characterized in that, The step of inputting the real-time acquired color matching parameters and dyeing process parameters into the dyeing quality prediction model for quality verification, and obtaining the dyeing quality prediction result, includes: The color matching parameters and dyeing process parameters acquired in real time are input into the dyeing quality prediction model to obtain the predicted values of various dyeing quality indicators; The predicted values of each staining quality indicator are compared with the preset quality tolerance. When the predicted value meets the quality tolerance, the decision is passed, and the corresponding color matching parameters and dyeing process parameters are released to the production stage. If the predicted value does not meet the quality tolerance, the result is deemed unsuccessful, and the formula is corrected.
7. A smart color matching and dyeing quality prediction system for packaged yarn, characterized in that, include: The first module is used to obtain the yarn dyeing database; The second module is used to improve the Transformer deep neural network, build and train a hybrid-driven color prediction model; The third module is used to construct a smart color matching model by using the hybrid-driven color prediction model as a positive evaluation function. The fourth module is used to acquire target color data and input the target color data into the intelligent color matching model for solving to obtain color matching parameters; The fifth module is used to construct a dyeing quality prediction model based on the color matching parameters and dyeing process parameters; The sixth module is used to input the real-time acquired color matching parameters and dyeing process parameters into the dyeing quality prediction model for quality verification, and to obtain the dyeing quality prediction result; The improvement of the Transformer deep neural network to construct and train a hybrid-driven color prediction model includes: The architecture of the Transformer deep neural network is improved to obtain an improved Transformer deep neural network; The loss function of the Transformer deep neural network is constructed to obtain the hybrid driving loss function; The improved Transformer deep neural network is trained with the hybrid driving loss function as the target to obtain a hybrid driving color prediction model; The improvement of the architecture of the Transformer deep neural network to obtain the improved Transformer deep neural network includes: The input embedding layer is reconstructed to obtain a multimodal input fusion layer for categorical and numerical variables; A multi-head self-attention mechanism is introduced to calculate the attention weight matrix between input features, resulting in a multi-dimensional feature representation after residual connection and layer normalization. The multidimensional feature representation is flattened into a one-dimensional flattened vector, and a shared feature vector is output through four hidden layers using an expansion-then-compression approach. Construct parallel L*a*b* output branches and spectral reflectance output branches, and input the shared feature vector into the L*a*b* output branches and spectral reflectance output branches respectively to obtain L*a*b* color prediction values and spectral reflectance prediction values; A non-trainable color space conversion module is constructed, and the predicted spectral reflectance value is input into the color space conversion module to obtain the L*a*b*color conversion value. The construction of the loss function for the Transformer deep neural network, resulting in a hybrid driving loss function, includes: Construct a data-driven loss term based on the predicted L*a*b* color values; A physical consistency loss term is constructed based on the L*a*b* color conversion value and the spectral reflectance prediction value. Construct a concentration-color depth monotonicity constraint loss term; The L*a*b* data-driven loss term, the spectral reflectance physical consistency loss term, and the concentration-color depth monotonicity constraint loss term are weighted and summed to obtain the hybrid driving loss function.
Citation Information
Patent Citations
Method for testing color matching of colored spun yarn through computer
CN107766603A
Single-color cotton fabric color and dye concentration prediction model construction method based on PSO-LSSVM
CN113536687A