Abstract
Aiming at the demand of color matching techniques in the spinning process, a neural network prediction model is constructed in this research study, and the gridded full color phase mixing space of colored fibers is used as the sample space. Subsequently, 30 grid points are employed as training samples, while another 30 grid points are adopted as testing samples, in which the parameters of the input, hidden, and output layers are optimized. Additionally, the neural network prediction model is constructed by training samples, and validated by testing samples. Lastly, a neural network prediction model is applied to implement the prediction of color and mixing ratios for any point within the full color phase mixing model. Through the assessment of the testing samples, the predicted results for the colors of the grid point samples showed an average color difference of 1.29 (minimum was 0.22 and maximum was 2.97); the forecasts for the mixing ratios of the colored fibers were that the range of the mean absolute error for the mixing ratios of individual samples was from 0.01% to 0.18%, and the mean absolute error for the mixing ratios of all samples was 0.21%. The experimental results indicated that the proposed neural network model has a relatively advanced prediction accuracy.
Keywords
Textile fibers can be endowed with certain colors through techniques such as dyeing, dope-dyeing, structural coloring, and gene modification (GM).1–3 Mixing different colored fibers and then turning them into yarns, fabrics, and garments, which are widely used in sportswear and fashion fabrics, has received extensive attention and a favorable response from the market. As it eliminates the fabric dyeing process, it has the characteristics of short-process, low-consumption of energy and dyeing materials, low-pollution, and suitability for small-batch and multi-variety production, which is considered as a green, low-carbon, environment-friendly, and sustainable manufacturing mode.4–6
When developing new textile products according to mixing of colored fibers, it is essential to forecast the mixing colors of different proportions of multiple primary colored fibers, and then adjust the mixing ratios according to the sample results to achieve a specific color-mixture effect.7–9 When designing the products from incoming samples, it is required to predict the primary colors and their mixing ratios for mixing from incoming samples, and adjust the primary colors and their mixing ratios according to the sample results, so that the final colors of the products can meet the requirements. For the purpose of promoting the upgrading and development of the colored fiber mixing technique and the colored spun yarn industry, it is imperative to build a relevant color prediction theory for the demands of color mixing of colored fibers in the spinning process, and establish crucial techniques to tackle the difficulties in the spinning of colored yarns.10–12
In recent years, the application of neural network algorithms to cope with the prediction of multi-factor, nonlinear, and complicated systems have been considered as a promising method.13,14 The neural network prediction model mainly consists of three parts: sample space, prediction module, and algorithm. Among them, the sample space is composed of all samples with specific attributes which usually includes training, testing, and predicting samples. The neural network prediction module consists of three modules: the input, the hidden, and the output layers. The neural network algorithm is a composition of a mapping among high-dimensional data and a fitting function based on the data distribution. By the construction of neural network prediction model and the application of neural network algorithm to achieve color prediction for products prepared by colored fibers, it is possible to solve the color prediction difficulties and provide an effective technical means for color prediction of colored yarns.
To this end, this article uses neural network theory to establish the color prediction model according to the digital mixing process of colored fibers, and employs the prediction algorithm to perform prediction for specific cases. Firstly, the gridded mixing mode of colored fibers was planned based on the digital mixing process of six primary colored fibers, and the full color phase mixing model was built, which laid the foundation for the implementation of full color phase prediction. Secondly, 30 uniformly distributed grid points were chosen as training samples and another 30 uniformly distributed grid points were chosen as testing samples in the full color phase mixing model of the gridded color mixing of the six primary colored fibers. Thirdly, the parameters such as the mixing ratios of colored fibers, spectral reflectance curves, and color values of the samples were obtained through the measurement of physical samples. Fourthly, the structure and parameters of the input, hidden and output layers were optimized based on the known conditions and prediction objectives. Additionally, the prediction function of the hidden layer module was constructed by the training samples as well. Fifthly, the prediction accuracy of the hidden layer module was evaluated by testing samples, and if it met the expected target, the construction of the neural network prediction model was completed; otherwise, more training samples were chosen and retrained until the prediction accuracy was achieved. Sixthly, according to the forecast requirements, the relevant color and proportion predictions were carried out for any point within the full color phase mixing model, which provided technical support for the product design and manufacturing of colored yarn.
Construction of gridded color mixing mode and full color phase mixing model
Color wheel for color mixing of six primary colors
Assuming that the colored fibers
Set
The positions of the above variables in the color space are illustrated in Figure 1(a). Taking the primary color β and γ as an example, in the inferior arc formed by the primary color β and γ in the color wheel, l denotes its arc length, d indicates the diameter of the color wheel, η indicates the sequence number of the six arc area formed by the six primary colors, θ indicates the angle of the arc formed by the color block (gray area) and the primary color α corresponding to the center of the circle.

