# Prediction of Cotton Yarn Quality Based on Attention-GRU
## 1 Introduction  
As a preliminary process in weaving, the spinning process plays a crucial role in the quality of the resultant fabric. The quality of the yarn produced directly impacts the final product's quality. Additionally, the cost of raw cotton constitutes a minimum of 50% of the overall fabric production expenses. Consequently, it is imperative to establish cotton-blending strategies and processing parameters based on yarn quality indices. [1, 2]. However, the current production in spinning workshops is driven by orders, and specific production processes are planned according to order requirements. With the diversification of order varieties and processing parameters, the previous approach of determining production schemes through extensive trial spinning can no longer meet the processing demands of enterprises [3]. Furthermore, due to the diversity of raw materials and the complexity of process routes, relying solely on the personal experience of technical personnel results in uncertainties in controlling yarn quality. Real-time analysis of production parameter characteristics of cotton yarn during the manufacturing process to achieve accurate predictions of yarn quality in spinning is a crucial measure for enhancing yarn quality in spinning mills [4]. In response to thissituation, scholars both domestically and internationally have proposed a series of data-driven methods for predicting yarn quality. For instance, [PERSON] et al. [5] optimized the input parameter quality of artificial neural networks using linear regression. They employed variables, such as stretching rate and maximum load of elastic fabrics, as input parameters for the model, thereby facilitating predictions of fabric elongation and recovery. [PERSON] et al. [6], through the LM algorithm, predicted color values of cotton samples under different peel levels by adjusting the model's hidden layer node count and input quantity. [PERSON] et al. [7] employed a method of multiple linear regression to assess the performance of their developed model. This assessment was carried out by validating the model using test data to predict the mean squared error (MSE) and the correlation coefficient (R-value). Through this approach, they achieved the prediction of the stretchability of cotton-wrapped nylon core yarn. The model's validation on predicting yarn elongation exhibited a mean squared error of 0.365 for the validation dataset. [PERSON] et al. [8] established an applied regression (AR) mathematical model to predict and control spinning tension, with the aim of achieving real-time and effective tension control in the spinning process. [PERSON] et al. [9] employed an optimized support vector machine (SVM) model for quality prediction in small-sample spinning processes. Despite achieving a 3% enhancement in predictive accuracy compared to a conventional SVM prediction model, this optimized model exhibited sensitivity to parameter selection and the choice of kernel function. [PERSON] et al. [10] established a multivariate linear regression model between cotton bale/slap and yarn strength, as well as sliver CV quality indicators, effectively reducing raw cotton waste. However, it struggles to adapt well to complex nonlinear relationships. [PERSON] et al. [3] studied the impact of synthetic-fiber-spinning process parameters on winding tension using a gray prediction model, providing an applicable approach for predicting spinning tension, yet lacking sufficient predictive accuracy. With the rapid advancement of deep learning theory, its advantages in nonlinear data processing have gradually emerged. Researchers have continuously optimized and extensively utilized the BP neural network for yarn quality prediction. [PERSON] et al. [11] introduced a four-layer backpropagation neural network with dual hidden layers for the prediction of cotton yarn quality in the spinning process. In comparison to a three-layer network, this four-layer architecture exhibited improvements in both training steps and average error.