CSI-Based Efficient Self-Quarantine Monitoring System Using Branchy
  Convolution Neural Network
Nowadays, Coronavirus disease (COVID-19) has become a global pandemic because
of its fast spread in various countries. To build an anti-epidemic barrier,
self-isolation is required for people who have been to any at-risk places or
have been in close contact with infected people. However, existing camera or
wearable device-based monitoring systems may present privacy leakage risks or
cause user inconvenience in some cases. In this paper, we propose a Wi-Fi-based
device-free self-quarantine monitoring system. Specifically, we exploit channel
state information (CSI) derived from Wi-Fi signals as human activity features.
We collect CSI data in a simulated self-quarantine scenario and present
BranchyGhostNet, a lightweight convolution neural network (CNN) with an early
exit prediction branch, for the efficient joint task of room occupancy
detection (ROD) and human activity recognition (HAR). The early exiting branch
is used for ROD, and the final one is used for HAR. Our experimental results
indicate that the proposed model can achieve an average accuracy of 98.19% for
classifying five different human activities. They also confirm that after
leveraging the early exit prediction mechanism, the inference latency for ROD
can be significantly reduced by 54.04% when compared with the final exiting
branch while guaranteeing the accuracy of ROD.
Jingtao Guo, Ivan Wang-Hei Ho
# CSI-Based Efficient Self-Quarantine Monitoring System Using Branchy Convolution Neural Network

###### Abstract

Nowadays, Coronavirus disease (COVID-19) has become a global pandemic because of its fast spread in various countries. To build an anti-epidemic barrier, self-isolation is required for people who have been to any at-risk places or have been in close contact with infected people. However, existing camera or wearable device-based monitoring systems may present privacy leakage risks or cause user inconvenience in some cases. In this paper, we propose a Wi-Fi-based device-free self-quarantine monitoring system. Specifically, we exploit channel state information (CSI) derived from Wi-Fi signals as human activity features. We collect CSI data in a simulated self-quarantine scenario and present BranchyGhostNet, a lightweight convolution neural network (CNN) with an early exit prediction branch, for the efficient joint task of room occupancy detection (ROD) and human activity recognition (HAR). The early exiting branch is used for ROD, and the final one is used for HAR. Our experimental results indicate that the proposed model can achieve an average accuracy of 98.19% for classifying five different human activities. They also confirm that after leveraging the early exit prediction mechanism, the inference latency for ROD can be significantly reduced by 54.04% when compared with the final exiting branch while guaranteeing the accuracy of ROD.

 Self-Quarantine Monitoring, Channel State Information (CSI), Branchy Convolutional Neural Network (CNN), Early Exit Prediction, Human Activity Recognition (HAR)

## I Introduction

In recent years, COVID-19 (an infectious disease caused by the SARS-CoV-2 virus) has become a global pandemic and caused a serious threat to our health [1]. Over one million cases have been reported in Hong Kong [2], causing a heavy burden on the public health system. According to the existing findings [3], when infected people cough, sneeze, speak, or breath, the virus spreads in little liquid particles from their mouth or nose, and on average, it takes five to six days from the time people are infected with the virus to the time they develop symptoms, but it can take up to 14 days. Therefore, self-quarantine is required for those who have been in close contact with infected people or to any at-risk places to prevent the virus from spreading around the community.

### _Related Works and Motivations_