The color wheel for color mixing of six primary colors: (a) spatial location and (b) mixing effect. B: blue; C: cyan; G: green; M: magenta; R: red; Y: yellow.
Set
Assuming that
Assuming that the RGB color values of the six primary colors red (R), yellow (Y), green (G), cyan (C), blue (B), and magenta (M) are R (255,0,0), Y (255,255,0), G (0,255,0), C (0,255,255), B (0,0,255), and M (255,0,255), the circular full color phase chromatography can be derived according to formula (1) as shown in Figure 1(b).
Full color phase mixing model for the six primary colored fibers
Assuming that the gridded parameter n is a positive integer, set
Assuming that the mixing ratios of
Construction of mass, mixing ratio, and color matrix of the full color phase mixing model
Mass matrix of mixed samples of the full color phase mixing model
According to formula (3), the mass matrix of all mixed samples is obtained as follows.
Mixing ratio matrix of the mixed samples of the full color phase mixing model
According to formula (4), the mixing ratios of the mixed samples are
Color matrix of the mixed samples of the full color phase mixing model
According to formula (6), the color value of the mixed samples is
Among them, when
Construction of training and testing samples for neural networks
To establish a neural network prediction model, it is essential to obtain representative samples from the sample space of the prediction target to constitute training, testing, and predicting samples. Partial parameters of the training and testing samples are chosen as input layer parameters (known parameters) and other partial parameters of the training and testing samples are chosen as output layer parameters (prediction parameters) according to the prediction requirements. Training and testing samples mainly fulfill the following two significant purposes: the hidden layer module and the fitting function are built by training samples; the prediction capabilities of the hidden layer module are evaluated by testing samples. In this way, the prediction model constructed can have the capabilities of predicting all samples in the sample space.
The above full color phase mixing model composed on the basis of six primary colors enables choice of gridded parameters n according to the precision requirements. Generally, the larger n is, the more grid points are inserted, and the smaller n is, the fewer grid points are inserted. According to the forecasted demand, formula (3) and formula (4), set
According to formula (8) and formula (9), then the mass, mixing ratio, and color matrix of the full color phase mixing model can be determined as follows.
Construction of color prediction model for colored yarn based on neural network algorithm
Composition of neural network prediction model
The neural network used in this research is a model in deep learning. It is a technique based on a program that learns from data and that works similarly to the way the human brain works. The common neuronal networks are feedforward neural networks (FFNNs), 17 convolutional neural networks (CNNs), 18 recurrent neural networks (RNNs), 19 deep belief networks (DBNs), 20 generative adversarial networks (GANs), 21 and spiking neural networks (SNNs). 22 This study uses a back propagation (BP) neural network, which is one of the FFNNs.
The composition of the neural network is illustrated in Figure 2, which is composed of the input, hidden, and output layers.23,24 Among them, each neuron node in the hidden layer has its own activation function and weight coefficients. 25

