## 3 Deep Learning Algorithm  
### CNN-1D (Composition of Convolutional Neural Network)  
A Convolutional Neural Network (CNN) is a deep neural network that utilizes a convolutional structure. The structure of a one-dimensional CNN comprises an input layer, convolutional layer, pooling layer, fully connected layer, and output layer, as shown in Figure 7.  
The convolutional layer is the core of the convolutional neural network. Its main function is to extract the input feature information. It is composed of convolution units. The input information is moved regularly through the receptive field pair, and the features of the corresponding area are extracted. Low convolutional layers can only extract low-level features, and deep convolutional layers can extract deep features. In the convolution layer, the convolution kernel performs convolution operation on the output of the previous layer and outputs the convolution result, and its formula is expressed as:  
\[y_{j}^{l}=\sum_{i=1}^{M}x_{i}^{l}\otimes k_{ij}^{l}+b_{j}^{l} \tag{2}\]  
\(y_{j}^{l}\) is the vector obtained after the \(j\)-th convolution calculation of layer \(l\); \(M\) is the number of input feature vectors; \(x_{j}^{l}\) is the \(i\)-th input feature vector of layer \(l\); \(\otimes\) means correlation operation; the \(i\)-th input feature vector is convolved with the \(j\)-th convolution kernel; and \(k_{ij}^{l}\) is the \(j\)-th bias vector of the \(l\) layer. The convolution layer belongs to the hidden layer. After the convolution operation, the activation function is usually used to perform affine transformation on the logits output by each convolution to increase the nonlinear characteristics of the network model. Considering the convergence speed and overfitting problems, this paper uses Rectified Linear Unit (ReLU) as the hidden layer activation function. This activation function does not have the problem of gradient scattering. Compared with the Sigmoid function, it has a  
Figure 6: Comparison of measured and reference direction. Figure 7: One-dimensional convolutional neural network (CNN-1D) structure. faster convergence speed, and at the same time can improve the sparsity of the network and effectively prevent the overfitting problem. The function expression can be defined as:  
\[ReLU(x)= \begin{cases}x&x>0\\ 0&x\leq 0\end{cases}  \tag{3}\]  
After the activation function, the pooling layer [34] is usually used to reduce the dimensionality of the features, so as to reduce the amount of parameters and improve the fault tolerance rate of the model. The more commonly used pooling operations are mainly Max Pooling and Average Pooling. The former takes the maximum value of the local receptive field as the output, and the latter takes the average value of the local receptive field as the output. In this paper, the max pooling is used for downsampling, the pooling window is \(2\times 1\), the movement is performed with a stride of 2, and the input is traversed. The pooling operation of the \(1+1\) layer can be expressed as:  
\[P_{i,m}=\text{max}q_{i,(m-1)S+n} \tag{4}\]  
Among them, \(P_{i,m}\) represents the \(i\)-th feature map in the \(m\)-th layer; \(q_{i,(m-1)S+n}\) represents the value of the \((m-1)S+n\) unit in the \(i\)-th feature map; and \(S\) is the size of the overlapping portion of adjacent sampling windows. The classification layer consists of a fully connected hidden layer and a Softmax layer. The fully connected layer flattens the output of the previous pooling layer into a one-dimensional feature vector, and the first fully connected. The activation function of the hidden layer is ReLU, and Softmax is the generalization of logistic regression mainly used for multi-classification problems. The probability \(y_{i}\) of the sample belonging to the \(i\)-th category calculated according to Softmax can be expressed as:  
\[y_{i}=\frac{e^{a_{i}}}{\sum_{k=1}^{C}e^{a_{k}}} \tag{5}\]  
Among them, \(C\) is the number of categories to be predicted and \(a\) is the output unit of the fully connected network.