1 Introduction

The most important step in cotton knitting is the production process from cotton fibre to cotton yarn. The process includes a series of production processes such as cleaning cotton, combing cotton, Thick yarn, Fine yarn, etc. The yarn strength is an important indicator of the quality of the yarn, the yarn is strong, and the end rate is low in the process of processing, and it is beneficial to the process of spinning and weaving, and not only make the product durable. At the same time, it also reduced the intensity of labour, Ti, high production efficiency.

The strength of the yarn is divided into absolute power, which is the force required by the external force directly to the fracture, which is also known as the strength of the fracture and relative strength (such as the length of the yarn, the length of the thread) Class 2. The yarn strength is the maximum load of the unit thickness or the size of the yarn, which is the absolute power and the yarn line. The ratio of density. In the case of machine setting, the strong performance of cotton yarn is mainly determined by the properties of raw materials.

In the analysis of the relationship between fiber performance and yarn quality, the methods of regression analysis and BP neural network are often used in addition to the traditional fracture mechanism model. The two prediction methods are higher, and we use BP neural networks and convolutional neural network (CNN) to predict the results and compare the prediction results with the first two methods.

2 Methodology

2.1 Selection of Input Index and Output Index

Fiber strength (g/tex) and fiber length (inch) and elongation (%), impurity content (Cnl) length irregularity (%), yellow + b, Mike Ronny (MIC), reflectivity (%) factors play a leading role on the strength of yarn, put these 8 indicators as the model input. Yarn strength as output index. 25 groups of data were collected, of which 20 were used for model training, and the 5 groups were used for model testing.

2.2 Structure Design of CNN-BP Neural Network

The convolutional neural network is combined with BP neural network to design 5 layers of convolution BP neural network, as shown in Fig. 1, including 1 level input layer, 1 layer volume layer, 1 level sampling layer, 1 level BP training layer, 1 layer fully connected output layer.

Fig. 1
figure 1

CNN-BP neural network

Because there are 8 independent variables, in the input layer, each input sample is constructed in a fixed order into a (3 × 3) matrix \(X = (X_{1} , \ldots , \, X_{m} )^{T}\) and the vacancy is assigned to zero [1,2,3]. The convolutional layer is concretely constructed, as shown in Fig. 2.

Fig. 2
figure 2

Convolutional layer structure

Seven (3 × 3) convolution cores are set up, and two (3 × 3) experts guide the combinatorial structure of the pool core and (1 × 1) convolutional kernel. The number of (3 × 3) convolution kernel and combinatorial structure can vary with specific needs. In the output, the feature graph extracted from the (3 × 3) convolution kernel and the combinatorial structure is arranged in a row [46]. Assuming that Mi is the output of the i (3 × 3) convolution kernel, Ni is the output of the i composite structure. The following expression is obtained:

$$M_{i} = f(X_{i} \otimes W_{i} + b_{i} )\quad N_{i} = f\left( {guidpool\left( {X_{i} } \right) \otimes V_{i} + o_{i} } \right).$$
(1)

Among them guidpool() instructing the pool core for experts, the effect is to extract a parameter that is considered to have a larger impact on the output. When there are multiple guidpool(), the extracted parameters cannot be the same. Wi, Vi represents the weight vector of the i convolutional kernel and the expert instruction pool core. The operation symbol “\(\otimes\)” represents the convolutional operation of the convolution kernel with the first feature graph or the data matrix, the result of convolution is added to the corresponding offset vector bi or 0i. f() is a specific nonlinear excitation function. Assuming that H is a convolution layer, the production process of H can be described as:

$$H = M_{1} \oplus M_{2} \cdots \oplus M_{m} \oplus N_{1} \oplus N_{2} \cdots \oplus N_{m}.$$
(2)

The M, N is (3 × 3) convolution kernel and the characteristic graph of the combined structure extraction respectively. The operation symbol “\(\oplus\)” represents the different feature graphs into one column, and unifies the dimensions of each feature map, and the insufficient part assignment is zero [1,2,3]. The sampling layer here follows the coiling layer and samples the feature graph based on the maximum value of the down sampling rules.

Suppose D is the sampling layer:

$$D = subsampling\left( H \right).$$
(3)

The sampling requires a pair of feature graphs Mi or Ni, Only one value is extracted, So the sample core here is extracted from up and down, step by step to extract each feature map or the maximum value within. The output is arranged in a row in the original order.

The \(D = (D_{1} , \ldots ,D_{m} )^{T}\) of the output of the sampling layer is input to the BP training layer as the 1 input vector, and the BP training layer structure is shown in Fig. 3.

Fig. 3
figure 3

BP neural network structure

