## 2 Method
### Data Analysis
#### 2.2.2 Scnn  
In this study, we propose a six-layer SCNN, which includes an input layer, two convolutional layers, an flatten layer, a fully connected layer, and an output layer. The first layer is the input layer. The second layer is the C2 layer, which consists of a convolution layer, a batch normalization layer (BN), and a rectified linear units (ReLu). The convolution layer has eight filters of size (\(N_{fr}\), 1), which move along the time axis to extract the frequency features. The third layer is the C3 layer, which also consists of a convolution layer, a batch normalization layer (BN), and a ReLu. The C3 layer has 16 filters of size (1, 10), and the filters move along the horizontal axis to extract time domain features. The fourth layer is the flatten layer, which combines the output of C3 into a vector, and the fifth layer is a fully connected layer. Lastly, the softmax layer is applied to predict the probability distribution of the output classes. The SCNN network framework is shown in Figure 4.  
Figure 4: The six-layer SCNN framework for MI classification. Figure 3: The feature images of the three electrodes (C3, Cz, and C4). In this SCNN, a neuron is defined as \(N\) (\(m\), \(k\), \(j\)), where \(m\) is the number of layers of the neural network, \(k\) is the number of feature maps, and \(j\) is the number of position feature maps. If the input and output of a neuron are \(x_{k}^{m}(j)\) and \(y_{k}^{m}(j)\), respectively, the relationship between the input and output can be expressed as Equation (4) [42]. \[y_{k}^{m}(j)=f(a)=f\left(x_{k}^{m}(j)\right) \tag{4}\]  
where \(f\) is the activation function (ReLu) [43]. Its expression is as follows:  
\[f(a)=\ln\left(1+e^{a}\right). \tag{5}\]  
II is the input layer, and the input image is \(x_{ij}^{1}(j)\) (\(N_{C}@N_{fr}{}^{*}N_{t}\)). Then the output expression of the C2 layer is as follows:  
\[y_{k}^{2}=f(a)=f\left(\sum_{i=1}^{44}x_{ij}^{1}*w_{k}^{2}+b_{k}^{2}(j)\right) k=1,2,3\ldots 8 \tag{6}\]  
where \(w_{k}^{2}\) is the filter of (\(N_{fr}\),1), \(y_{k}^{2}\) is the output of the C2 layer, \(b_{k}^{2}(j)\) is the deviation. Eight filters slide along the time axis of the feature image to output feature vectors of eight sizes (1, 200). These feature vectors are regularized by the BN layer before being input to the activation layer, and then input to the C3 layer. The output of the C3 layer is as follows:  
\[y_{k}^{3}=f\left(\sum_{i=1}^{10}y_{k}^{2}[(j-1)\times 10+i]\times w_{k}^{3}+b_ {k}^{3}(j)\right)k=1,2,3\ldots 16 \tag{7}\]  
where \(w_{k}^{3}\) is the filter of (1, 10), \(b_{k}^{3}(j)\) is the biases, \(y_{k}^{3}\) is output of the C3 layer. Sixteen filters slide horizontally along the feature vector to obtain vectors of 16 sizes (1, 20). These vectors are regularized by the BN layer before being input to the activation layer, and then input to the F4 layer to be combined into a vector, y4 of (1, 320). D5 is a fully connected layer consisting of 64 neurons, and its output is a vector of (64, 1). The output of the D5 layer is as follows:  
\[y^{5}=f\left(\sum_{i=1}^{320}y^{4}w_{i}^{5}+b^{5}(j)\right). \tag{8}\]  
\(w_{i}^{5}\) and \(b^{5}(j)\) are the weights and biases of the D5 layer, respectively. O6 is the softmax layer and consists of two neurons. The output of the O6 layer is as follows:  
\[y^{6}=f\left(\sum_{i=1}^{64}y^{5}(i)w^{6}(i)+b^{6}(j)\right) \tag{9}\]  
Equations (4)-(9) are the forward propagation calculation flow of the SCNN algorithm. The SCNN corrects the weights and biases by the error back propagation algorithm. The SCNN is trained using the labeled training set and \(E\) is calculated by the difference between the predicted value and the true value. We update the weights and biases of the neural network using gradient descent [44], and the expression is as follows:  
\[w^{k}=w^{k}-\eta\frac{\partial E}{\partial w^{k}} \tag{10}\]  
Figure 4:0In the training of the SCNN, we should not calculate the minimum value of the loss as a criterion for judging whether to stop training, but rather set the epoch equal to 150.