## 3 System Design
### Data Preprocessing  
After collecting the data, it was necessary to perform further processing of the data. We chose the Hampel filter among the filters for outlier processing, which has the characteristics of robustness and accuracy and can effectively handle data with outliers without being disturbed by single or small numbers of extreme values. Compared with other filters, such as the mean filter or median filter, the Hampel filter is more robust in handling data containing outliers and can estimate the true value of the data more accurately. This is because the Hampel filter considers not only the neighboring values of each data point but also the values within a certain range around the data point. In this paper, the window size of the Hampel filter is set to 10; it uses the sliding window method to process the data, and it uses a threshold of 3 for \(MAD\) to identify outliers. The core mathematical relationship of the Hampel filter is as follows:  
\[MAD_{i}=median|x_{j}-x_{i}|,j\in[i-k,i+k] \tag{1}\]  
\[r_{i}= |x_{i}-MAD_{i}| \tag{2}\]  
In a dataset, if the residuals (i.e., the difference between the actual observed and predicted values) of some of these data points exceed a specified threshold T, then these  
Figure 4: System architecture diagram.  
data points are considered as outliers. To deal with these outliers, we can take the median replacement approach, i.e., replace it with the median of the data points around that outlier. The processed results are shown in Figure 5.  
Since the acquisition of human activity CSI signals is usually affected by high-frequency noise, a low-pass filter is usually used to remove the high-frequency noise. We chose the Butterworth filter because of its good smoothness and low phase distortion. Compared with other filters, the Butterworth filter's frequency response changes more smoothly, so it can effectively retain the low-frequency components of the signal without introducing additional distortion or oscillation. In addition, its phase response is linear and thus does not introduce any phase distortion, thus preserving the temporal information of the signal. The core mathematical relationship of the Butterworth filter is shown in Equation (3).  
\[\left|H(\omega)\right|^{2}=\frac{1}{1+\left(\frac{\omega\omega}{\omega_{c}} \right)^{2n}}=\frac{1}{1+\epsilon^{2}\left(\frac{\omega}{\omega_{p}}\right)^{2 n}} \tag{3}\]  
In this paper, the Butterworth cutoff frequency is set to 3 Hz; the sampling frequency is 1000 Hz; and the filter order is 25. The denoising results are shown in Figure 6:  
After the above processing of the data, this time series data will continue to be processed using a sliding window. Based on the size of the data, we specified a window size of 125 and set a threshold size of 60%. If the number of behavior types in the current window exceeded the threshold, it was labeled as 1, otherwise it was labeled as 2. The threshold was set because the process between no behavior and doing an action was not easy to  
Figure 5: Outlier removal: (**a**) before outlier processing; (**b**) after outlier processing.  
Figure 6: Noise removal: (**a**) before denoising; (**b**) after denoising.  
determine, and after verification and testing, we set the threshold size to 60%. After all the above preprocessing, we could use four-fold cross-validation to divide the training set and test set, and input the data into SM-TCNNET for training.