_Strengths of Device-Free Wireless Sensing Based COVID-19 Monitoring System When Compared With Existing Systems:_ Currently, several COVID-19 monitoring and tracing systems are developed by various countries and regions to control the spread of the COVID-19 virus for protecting the health of their community. For example, the Malaysian government has developed a contact tracing application termed MySejahtera [4] to trace users who have stayed with infected people on the same premises via a QR code check-in scheme. However, this application is unsuitable for monitoring someone who is undertaking self-quarantine since it serves as proactively preventative measures to alert users if they have been in close contact with infected people. Hong Kong government proposed a self-quarantine monitoring scheme named StayHomeSafe [5]. This scheme comprises an application and a wristband with a QR code for scanning at a random time to prevent quarantine users from leaving their place during the quarantine period. [6] also presented a self-quarantine monitoring system that used GPS signals and a camera to locate and verify a quarantine user, respectively. After that, [7] introduced a monitoring system that can identify a quarantine user and periodically check the user's location and health status. However, camera-based monitoring systems usually require complex data pre-processing methods in dark scenarios. They also present privacy leakage risks. Monitoring systems with wearable devices may cause user inconvenience. Compared with the sensing technologies mentioned above, wireless sensing technology has great advantages in low-level privacy leakage, contactless operation, and well-functioning in low-light and non-line-of-sight (NLOS) environments [8].

_Existing CSI-Based HAR and ROD Systems:_ In the past decades, Wi-Fi CSI-based wireless sensing technology is gaining popularity as a result of the availability of different CSI tools like the Linux 802.11n CSI Tool [9] and Nexmon CSI [10]. In terms of these tools, several CSI-based wireless sensing systems have been proposed. For modeling the relationship between human activities and the dynamically changing signal features, machine learning (ML) technologies are applied in these systems. For example, [11] used a one-class support vector machine (SVM) and random forest (RF) algorithms for HAR and ROD. [12] also introduced a k-nearest neighbor (KNN) classifier for human identification. However, conventional ML approaches usually require hand-crafted feature extractors [13]. Hence, more researchers exploit deep learning (DL) algorithms for HAR and ROD. DL technologies can regard as an end-to-end learning approach where feature ex
traction, a time-consuming and knowledge-demanding process in traditional ML algorithms, is accomplished automatically and embedded implicitly in the network architecture [14]. For instance, [15] proposed a temporal Unet (TUNet) for sample-level classification of different human activities. [16] further leveraged the ResNet [17] architecture to design a one-dimensional ResNet (1D-ResNet) for the joint task of HAR and indoor localization. [18] also presented an attention-based bi-directional long short-term memory (ABLSTM) for passive HAR and showed satisfactory performance. After that, [19] combined the 1D-CNN and bi-directional LSTM (BiLSTM) architectures to present a deep convolutional LSTM (DeepConvLSTM) model and achieved 92% average accuracy for eleven activities. [20] exploited an efficient 2D-CNN named EfficientNet-B2 [21] for HAR using four action recognition datasets. [22] also leveraged 2D-CNN and transfer learning to conduct ROD. In [23], InceptionTime [24] and BiLSTM-based models are introduced to evaluate their performance for HAR. However, these DL benchmarks either only consider single-task learning or do not achieve a good balance between accuracy and latency.

### _Contributions_

In this paper, we propose a Wi-Fi-based self-quarantine monitoring system. Specifically, we utilize CSI extracted from Wi-Fi signals as human activity features. Since ROD is an easy task than HAR in a self-quarantine scenario, we introduce the early exit prediction mechanism to GhostNet [25] model to design a new DL model for the joint task of HAR and ROD. This mechanism can significantly reduce the inference time of the model for ROD without compromising the detection accuracy. The prediction result is sent to a cloud IoT platform for visualization and remote monitoring. Compared with other monitoring systems mentioned above, our proposed method has great advantages in low-level privacy leakage and contact-free monitoring. Real-world experiments have been conducted to verify the efficiency of the proposed model. The experimental results are compared with the other seven DL benchmarks presented in the literature. Overall, the main contributions of this study are three-fold:

* We present a Wi-Fi-based self-quarantine monitoring system to detect human activities and room occupancy where CSI data extracted from Wi-Fi signals are exploited as human activity features. We also introduce a demonstration leveraging the Raspberry Pi 4B, ThingsBoard, and Telegram platforms.
* To improve the efficiency for ROD, we then introduce BranchyGhostNet for the joint task of HAR and ROD in which the early exit prediction mechanism can significantly reduce the inference time of the model for ROD without compromising the detection accuracy.
* We conduct extensive experiments to evaluate our model. Our results indicate that the proposed BranchyGhostNet can achieve up to 13.22% performance boost for HAR compared with the other six common-used DL models and reduce the inference time for ROD by 54.04% compared with its final exiting branch.