Composition of neutral network.
Operating principle of neural network prediction model
The operating principle of the neural network used in this research is divided into two main steps: multiple layers of neurons are built, where the individual neurons in each layer are interconnected and can transmit information to each other; the network starts iteratively trying to compute, each time increasing the connections that result in success and decreasing the connections that result in failure, until the issue is resolved. Neural networks can, on the one hand, establish mapping connections between arbitrary dimensional data and, on the other hand, perform fitting of the data to access the fitting function. In fact, a neural network can be considered as a composite function consisting of several univariate functions. For instance, when the number of input layers (five-dimensional matrix) =1, the number of hidden layers (seven neuron nodes) =3, and the number of output layers (three-dimensional matrix) =1, the operating schematic is illustrated in Figure 3.

Schematic diagram of correlation among individual neuron nodes.
Construction of neural network prediction model
Construction of the prediction model
The neural network prediction model involves an input layer, a hidden layer, and an output layer. According to different prediction requirements, the corresponding input, output, and hidden layers need to be constructed. Among them, the hidden layer module construction is the most significant section of the neural network prediction model, which is important for the accuracy of prediction. It is usually necessary to optimize partial parameters of the training sample as input parameters and use its predicted target parameters as output parameters, and then to build the hidden layer module and its fitting function based on the neural network algorithm, and finally implement the conversion from the input to the output parameters by its algorithm. For the demand of the color mixing of colored fibers, the following four input and output modes (Figure 4) can be established and the fitting function of the hidden layer module in the corresponding mode can be obtained to achieve the construction of prediction mode. Among them, the hidden layer is a single layer and the number of nodes = 8.

Schematic diagram of the construction of the prediction model.
In the neural network algorithm, the whole workflow is presented in Figure 5.

Schematic diagram of the workflow of neural network.
Selection of training samples
On the basis of formula (10), mixed samples (with six repeated ones) of columns 1, 3, 5, 7, 9, and 11 were chosen to constitute the training samples. In the above matrix, the mixing ratios of the training samples are 10:0, 8:2, 6:4, 4:6, 2:8, and 10:0, and the combinations are RY, YG, GC, CB, BM, and MR, respectively.
Acquisition of the hidden layer fitting function
According to the mixing ratios and the corresponding spectral reflectance of the training samples, the fitting function of the hidden layer can be established. The construction of the hidden layer fitting function needs to satisfy two prediction requirements: one is to obtain the spectral reflectance (or color value) parameter of the output layer by the fitting function using any sample mixing ratio as the input layer parameter; another is to use any sample spectral reflectance (or color value) as the input layer parameter to acquire the mixing ratio parameter of the output layer by the fitting function.
In the neural network, the hidden layer employs the Logsig function with the following formula.
The output layer uses the Purelin function with the following formula.
The following formula is usually used to calculate the number of hidden layer nodes.
26
Among them, n and m are the number of nodes in the input layer and output layer; L is the number of nodes in the hidden layer; c is a constant between 0–10.
Validation of the hidden layer fitting function
Selection of testing samples
According to formula (10), mixed samples of columns 2, 4, 6, 8, and 10 were chosen to constitute the testing samples. In the above matrix, the mixing ratios of the testing samples were 9:1, 7:3, 5:5, 3:7, and 1:9, and the combinations were RY, YG, GC, CB, BM, and MR, respectively.
Results validation
The above 30 testing samples were validated to evaluate their generalization performance. Each is divided into two main aspects: firstly, comparing its predicted reflectance and calculating its color difference; secondly, predicting its proportion, followed by predicting its reflectance from the proportion and calculating its color difference.
Construction of the prediction module
Selection of forecasting samples
The selection of prediction samples is separated into two parts: one is to choose a non-grid point sample from each of the six color families in the full color phase mixing model, with different proportions, to perform color prediction; another is to conduct a proportional prediction by choosing one non-grid point sample from each of the six color families in the full color phase mixing model with different colors.
Output of prediction results
For the above trained neural network algorithms (i.e. algorithms I and IV), the prediction of spectral reflectance as well as mixing ratio can be performed directly for them, respectively. Since it is an optimal neural network algorithm, high prediction results and accuracy can be obtained.
Application analysis of neural network on colored yarn
The color prediction can usually be divided into the following two aspects: one is to predict the reflectance or color value of the mixed sample according to the reflectance or color value of the six primary colored fibers and their mixing ratios; the other is to forecast the reflectance or color value of the six primary colored fibers and their mixing ratios based on the reflectance or color value of the mixed sample. In the calculation process, a set of 31 simultaneous equations with respect to the mixing ratios of the six primary colored fibers and their reflectance functions can be built from reflectance at visible wavelengths. Taking the color mixing of the six primary colored fibers in this paper as an instance, when solving the reflectance or color value of the mixed sample based on the reflectance or color value of the six primary colored fibers and their mixing ratios, the equation set has a unique solution; when solving the reflectance or color value of the six primary colored fibers and their mixing ratios based on the reflectance or color value of the mixed sample, the equation set is over-constrained, which cannot yield an exact numerical solution, only an approximate solution of infinite approach can be obtained.
In the full color phase mixing model of this paper, when performing the prediction of reflectance or color values of six primary colored fibers and their mixing ratios based on the reflectance or color value of the mixed sample, due to the fact that the predicted sample can only fall into one of the six intervals such as R-Y, Y-G, G-C, C-B, B-M, and M-R, therefore, there are only strong correlations with the two adjacent primary colored fibers, and weak correlations with others. Usually, these weak correlations can be ignored.
Results and discussion
The raw material employed in this research consists of long-staple cotton colored fibers, which were produced by dyeing with reactive dyes in the colors of R, Y, G, C, B, and M, respectively. The six rovings resulting from the opening and cleaning, carding, combing, drawing, and roving processes are all 66 twists/m and their colors are R (119,31,42), Y (225,178,0), G (0,100,79), C (0,116,137), B (36,65,112), and M (154,14,72), respectively. The color values of the six primary colors in the RGB system can be converted to the Yxy system to obtain the real color gamut range as illustrated in Figure 6.

