# WiGR: A Practical Wi-Fi-Based Gesture Recognition System with a Lightweight Few-Shot Network
## 3 Methods
### Overview of WiGR
#### 3.2.3 Lightweight Few-Shot Network  
The key structure of WiGR is a lightweight few-shot network that consists of a feature extraction subnetwork and a similarity discrimination subnetwork. The function of the feature extraction subnetwork is to extract advanced features of support samples and testing samples, and the features of testing samples and support samples are then combined in-depth. The function of the similarity discrimination subnetwork is to determine the relationship of combination features and output the similarity score of these gestures. The samples with the highest score are considered to be of the same type. Additionally, we introduce depthwise separable convolution and an inverted residual layer of a linear bottleneck [30; 31] in the network to reduce model computations and parameters. Feature extraction subnetwork. As shown in Figure 5, we adopted the one \"conv block\" and five \"mobile blocks\" to construct the feature extraction subnetwork. Figure 4: Comparison of the CSI phase before and after processing. The upper row shows CSI radio images, and the lower row shows the waveform of the CSI phase. Specifically, conv block is a normal CNN structure that consists of a convolutional layer, a normalization layer, and an activation layer. Each convolutional layer has multiple three-dimensional (3-D) convolutional kernels, and each 3-D convolutional kernel consists of multiple two-dimensional (2-D) convolutional kernels. Each 2-D convolutional kernel performs a convolution operation on the CSI data and can simultaneously extract the spatial features and temporal dynamics of the CSI data. The CSI datum of each gesture obtained from one antenna is a 2-D radio image (see Figure 4a), which can be denoted as  
\[X\in R^{N_{c}\times T} \tag{2}\]  
where \(R\) is a real number, \(N_{c}\) is the number of subcarriers, and \(T\) is the number of data frames. As an analogy to the image recognition problem, one CSI datum is analogized to a video frame, where \(N_{c}\) looks like the pixel in one frame and \(T\) looks like the number of frames. If there are \(N\) CSI data (\(N=N_{T_{X}}\times N_{Rx}\)), the output \(Q_{i}\) of the ith 3-D convolutional kernel can be denoted as  
\[Q_{i}=\sum_{N=1}^{N}X_{N}*W_{i}^{N}+b_{i} \tag{3}\]  
where \(X_{N}\) is the \(N\)th 2-D CSI datum, \(W_{i}^{N}\) is the \(N\)th 2-D convolutional kernel of the \(i\)th 3-D convolutional kernel, and \(b_{i}\) is the ith bias parameter. Benefitting from the excellent feature extraction capabilities of CNN [6; 7; 8], the feature extraction process of the feature extraction subnetwork is effective. In addition, we use depthwise separable convolution instead of ordinary convolution operations in the convolutional layer to reduce the network's parameters and computing consumption. The normalization layer can accelerate network training by reducing the internal covariate shift. The activation layer adopts two different activation functions, i.e., H-swish [45] (HS) and ReLU [46] (RE). H-swish is an improved version of rectified linear unit (ReLU) and can work on more features, but the calculation consumption of H-swish will also increase compared with the ReLU. Therefore, we used H-swish and ReLU alternately to balance the complexity and accuracy of the network. The mobile block is based on a linear bottleneck with an inverted residual structure [30], which is beneficial for deployment on mobile devices. Firstly, the block makes  
Figure 5: An illustration of the structure of the feature extraction subnetwork (**a**) and the SE (Squeeze and Excitation) module (**b**). The feature extraction subnetwork consists of a conv block and a mobile block. a low-dimensional compressed feature high-dimensional using a pointwise convolution layer consisting of M convolution kernels with a kernel size of \(1\times 1\). M is the number of convolution kernels, whose size is determined by the parameter fac. fac is used to change the number of feature dimensions proportionally, which is beneficial for reducing the model calculation complexity.