The remaining part of the paper proceeds as follows: In Section II, we illustrate our proposed monitoring system and BranchyGhostNet. After that, we introduce the experimental setup for evaluating the proposed system in Section III. Section IV presents the experimental results. Finally, Section V concludes the paper.

## II The Proposed Self-Quarantine Monitoring System and BranchyGhostNet

### _Main Idea of the proposed system_

Our proposed monitoring system aims to detect quarantine user activities and prevent the user from leaving the quarantine place or being in close contact with another person. Fig. 1 demonstrates the overview of our system. We suppose a user is undertaking self-quarantine. The following three parts comprise our monitoring system. \((1)\) Train a lightweight model using the CSI data collected in the simulated self-quarantine scenario. \((2)\) The trained model is converted and deployed to the Raspberry Pi 4B for online testing. \((3)\) In the online testing stage, the prediction result is sent to a cloud IoT platform

Fig. 1: The overview of our proposed self-quarantine monitoring system.
for remote monitoring, and an alarm message is sent to the messenger if the room is empty or the user comes into contact with another person.

The main computational procedure in our proposed system comes from offline model training. We exploit a lightweight model named GhostNet [25] to design a new DL model named BranchyGhostNet for the joint task of HAR and ROD. This model is quite suitable for edge devices because of its low computational cost and inference latency. The learning goal for user \(\mathbf{p}\)'s model is represented as

\[\arg\min_{\mathbf{\Theta^{p}}}\mathcal{L}_{\mathbf{p}}=\sum_{i=1}^{n^{\mathbf{p}}}\mathcal{ C}\left(\mathbf{l}_{i\_r}^{\mathbf{p}},\mathbf{B}_{e}^{\mathbf{p}}\left(\mathbf{X}_{i}^{\mathbf{p}} \right)\right)+\sum_{i=1}^{n^{\mathbf{p}}}\mathcal{C}\left(\mathbf{l}_{i\_h}^{\mathbf{p}}, \mathbf{B}_{o}^{\mathbf{p}}\left(\mathbf{X}_{i}^{\mathbf{p}}\right)\right) \tag{1}\]

where \(\Theta^{\mathbf{p}}\) means the optimal parameters of all layers for user \(\mathbf{p}\)'s model, \(\mathcal{C}\left(\cdot,\cdot\right)\) denotes as the loss function for model training (e.g., cross-entropy loss function), \(\mathcal{L}_{\mathbf{p}}\) means the overall loss for model training. \(\mathbf{B}_{e}^{\mathbf{p}}\) and \(\mathbf{B}_{o}^{\mathbf{p}}\) represent the early exit and final exit prediction branch of \(\mathbf{p}\)'s model, respectively. \(\left\{\mathbf{X}_{i}^{\mathbf{p}},\ \mathbf{l}_{i\_r}^{\mathbf{p}},\ \mathbf{l}_{i\_h}^{\mathbf{p}}\right\}_{i=1}^{n^{ \mathbf{p}}}\) are samples and their corresponding true ROD and HAR labels from \(\mathbf{p}\)'s dataset with size \(\mathbf{n^{\mathbf{p}}}\).

### _Model Architecture_