Among them, X = (X1,…, Xm)T is input vector, Y = (Y1,…,Ym)T is output vector, Wij is the weight coefficient of the connection between the input layer and the middle layer, Vjt is the weight coefficient of the connection between the middle layer and the output layer, S = (S1,…,Sm)T input vectors of each element in the middle layer, B = (B1,…,Bm)T is the output vector of each element in the middle layer, T = (T1,…,Tm)T is expected output vector. The concrete steps of the algorithm are as follows:

  1. (1)

    In the range of the interval (− 1, 1), the weight value, and the initial value of the threshold are set.

  2. (2)

    A set of randomly selected input Xm and target Ym learning samples are provided to the neural network.

  3. (3)

    For the middle layer, the input value of each node is Sm, and the output value of each node in the middle layer is Xm with input sample \(\omega_{ij}\), weight θj and threshold Bm, and calculated by input value Sm.

  4. (4)

    The output function of the weights and biases in the neural network is:

    $$F = f\left| {\mathop \sum \limits_{i = 1,\;j = 1}^{n} W_{ij} V_{ij} - B_{ij} } \right|.$$
    (4)

    Using the weight matrix set and the bias vector obtained by this function, the output value of each unit of the output layer is calculated Ym.

  5. (5)

    Using the formula (5) (of which S is the total number of samples, Dk is the dimension of the output vector, and Ym is the network output vector), the unit error dt of the output layer is calculated [46].

    $${\text{d}}_{\text{i}} = \frac{1}{\text{S}}\mathop \sum \limits_{i = 1}^{S} \left| {\mathop \sum \limits_{j = 1}^{{B_{k} }} (Y_{m} - T_{m} )^{2} } \right|.$$
    (5)
  6. (6)

    The weight value Vjt and the threshold value θj of each node of the output layer are constantly corrected until the value reaches a predetermined error dt.

  7. (7)

    Randomly select the unlearned sample vectors into the neural network from the training sample set, return to step 3, until all the training samples are completed.

  8. (8)

    Select a set of input and target samples randomly from the selected learning samples and return to step 3, until the global error of the network is less than a set minimum value, that is, the network convergence. If it is in an infinite learning state, the network can not converge [7,8,9].

  9. (9)

    Finish the training and get the best output value.

After repeated training, the BP neural network constantly adjusts the value of weight and bias vector, which makes the output value of the neural network close to the expected value.

3 Results and Discussion

3.1 Predictive Value of Multiple Regression Method

The principal component analysis method is used to extract three main factors from 8 factors, and the relationship between the three main factors and the influencing factors is the relationship between the main factors and the influencing factors, as shown in Table 1.

Table 1 The relationship between three main factors

Expression by formula:

$$Y_{1} = 0.795x_{1} + 0.863x_{2} + 0.355x_{3} - 0.158x_{4} + 0.504x_{5} + 0.88x_{6} - 0.702x_{7} - 0.469x_{8}.$$
(6)
$$Y_{2} = 0.009x_{1} + 0.073x_{2} - 0.199x_{3} + 0.86x_{4} + 0.024x_{5} + 0.265x_{6} - 0.314x_{7} + 0.703x_{8}.$$
(7)
$$Y_{3} = 0.524x_{1} + 0.422x_{2} + 0.024x_{3} + 0.1x_{4} - 0.67x_{5} - 0.114x_{6} + 0.419x_{7} + 0.087x_{8}.$$
(8)

Among them, Y = (Y1, Y2, Y3) of the main factors were, and x = (x1, x2,…,x8) were the influencing factors.

Based on the above relations, the data matrix corresponding to three principal factors is calculated, and then the yarn strength is taken as the dependent variable and the three principal factors as independent variables [10,11,12]. Logistic multiple regression equation is obtained, as shown in Table 2.

Table 2 Logistic multivariate regression parameter table

Or for formula:

$$Z = 0.35171Y_{1} + 0.15505Y_{2} + 0.36385Y_{3} + 2.25083$$

Among them, the Z is the output value, that is the yarn strength. as shown in Table 3.

Table 3 Comparison between the predicted value and the observed value

3.2 Predictive Value of BP Neural Network Method

The simplest three layer BP neural network is shown in Fig. 4.

Fig. 4
figure 4