Range of color gamut for full color phase mixing model. B: blue; C: cyan; G: green; M: magenta; R: red; Y: yellow.
The roving (linear density 450 tex) R, Y, G, C, B, and M were chosen to prepare 30 colored yarns (linear density 27.76 tex) according to the mixing ratio 10:0, 8:2, 6:4, 4:6, 2:8 by using a JWF1551A two-channel computer numerical control (CNC) ring spinning frame.27,28 After that, the yarn was woven using a small circular knitting machine, and the fabric training sample achieved is displayed in Figure 7. Among them, the fiber combinations in each row are RY, YG, GC, CB, BM, and MR, and the mixing ratios in each column are 10:0, 8:2, 6:4, 4:6, 2:8, and 0:10, respectively.

Image of the training sample containing 30 colored fabrics (excluding six repeated ones). B: blue; C: cyan; G: green; M: magenta; R: red; Y: yellow.
According to the spectrophotometer, 31 values of spectral reflectance of 30 colored fabrics corresponding to wavelengths from 400–700 nm were measured, and their reflectance curves are shown in Figure 8, from which it can be seen that the reflectance of all fabrics are uniformly varied.

Training samples containing actual reflectance curves for 30 fabrics: (a) RY; (b) YG; (c) GC; (d) CB; (e) BM and (f) MR. B: blue; C: cyan; G: green; M: magenta; R: red; Y: yellow.
The mixing ratios of the above 30 fabrics were used as input, and 31 reflectance values corresponding to the wavelengths from 400–700 nm were used as output, and the Levenberg-Marquardt method was employed for training. After training, the correlation between each number of iterations and the mean squared error is illustrated in Figure 9. Among them, the proportions of train, validation, and test in the figure are respectively 0.8, 0.1, 0.1, and the mean square error of each validation sample is closer to 0.001 after 29 computations.

The number of iterations of the neural network and the mean square error.
The roving R, Y, G, C, B, and M were chosen to spin 30 colored yarns according to the mixing ratios of 9:1, 7:3, 5:5, 3:7, and 1:9 by using a JWF1551A two-channel CNC ring spinning frame. Then, the yarn was woven using a small circular knitting machine and the fabric testing samples were achieved. Subsequently, a spectrophotometer was used to access their reflectance. After that, the neural network algorithm was employed to perform the correlation prediction, and the predicted and measured reflectance of the 31 reflectance corresponding to the wavelengths from 400–700 nm were derived as presented in Figure 10. As can be seen from the picture, the predicted and measured 31 reflectance values corresponding to wavelengths from 400–700 nm have a favorable coincidence.