A deeper structure is usually required for a DL model to achieve higher accuracy. However, the cost of added latency and energy usage becomes more prohibitive for real-time and energy-sensitive applications when the model continues to get deeper and larger. Since ROD is an easy task than HAR under the self-quarantine scenario and inspired by [26], we introduce the early exit prediction mechanism to the original GhostNet model to conduct the joint task of HAR and ROD while reducing the inference latency for ROD to improve the monitoring efficiency. This mechanism utilizes the early layer of a DL model to learn the hidden features for ROD, which indicates that the early exit prediction branch shares part of the layers with the final prediction branch and allows certain prediction results to exit from the model early. With this mechanism, our proposed BranchyGhostNet structure is presented by adding an exit branch after a certain layer position of the original GhostNet model as shown in Fig. 2. The BranchyGhostNet model comprises 97 convolution layers and two fully connected layers with only about 370 million multiply-accumulate operations (MACs). The main component of our model is the Ghost module, which mainly uses cheap linear operation to augment features and generate more feature maps after obtaining a few inherent channels by a regular convolution operation [25]. The Ghost bottleneck with stride=1 comprises two Ghost modules, and that with stride=2 further includes a depthwise convolution layer with stride=2 between the two Ghost modules. The squeeze-and-excitation module, which can utilize the correlation between feature maps, is also adopted in some Ghost bottlenecks.

## III Experiment Setup

### _Equipment and Data Collection Method_

Fig. 3 illustrates the communication between the devices for CSI data collection. The PC is used to send control messages

Fig. 3: CSI data collection method.

Fig. 2: The architecture of the proposed BranchyGhostNet.
to the AP for generating the wireless signals that contain CSI data, while a Raspberry Pi 4B serves as a data collector to extract CSI data. Ping packets are sent from the PC to the AP, and pong packets are sent back from the AP to the PC.

The Pi 4B in monitor mode was configured with Raspberry Pi OS (Buster/Linux 5.4.83) with the pi-5.4.51-plus branch of nexmom_cs1 installed. The following filter parameters were used for configuring nexmon: channel 36/80, Core 1, NSS mask 1. The Raspberry Pi 4B was paired to the AP. A computer was connected to the Pi 4B over the SSH protocol on a separate 2.4 GHz channel to control the data collection and reduce interference. The AP operates on channel 36 with an 80 MHz bandwidth. Note that the model of the AP is not restricted as long as it supports the 802.11ac protocol. Finally, the PC is connected to the 5 GHz channel of the AP to generate data flow from which the Pi 4B in monitor mode can capture CSI data. The PC is configured to send ping flood to the AP at a rate of 100 Hz.