BP neural network framework

  1. (1)

    The input layer.

    The input variable: X = {xi, i = 1, 2, 3}, the output variable: \(y_{i}^{(1)} = f\left( . \right) = f\left( {net_{i}^{(1)} } \right) = f\left( {x_{i} } \right) = x_{i}\).

  2. (2)

    Hidden layer.

    The input variable: net(2)j = wji(1)yi(1), the output variable: yj(2) = f(net(2)j) = f(wji(1)yi(1)) among them: i = 1, 2, 3; j = 1, 2, 3, 4 [1315].

  3. (3)

    The output layer.

    The input variable: net(3)k = wkj(2)yj(2), the output variable: yk(3) = f(net(3)k) = f(wkj(2)yj(2)) among them: j = 1, 2, 3, 4; k = 1, 2 [16,17,, 17].

  4. (4)

    Error.

    yk is the output of the neural network, compared with the actual sample data dk, and takes the objective function (this error): E(t) = (dk − yk(t))2/2.

    Then the total objective function: J(t) = E(t) < ε, p = 1,2,…The total number of running samples (accumulative error).

  5. (5)

    Inverse weight correction, gradient.

    1. 1.

      The correction of w(2).

      $$\begin{aligned} w_{kj} \left( {t + 1} \right) =\, & \, w_{kj} \left( t \right) + \Delta w_{kj} \left( t \right) \\ =\, & w_{kj} \left( t \right) - \lambda \frac{{\partial E_{k} (t)}}{{\partial w_{kj} (t)}} \\ =\, & w_{kj} \left( t \right) + \lambda (d_{k} - y_{k} ) \cdot f^{\prime } (net^{(3)}_{k} ) \cdot y_{j}^{(2)} \\ \frac{{\partial E_{k} }}{{\partial w^{(2)}_{kj} }} =\, & \frac{{\partial E_{k} }}{{\partial (net^{(3)}_{k} )}} \cdot \frac{{\partial (net^{(3)}_{k} )}}{{\partial w^{(2)}_{kj} }} \\ = \,& \frac{{\partial E_{k} }}{{\partial y^{(3)}_{k} }} \cdot \frac{{\partial y^{(3)}_{k} }}{{\partial (net^{(3)}_{k} )}} \cdot \frac{{\partial (net^{(3)}_{k} )}}{{\partial w^{(2)}_{kj} }} \\ = \,& - \,(d_{k} - y_{k} ) \cdot f^{\prime } (net^{(3)}_{k} ) \cdot y_{j}^{(2)} \\ \end{aligned}.$$
      (9)

      Among them, λ is the learning rate [1820].

    2. 2.

      Correction of W(1).

      $$\begin{aligned} \frac{{\partial E_{k} }}{{\partial w^{(1)}_{ji} }} =\, & \frac{{\partial E_{k} }}{{\partial (net^{(2)}_{j} )}} \cdot \frac{{\partial (net^{(2)}_{j} )}}{{\partial w^{(1)}_{ji} }} \\ =\, & \frac{{\partial E_{k} }}{{\partial y_{j}^{(2)} }} \cdot \frac{{\partial y_{j}^{(2)} }}{{\partial (net^{(2)}_{j} )}} \cdot \frac{{\partial (net^{(2)}_{j} )}}{{\partial w^{(1)}_{ji} }} \\ =\, & \frac{{\partial E_{k} }}{{\partial (net_{k}^{(3)} )}} \cdot \frac{{\partial (net_{k}^{(3)} )}}{{\partial y_{j}^{(2)} }} \cdot f^{\prime } (net_{j}^{(2)} ) \cdot y_{i}^{(1)} \\ =\, & - \,(d{}_{k} - y_{k} ) \cdot f^{\prime } (net_{k}^{(3)} ) \cdot \sum\limits_{k} {w_{kj}^{(2)} } \cdot f^{\prime } (net_{j}^{(2)} ) \cdot y_{i}^{(1)} \\ \end{aligned}.$$
  6. (6)

    The y is the output value, that is the yarn strength as shown in Table 4.

    Table 4 Comparison between the BP predicted value and the observed value

3.3 Predictive Value of V-SVM Regression Machine Method

Using V-SVM Regression the machine establishes the prediction model of yarn quality, and through genetic algorithm and cross a combinatorial optimization of model parameters, the initial population of genetic algorithm, the number is 20. Predictive value of the yarn strength, as shown in Table 5.

Table 5 Analysis of cotton yarn strength prediction model

3.4 CNN-BP Prediction Method Comparison with Other Three Forecasting Methods

The absolute error curved surface shows in Fig. 5, absolute error distributed cloud map shows in Fig. 6 by the absolute error surface of the predicted value and the actual value of CNN-BP neural network. It is comparison of 4 kinds of predicted values and observation values in Fig. 7 and absolute error contrast diagram of 4 forecasting methods in Fig. 8. There is comparison of four forecasting methods in Table 6.

Fig. 5
figure 5

absolute error curved surface

Fig. 6
figure 6

Absolute error distributed cloud map

Fig. 7
figure 7

Comparison of 4 kinds of predicted values and observation values

Fig. 8
figure 8

Absolute error contrast diagram of 4 forecasting methods

Table 6 Comparison of four forecasting methods

4 Conclusion

Cotton yarn strength prediction method is proposed combined with a convolutional neural network and BP neural network algorithm. The prediction error of yarn strength of CNN-BP algorithm is 0.9%, and the prediction error of mobile communication user number is 2.46% by number fitting and support vector regression algorithm. The error of BP neural network is 11.25%, the error of regression algorithm is 6.22%, and the error of v-SVM algorithm is 3.15%. It is obvious that the CNN-BP algorithm is superior to the support vector regression algorithm and the regression algorithm. The prediction error of the yarn strength of the CNN-BP algorithm is better than that of the BP neural network. The test results show that the error rate of the CNN-BP neural network algorithm is 2.46%, while the error rates of the other three algorithms are more than 3%.