Comparison of predicted and measured reflectance curves for testing samples containing 30 fabrics: (a) RY; (b) YG; (c) GC; (d) CB; (e) BM and (f) MR. B: blue; C: cyan; G: green; M: magenta; R: red; Y: yellow.
According to color optics theory, the L*a*b* color value of a fabric can be calculated from the predicted reflectance of the above fabric. According to the combination of R-Y, Y-G, G-C, C-B, B-M, M-R of the full color mixing model, 30 fabrics were woven, and the colors of the woven samples (top row) were compared with the corresponding forecast colors of the neuronal network (bottom row), as illustrated in Figure 11.

Comparison of predicted and measured colors for testing samples containing 30 fabrics: (a) RY; (b) YG; (c) GC; (d) CB; (e) BM and (f) MR. B: blue; C: cyan; G: green; M: magenta; R: red; Y: yellow.
According to the color measurement committee (CMC) 2:1 formula, the comparison of its different color differences is demonstrated in Table 1. As can be seen from Table 1, with the variation of the mixing ratio, the color difference also exhibits a certain range of fluctuation, and its average color difference is about 1.29. Among them, the maximum color difference is 2.97 and the minimum is 0.22. This is mainly due to the difference in mixing ratio which causes uneven drafting of the fed fiber strands.
Comparison of predicted and measured colors of colored fabrics
B: blue; C: cyan; G: green; M: magenta; R: red; Y: yellow.
Color prediction was performed for non-grid point samples, and the forecast results are presented in Table 2. It is demonstrated that the algorithm can be applied to the color prediction of all non-grid points in the full color phase mixing model.
Prediction of colors from non-grid point proportions
B: blue; C: cyan; G: green; M: magenta; R: red; Y: yellow.
According to the colors of Table 2, the color blocks are drawn as indicated in Figure 12 (from left to right corresponding to numbers 1∼6 respectively).

Comparison of the colors of different mixed samples.
The 31 reflectance values corresponding to the wavelengths from 400–700 nm of 30 fabric training samples were used as input and the mixing ratio as output, and the Levenberg-Marquardt method was applied for training. After that, the trained algorithm was employed to predict the mixing ratio as well as the reflectance of the other 30 testing samples, which were compared with the 31 measured reflectance values as illustrated in Figure 13. As can be seen from the picture, the predicted and measured 31 reflectance corresponding to wavelengths from 400–700 nm have a favorable coincidence.

Comparison of the predicted and measured reflectance curves of the testing samples containing 30 fabrics: (a) RY; (b) YG; (c) GC; (d) CB; (e) BM and (f) MR. B: blue; C: cyan; G: green; M: magenta; R: red; Y: yellow.
According to color optics theory, the L*a*b* color value of a fabric can be derived from the forecasted reflectance of the aforementioned fabric. On the basis of the six primary color combinations of R-Y, Y-G, G-C, C-B, B-M, M-R, 30 fabrics were fabricated, and the colors of the fabricated samples (top row) were compared with the corresponding predicted colors (bottom row), as depicted in Figure 14.