Footnote 1: [https://github.com/zeroby0/nexmom_csi/tree/pi-5.4.51-plus](https://github.com/zeroby0/nexmom_csi/tree/pi-5.4.51-plus)

### _Environments and Datasets_

Fig. 4 shows the layout of an environment which was considered for CSI data collection. In this environment, we used the nexmon CSI patch to collect five human activities (sit, stand, walk, stand up and sit down) and three scenarios of room occupancy (nobody, one person, and two persons). The tcpdump command is used to render CSI data for producing a pcap file. An open-source framework named ciserad is used to interpret this file, which generates a 256 x 300 CSI amplitude matrix after computing the absolute values and the transpose operation. Note that 256 means the number of sub-carriers, and 300 represents the number of received data packets. Overall, datasets contain 10,000 CSI data for training and 2,300 CSI data for testing.

### _Data Preprocessing_

Since signal preprocessing can degrade the timeliness of a real-time system, only the amplitude response of CSI is utilized in this study. We minimize the signal preprocessing in our system. First, 8 Pilot sub-carriers and 14 Null sub-carriers (including Guard sub-carriers) are filtered away according to [27]. Then, we adopt the moving average method to eliminate short-term fluctuations of the signals and highlight their long-term trends. Finally, we save them as CSI radio images with 234 x 300 resolution to utilize the spatial and temporal correlations between adjacent channels and samples [28].

### _Model Training and Testing Configuration_

Our model is implemented by Pytorch and trained using a computer configured with Nvidia RTX 3090 GPU. Before training the model, we use some general data argumentation methods (RandomRsizedCrop, RandomHorizontalFlip, and ColorJitter) when loading our training data. The AdamW optimizer is used to optimize model parameters during the training phase. CosineAnnealingLR scheduler is also applied to attenuate the learning rate via the cosine function, and a cross-entropy loss function is adopted for computing the training loss. The training epoch, training batch size, and testing batch size are set to 400, 50, and one, respectively. For the early exit prediction criterion, we set that the prediction result will output early from the model if it is equal to zero or two. In our experiments, four criteria, i.e., accuracy, precision, recall, and f1-score [29], are used to evaluate the performance of the BranchyGhostNet. We also assess its inference latency in GPU and compare it with the other seven DL benchmarks.

## IV Experiment Evaluation

In this section, we use CSI data collected by the Raspberry Pi 4B platform via Wi-Fi channels from a single router as human activity features to validate the performance of our model and compare it with seven other common-used DL benchmarks. We also utilize this model to build a Wi-Fi-based self-quarantine monitoring system.

### _The performance of BranchyGhostNet_

Table I and II show the accuracy, precision, recall, f1-score and mean GPU latency of eight different DL models. As can be seen from the tables below, EfficientNet-B2 presents the best performance among eight DL models for both ROD and HAR. However, it provides the largest latency, which may not be suitable for resource-constrained devices and latency-sensitive tasks. Compared with EfficientNet-B2, our model only has a 0.58% and 0.23% accuracy drop with 73.82% and 43.03% latency reduction for ROD and HAR, respectively. In comparison with the mean latency of BranchyGhostNet shown in Table II, that presented in Table I indicates that after introducing the early exit prediction mechanism for ROD, an about two times computation speed-up ratio can be achieved without comprising the accuracy. From the results in Table I and II, we can also observe that most of the LSTM-based models have worse performance than CNN-based models, which implies a strong feature extraction capability of CNN for CSI-based HAR and ROD.

The confusion matrices illustrating ROD and HAR accuracy of our proposed model are presented in Fig. 5 and 6 respectively. From the two confusion matrices shown below, we can see that higher accuracies are obtained for ROD. That may be because the number of clas

Fig. 4: The layout of simulated self-quarantine environment.
that in ROD, resulting in more powerful shared layers for the model and strong feature extraction capability for ROD. It can be seen from the confusion matrix shown in Figure 6 that all activities except the "walk" activity work well, while the "walk" activity shows a slight drop with lower than 90% accuracy. This activity will cause more fluctuation for the received signals, which may produce more noisy data patterns for the model.

### _Demonstration of the proposed self-quarantine monitoring system_

By exploiting the proposed BranchyGhostNet, we present a Wi-Fi CSI-based self-quarantine monitoring system. Fig. 7 shows the detection result visualization and alarm message receiving in ThingsBoard (cloud internet of things (IoT) platform) and Telegram (messenger) respectively to remotely monitor. Since the Raspberry Pi 4B only has a CPU, we further converted the model from the Pytorch framework into the open neural network exchange (ONNX) framework to reduce the inference latency in the CPU.

## V Conclusion and Future Work

This paper proposed a CSI-based device-free system for monitoring a user during the quarantine period while preserving the user's privacy. To improve the efficiency of ROD, we introduced the early exit prediction mechanism to an original GhostNet to design a BranchyGhostNet model for the joint task of HAR and ROD. We have also developed a graphical user interface (GUI) to visualize the prediction result and used a messenger to receive the warnings. We have evaluated

Fig. 5: Confusion matrix (%) of BranchyGhostNet for ROD.

Fig. 6: Confusion matrix (%) of BranchyGhostNet for HAR.
the performance of our proposed model. The experimental results showed that our model can achieve the best balance between latency and accuracy (i.e., provide low latency while guaranteeing high accuracy) compared with the other seven common-used DL benchmarks. After introducing the early exit prediction mechanism for ROD in BranchyGhostNet, its latency can be reduced by 54.04% when compared with the final exiting branch.

A limitation of this study is that we currently only collect predefined activity data under an ideal scenario to train and test the model. For future research, how to handle unseen activities without the extra effort of data collection and model retraining can be investigated. We will also explore how to leverage unlabeled CSI data for model training to reduce the need for data labeling.

## VI Acknowledgment

This work was supported in part by the Key-Area Research and Development Program of Guangdong Province (2020B 090928001); and by The Hong Kong Polytechnic University (Project No. 4-ZZMU, Q-CDAS).
