## 3 Optimization Methods and Results  
### Network Model Design and Parameter Reduction  
According to our analysis, the main part of weight parameters is from the first FC layer in the CNN model. We employ three methods to reduce the parameters' number:  
1. Downsampling the data. We can use downsampling to reduce the amount of computation significantly while the accuracy of classification remains high. 2. Use more CONV layers to reduce the FC layer's weights. The more CONV layers, the shorter length of the FC layer's input tensor, and the fewer FC layer's parameters. 3. Modify the CONV layers' structure to reduce CONV layers' parameters. Reducing the ratio of output channels to input channels can effectively reduce the parameters of the convolution layers. To design a CNN model that has higher accuracy and fewer parameters, we conduct several experiments based on our development environment, which includes PyTorch 1.4.0 (CUDA version), Python 3.6.5, and a GPU of NVIDIA GTX 965M. The corresponding model parameters include the number of CONV layers, the ratio of output channels to input channels, and the input tensor's length. Figure 7: Control modules design. (**a**) State transition diagram of System controller (SYS_CTRL) module. (**b**) State transition diagram of DDR controller (DDR_CTRL) module. When the number of CONV layers is 2, 3, 4, 5, 6, 7, and 8, its influence on the CNN model is shown in Figure 8a. As the number of convolution layers increases, the number of weight parameters decreases, and the accuracy increases accordingly. When the number of CONV layers is greater than 5, the increase in it has no significant effect on the accuracy, and the speed of parameter reduction also decreases. To reduce the required buffer size, we modify the CNN's structure by changing the ratio of output channels and input channels of CONV layers. We design six models with 7 CONV layers and 2 FC layers, while their structures are different, as shown in Table 1. In the models, layer 7 has 32 output tensors, whose size is 4. They are flattened into a tensor with a length of 128, which serves as the input features of layer 8. The result is shown in Figure 8b, demonstrating that the model with a lower ratio needs fewer required buffer size while maintaining high accuracy. Moreover, to reduce the computation amount, we take the downsampling of the original signal, which has a length of 1024 sample points and get the signals with a length of 512, 256, 128, respectively. The corresponding sampling frequency is 109.00 Hz, 54.50 Hz, 27.25 Hz separately, which will not result in signals with alias frequencies according to [PERSON]'s theorem. As shown in Figure 8c, the results indicate that the accuracy is reduced when the input signal's length is fewer than 512. Based on the above experiments, the final CNN, which has 12,150 parameters in total, is shown in Figure 8d. Because the amount of data is relatively small, we use 5-fold cross-validation to estimate the generalization error and ensure the model's effectiveness. For each of the 5 folds, each model is trained for 300 epochs using the adaptive moment estimation (ADAM) optimizer and the cross-entropy loss function. The learning rate with an initial value of 0.003 decreases 10 times every 100 epochs, and the batch size is 200. The training process is shown in Figure 8e, which indicates that the loss function decreases, and the accuracy increases gradually. The average of the classification results of 5 models is used as the estimation of CNN's performance. Moreover, to avoid the error introduced by the random extraction of the folds, we repeated the experiment 10 times. The mean accuracy is 99.27% and the standard deviation is 0.19%, which illustrates the CNN model has excellent generalization performance. The mean value of macro F1, which is calculated by using formula (3)-(6), is 98.75% and the standard deviation is 0.32%, which indicates the model has a highly stable classification ability for 4 types of waveforms. [PERSON] et al.