Comparison of predicted and measured colors of testing samples containing 30 fabrics: (a) RY; (b) YG; (c) GC; (d) CB; (e) BM and (f) MR. B: blue; C: cyan; G: green; M: magenta; R: red; Y: yellow.
According to the CMC 2:1 formula, the comparison of different color differences is shown in Table 3. From the computation, it can be revealed that the mean absolute error (MAE) between the predicted and measured proportions of individual mixed samples is 0.18% at maximum and 0.01% at minimum, and the MAE of the proportions of all mixed samples is 0.03% with a root mean square error (RMSE) of 0.21%.
Comparison of predicted and measured values for colored fabrics
B: blue; C: cyan; G: green; M: magenta; R: red; Y: yellow.
In addition, it can be seen from Table 3 that with the variation of the mixing ratios, the color difference values also display a certain fluctuation, and the average color difference is about 1.40. Among them, the maximum color difference is 3.59 and the minimum is 0.24. This is mainly attributed to the fact that there is a certain error in the predicted proportion itself, which is further amplified by the factor of uneven drafting, thereby causing a greater color difference.
The proportions were predicted for the non-grid point colors, and the results are summarized in Table 4. It is indicated that the algorithm can be adopted for the proportions prediction of all non-grid points in the full color phase mixing model.
Proportion prediction from non-grid point colors
B: blue; C: cyan; G: green; M: magenta; R: red; Y: yellow.
According to the colors of Table 4, the color blocks are drawn as shown in Figure 15 (corresponding to numbers 1∼6 from left to right, respectively).

Comparison of the colors of different mixed samples.
Conclusion
In this research study, for the demands of the color mixing of colored fibers, a gridded full color phase mixing model of six primary colored fibers is firstly established, and the gridded mixing mode of six primary colored fibers is planned based on this model. Furthermore, a mathematical model is established to express the behavioral pattern of the predicted object, which is used as the sample space to plan the training, testing, and predicting samples; the prediction from the mixing ratios of the multiple primary colored fibers to the colors of the mixed samples and from the colors of the mixed samples to the mixing ratios of the multiple primary colored fibers is achieved by building a neural network model and its algorithm with high prediction accuracy.
According to the requirement of color prediction based on neural network, 30 uniformly distributed grid points in the full color phase mixing model were chosen to prepare the mixed samples for training and obtain the hidden layer module and prediction function. With the hidden layer module and the prediction function, the color of the mixed sample can be predicted based on the color value of the six primary colored fibers and their mixing ratios; it can also forecast the mixing ratios of the six primary colored fibers according to the color values of the fibers and their mixed samples.
In order to evaluate the prediction function of the neural network, another 30 uniformly distributed grid points were selected to prepare testing samples for assessment, and more ideal forecasting results were attained after several iterations, which completed the construction of the neural network prediction model. During the evaluation of the hidden layer module, color and proportion predictions were performed on 30 testing samples. In the color prediction process, the mixing ratios of the six primary colored fibers were used as the input layer parameters, and the 31 reflectance of the mixed samples corresponding to the wavelengths from 400–700 nm were considered as the output layer parameters. After prediction, the color difference between the predicted and measured color values fluctuated within a reasonable range (maximum 2.97, minimum 0.22) and the average value was 1.29. Therefore, the prediction model using the established neuronal network was capable of forecasting the color of 30 mixed samples effectively. Additionally, in the proportion prediction process, the 31 reflectance of the mixed samples was used as the input layer parameters, and the mixing ratios as the output layer parameters. After prediction, the deviation between predicted and measured proportion values fluctuated within a certain range (maximum 0.18% and minimum 0.01% of the MAE of individual mixed samples), and the MAE of the proportions of 30 mixed samples is 0.03%, and the RMSE is 0.21%. Consequently, the prediction model using the proposed neuronal network was sufficient to predict the mixing ratios of the six primary colored fibers for the 30 mixed samples.
For the purpose of predicting the blending color and mixing ratios of non-grid point samples, six non-grid point samples were chosen and their mixing color was forecasted on the basis of the mixing ratio of six primary colored fibers in the full color phase mixing model. Subsequently, six more non-grid point samples were selected and their mixing ratios of the six primary colored fibers in the full color phase mixing model were predicted from their colors. The final results revealed that the constructed neural network color prediction model can achieve color and proportion forecasting for non-grid point samples.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed the receipt of the financial support for the research, authorship, and/or publication of this article: The authors disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: this work was supported by the Fundamental Research Funds for the Central Universities (JUSRP12029 and JUSRP52007A) and the “Jian Bing” and “Ling Yan” Research Fund in Zhejiang Province (2022C01188).
