DFC: Device-free human counting through WiFi fine-grained subcarrier information

Funding information ITRC (Information Technology Research Center) support program, Grant/Award Number: IITP2020-2017-0-01633 Abstract A device-free human counting (DFC) algorithm that uses fine-grained subcarrier information from WiFi devices, called channel state information (CSI), to count the number of people in indoor environments is proposed. The DFC algorithm extracts the features of average attenuation and variation of CSI amplitudes caused by human motions, and puts the features into a training process to improve the counting accuracy. Through a bootstrapping process, the DFC can estimate the number of people standing in the middle of a WiFi link by constructing a probability model with the CSI signals at a receiver side. With this human counting capability, the DFC can support the efficient monitoring and automatic control of electrical devices (e.g. air conditioner, heater, bulb, and beam projector) indoors. Through a real implementation and experiments, it is shown that the DFC algorithm outperforms the state-of-the-art DFC algorithm based on RSSI in indoor environments with human mobility. For a dynamic-target case in a meeting room, for example, DFC can predict the number of people in an indoor space with an accuracy about 98% at best.


INTRODUCTION
Various research for smart buildings is being conducted all over the world. Especially, human detection and counting is one of the main purposes in management systems for smart buildings. Most of these management systems require additional devices and sensors (e.g. ultrasonic, infrared, and camera) to achieve a high accuracy for human counting, which can raise the construction costs of buildings. In addition, the smart buildings can have different characteristics by their functions and locations from either a smart campus or smart farm. To apply the management systems to these buildings, it is necessary to analyse the characteristics first for a better performance. For example, a campus building can have many lecture rooms, laboratories, and administration offices, which are mainly used by students and researchers. Most of the lecture rooms are dynamically scheduled to have classes every semester. With an estimated occupancy in a room, a management system can efficiently control facilities (e.g. air conditioners and light bulbs) to provide a better condition for people who are working and studying in the room and save more energy as well. Human counting technologies for smart buildings become one of the core functions to provide such a kind of efficient management systems [1][2][3]. Currently, infrared sensors-based systems are widely used to detect human activity in indoor areas. As mentioned before, these systems not only increase the construction costs, but also may not detect humans correctly when persons stay still for a certain time, which often happens when the persons are working on desktops. Other research using cameras and ultra wideband (UWB) bio-radar [2,4] for human counting or sensing have also been studied, but in these studies additional devices are required to run the systems, and privacy concerns can be raised, too. Alternatively, a system can obtain a good performance to count the number of people by received signal strength indicator (RSSI) data from a communication link of a WiFi transmitter and receiver [1]. However, RSSI amplitudes can fluctuate severely when obstacles block a line-of-sight (LoS) wireless link.
Systems using fine-grained subcarrier information from wireless links can localise and detect human motions [5]. These systems can provide useful schemes for indoor navigation, localisation and motion detecting services. Particularly, the research on channel state information (CSI) for human activity detection and localisation [6][7][8][9][10] has been spotlighted globally. The raw CSI signals collected at the physical layer include noises caused by signal scattering, fading, and reflections when a WiFi signal propagates from a transmitter to a receiver. The CSI signals carry much richer state information of the current channel for data transmissions, which are critical for many multi-channel wireless communication systems such as WiFi to achieve a reliable and high data rate [11][12][13]. Therefore, CSI signals can provide more information about the environments where people are existing and moving, making it more suitable for human counting in comparison with RSSI data.
Here, we propose a device-free human counting (DFC) algorithm based on the features of CSI data from WiFi devices in an indoor environment. The DFC algorithm has two parts. The first part is a feature extraction step based on a supervised learning technique. In this step, we extract features from CSI data by observing influences of humans in a WiFi link, and compute a two-dimensional probability distribution with a labelled data set. The second part is a test step with an unlabelled data set. In the test step, we extract features in the same way to the previous step, and compare the features of the unlabelled data set with those of labelled data set using a probability distribution. Finally, we estimate the number of people based on a structured probabilistic modelling. For experiments on the DFC algorithm, we use commercial off-the-shelf (COTS) devices such as Intel's network interface card (NIC).
This study gave the following contributions: • An algorithm for DFC: This study proposes an algorithm to estimate the number of people in a wireless link based on fine-grained subcarrier information. The modelling of finegrained subcarrier information is performed in a link between two WiFi devices (see Section 4). • The characterisation of features from raw CSI signals: By extracting features from fine-grained subcarrier information from common WiFi devices, it is possible to count the number of people. These features are an average attenuation and an average variation of CSI amplitudes, which are affected by the number of people in the communication link (see Sections 4.2 and 4.3). • The automatic control for electronic and electrical appliances: By extending the DFC algorithm, the existence of people in a room can be determined; and it is possible to save power consumption by controlling the electric power of unnecessary electrical appliances (see Section 3.1).
The remaining of this paper is structured as follows. Section 2 summarises and analyses the related work for human detecting, localisation, and counting. Section 3 shows the problem formulation of the DFC algorithm. Section 4 describes the design of the DFC algorithm. Section 5 explains the testbed along with hardware and software configuration. Section 6 evaluates the performance and discusses the issues of the DFC algorithm. Section 7 concludes this paper along with future work.

RELATED WORK
Most of the research related to human counting or sensing is focused on the localisation or motion detection [9] of people or user devices [6][7][8]10]. Also, other human counting research analyses signal in the WiFi communication link [1] and needs additional devices such as camera or radar [2,4]. Depatla et al. proposed an approach to estimate room occupancy by WiFi power [1]. In their study, they estimated the number of people between a WiFi link with variation of RSSI signal. They computed the number of people by comparing an ideal probability distribution and a probability distribution of the analysis of change to RSSI signal [1,14]. Similarly, the proposed DFC is also based on a probability distribution by the analysis of WiFi signal from a WiFi receiver. However, our analysis is based on the fine-grained subcarrier information, which can achieve a high counting accuracy for both dynamic and static targets.
Ma et al. presented a human counting system based on cameras using extracted features [2]. They obtained a high counting accuracy for the number of people by extracting the features using a machine learning technique, called multiple instance support vector machine (SVM). Therefore, based on the computer vision, this research could determine the number of pedestrians faster with a high accuracy. However, to implement their scheme, additional devices (e.g. cameras) are needed, and quality and performance of the devices also affect the system performance.
Lv et al. proposed a human sensing scheme via a UWB bioradar having multiple antennas [4]. Their system can count multiple targets (e.g. humans) through a wall or door. However, their scheme also needed additional devices for human sensing. The DFC can achieve the same purpose, but only uses general WiFi devices with a COTS NIC.
Wang et al. proposed a low human-effort, device-free localisation with fine-grained subcarrier information (called LiFS) [7]. LiFS is a model-based device-free localisation system. It can localise one or two targets with the analysis of CSI signal from many WiFi devices. The LiFS has four modules. The first module is a CSI collection module. Before a target moves into the monitoring area, this module collects a set of CSI measurements (i.e. baseline data) from all the links. The second module is a rough location estimation module, which detects whether or not the target is located in the first Fresnel zone (FFZ) [15] of a specific link by comparing the measured CSI values with the pre-obtained baseline CSI values. The third module is a CSI pre-processing module. If the target is located in FFZ of a specific link, this module pre-processes the raw CSI of this link with their scheme [7]; otherwise, LiFS uses the scheme to find the effective CSI using frequency diversity proposed in [6] for pre-processing. The fourth module is a target localisation module. This module searches for the location of the target using a power fading model (PFM) in each link with the preprocessed signal. Thus, this scheme introduced how to localise a target using fine-grained subcarrier information. However, it has a different goal from our DFC, which focuses on the counting of the people rather than the localisation of multiple targets (e.g. one or two targets). Our proposed DFC borrows some of the techniques proposed by the LiFS to pre-process the CSI signal.
Wu et al. proposed a fine-grained indoor localisation scheme (called FILA) [6]. FILA is a new cross-layer method based on orthogonal frequency division multiplexing (OFDM) for indoor localisation using a wireless local area network (WLAN) [11]. To obtain fast and accurate indoor location recognition, signal processing techniques were utilised in the time and frequency domains to mitigate a multi-path effect, and also a fast training algorithm was proposed for the calibration of a refined indoor propagation model to represent the relationship between the CSI value and distance from an access point (AP). Modification at the transmitting end is not necessary, and only one new component for CSI processing is introduced for positioning in the receiving end (i.e. RX-target mobile device). The pre-requisite for the FILA localisation system is that it must be able to export the fine-grained subcarrier values after the normal demodulation process.
Ibrahim et al. introduced a deep learning system (called CrossCount) for DFC by WiFi RSSI information [3]. Cross-Count counts a number of people by mapping a series of link inter-blockage patterns in a recurrent neural network (RNN). The system has three stages: (i) training data preparation, (ii) long short-term memory (LSTM) RNN training module, (iii) device-free online counting module. In particular, CrossCount reduced labor-intensive work for collecting training data by a new technique that only needs to collect one-person link blockage data and produces other training data for multi-person counting. During the online counting stage, the RSSI information from a WiFi link is streamed into the trained LSTM RNN to estimate person count in the area of interest.
Xue et al. suggested a multi-view deep learning framework (called DeepMV) to recognise human activities by integrating a variety of information such as WiFi signal, acoustic wave, and visible light [16]. DeepMV employs a convolutional neural network (CNN) module to process different features of the heterogeneous information. To combine the features, a hierarchically weighted combination module is proposed so that the quality of the information can be evaluated and the extracted features are combined by weights. In addition, an adversarial network is designed to separate the environment information and the target features. DeepMV uses different information sources to conduct human activity recognition, which can increase the system performance. However, the devices for collecting this information can increase deployment cost, and device failures may undermine the system's accuracy.
Huang et al. designed a device-free human detection and localisation system based on radio-frequency identification (RFID) devices [17]. The system uses RFID antennas to read RSSI information reflected by many RFID tags sticking to walls in a room to detect and localise a person in the room who may block and reflect some signals between the antennas and tags. Alternatively, Münch et al. introduced an approach that wields Bluetooth low-energy (BLE) beacons to passively count person numbers in a room [18]. They also used the RSSI information collected via BLE beacons that are affected by a human body, which is a similar concept to the RFID system.
In summary, the reviewed approaches for counting the number of people require additional devices, which can increase the deployment cost. And more devices can also reduce the system's reliability, which can influence the counting performance. The approaches using CSI data were focused on the localisation of either targets or devices. Different from those approaches, our DFC focuses on the counting of people by a probability model in analysing the features of CSI signals when humans are in the area of interest. The performance of the DFC algorithm is compared with that of a baseline scheme using RSSI [1], as shown in Section 6.

PROBLEM FORMULATION
In this section, we describe the formulation of our DFC system. The DFC focuses on estimating the number of people, which will help to minimise time and human effort in controlling electronic and electrical devices. Figure 1 shows the concept of the DFC. With this system, it is possible to monitor that only a few people are working on a meeting area of a top floor. The rest of the area is empty. In this case, the unused electrical devices must be turned off to save energy. On the other hand, on the lowest floor, that is, working area, many people are actively working. Therefore, air conditioners, monitors, and light bulbs should provide efficient environment to the people. The DFC algorithm can determine how many people are in an office or room, so the power and operation modes of unused electronic devices can be controlled for energy efficiency.

Assumptions
• The DFC focuses on counting the number of people in a LoS link between a COTS WiFi transmitter and receiver. A non-LoS scenario that cannot make a significant change on the CSI signal to distinguish the number of targets is not considered in this paper. As future work, the non-LoS scenario will be considered for human counting. • To calculate the number of people, the DFC inference is based on a probability distribution. The probability distribution can be calculated using labelled features extracted from experiments with multiple targets.

FIGURE 1
The concept of DFC system

Scenario
The description of an experiment scenario consists of 7 steps. As shown in Figure 2, the procedure is as follows: • We collect the fine-grained subcarrier data for feature extraction. In this process, the number of people in the link is known. The currently collected data set of CSI includes the information of power reduction and scattering. The raw CSI includes the noises of the obstacles and environments. • The raw CSI is pre-processed to get features. This process is explained in detail in Section 4.2. • The features (i.e. average attenuation and variation of CSI) are extracted. The pre-processed CSI has the information about influence by obstacles. Any other signals that are regarded as not affected by targets are discarded in data processing step. • Through bootstrapping, a group of data is obtained to estimate the probability distribution of the population. At this step, each probability distribution is calculated for each case when 1, 2, 3, or N persons exist in the link. • The data set of CSI is collected as input from the link in order to estimate how many people exist at a testing phase.
• The raw CSI data are pre-processed for counting the number of people by the collected CSI without labelling the input data. • Comparison of the extracted and unlabelled features as input data is performed with the previously computed probability distributions, and then a probabilistic deduction is performed to figure out how many people are present. This estimation process is explained in detail in Section 4.5.

THE DESIGN OF DFC SYSTEM
The raw fine-grained subcarrier has many noises such as fading, reflection, and scattering. To find the effect of obstacles, we use a mathematical theory, which is called Fresnel zone [15]. This is a zone for analysing the effect of obstacles in a wireless link. When the obstacles are located in a LoS path on a Fresnel zone, the signal is affected by obstacles. Therefore, when a target is located in a Fresnel zone between a WiFi transmitter and receiver, the collected signal indicates that some change is caused by the target. Also, it is challenging to select the effective subcarrier indexes from raw fine-grained subcarrier information. If the signal is attenuated, it is hard to identify what The procedure of DFC system change happened to the original signal because such attenuation is generated by either obstacles or noises. To solve this problem, a threshold is adapted to select the subcarriers in the transition portion, depending on whether the power reduction is enough or not. This study borrowed some of the formulas proposed in the LiFS [7] and FILA [6] to filter out the effective subcarrier indexes. Additionally, we converted them to fit the DFC algorithm. Finally, the DFC in a scenario with multi-targets is performed. Figure 3 shows the system configuration of the DFC. The DFC for counting multi-targets consists of two steps, that is, a training step and a test step. In the first step, fine-grained subcarriers are measured. The signal is collected while the number of people existing is noted. Then, the features (i.e. attenuation and variation of CSI amplitude) are extracted through the feature extraction substep for a two-dimensional probability distribution using two features. In the second step, the collected fine-grained subcarriers are measured without knowing how many people exist. At this time, we can estimate the number of people to compare the probability distribution from the first step with the same features extracted from the second step. The detailed description of our feature extraction procedure is given in Sections 4.2, 4.3 and 4.4. Also, the detailed description of the test step is given in Section 4.5. The next subsections will explain the key concept and procedure of the two steps (i.e. Feature Extraction and Test Step), respectively, as shown in

Fresnel zone
The Fresnel zone is an area for analysing the effect of obstacles (i.e. the occurrence of diffraction or interference) in the visible range. The following equation shows the range of FFZ: where d i j is the distance between a transmitter (i.e. i) and receiver (i.e. j ), d it is the distance between a target (i.e. t ) and transmitter, d jt is the distance between a target and receiver, and is the wavelength of the wireless signal. Especially, a radio signal is affected by either diffraction or reflection in a wireless communication link. The FFZ is a region with a peak point of the field's strength. If there is no obstacle in about 80% of the FFZ, the loss is assumed to be equal to loss in a free space. Consequently, if an additional diffraction loss occurs in the FFZ, it is due to obstacles. It is possible to calculate the amount of power loss except the additional diffraction in order to determine the presence of obstacles. Also, if either an obstacle or a target is located in the FFZ, it is possible to determine either the location of a target or the number of targets using the PFM, which was introduced by [7,15]. With this mathematical theory, it is possible to show the effect of obstacles in the FFZ. Therefore, we adopt the threshold for the attenuation of CSI for the preprocessing scheme.

4.2
Pre-processing scheme for the first feature extraction This subsection entails a pre-processing scheme for collecting raw CSI and extracting the first feature [19,20]. Raw CSI has much information that includes various types of noises. But the raw CSI cannot be used directly for either localisation or counting because of noises due to scattering as well as power reduction. To find the effective subcarrier's indexes, we use a filtering scheme proposed by [2] for pre-processing.
If obstacles (or people) are located in the middle of a wireless communication link, CSI amplitude is reduced because of the diffraction and absorption caused by them. However, CSI attenuation occurs due to not only obstacles in FFZ, but also other factors. Therefore, we cannot make a decision that CSI attenuation occurred due to only obstacles in FFZ. We use threshold eff to distinguish CSI changes by obstacles in FFZ from others [2]. eff is the average standard deviation of the CSI values measured when there are no obstacles in the communication link: where the k is the standard deviation of the kth subcarrier's amplitude [6] in free space. f 0 is the central frequency and f k is the signal frequency of the kth subcarrier. The fact that CSI attenuation is greater than eff suggests that there are obstacles in the FFZ. By frequency-selective fading [2], the CSI values of all subcarriers do not decrease in the same way even if there are obstacles in the FFZ. The CSI values of only some subcarriers are reduced, and these subcarriers are called effective subcarriers. The CSI average attenuation of the effective subcarriers is as follows: Let F = {F 1 , F 2 , … , F K } be the amplitudes of the fine-grained subcarriers when a target is located on a wireless link, and O = {O 1 , O 2 , … , O K } be the amplitudes of the fine-grained subcarriers when the target is not located on the link. Therefore, a set of effective subcarriers can be denoted as follows: The effective CSI is denoted as ΔCSI eff when a target is placed on a link, which can be computed using Equation (3) [7]. Through this pre-processing scheme, we can determine the effective subcarrier indexes, which are affected by obstacles, and the corresponding CSI attenuation. Definition 4.1. We define the weighted average of the attenuation of CSI amplitude of the effective subcarriers as the first feature X 1 . This value indicates how much the CSI amplitude has been reduced by obstacles such as people. The first feature is called CSI average attenuation.
As shown in the Figure 4a, the first feature (X 1, that is, CSI average attenuation) can be computed from the attenuation of pre-processed CSI through the Equation (3). The two violet lines show that some amplitude of subcarriers (i.e. indexes 4 and 26) are attenuated by targets and their attenuation are bigger than eff .

Procedure for second feature extraction
This subsection entails a procedure of the second feature extraction of the DFC. We estimate N people by a probability-based approach. It is difficult to estimate the number of people in a communication link with only one feature, that is, CSI average attenuation. Thus, we define the second feature that is affected by the obstacles in a communication link. Diffraction and reflection occur more in cases with obstacles in the communication link than in cases without obstacles. The more diffraction and reflection occur, the more the CSI value will change.

Definition 4.2.
We define the weighted average of the top n standard deviations of CSI amplitude as the second feature X 2 . This value indicates how much the CSI amplitude changed by obstacles such as people. The second feature is called CSI average variation. The second feature (X 2 , that is, CSI average variation) is defined as the weighted average of top n variations as follows: where the K n is a set of top n variations from the collected subcarriers, and the (n) is nth largest variation. Figure 4b shows the amplitude's variation of the 13th subcarrier in the collected CSI.

Verification of features
To verify the two features in Sections 4.2 and 4.3, an experiment was conducted in an indoor environment. In the test, the distance between a transmitter and a receiver was set to 10 m and their heights were set to 60 cm from the floor. The collec-  Figure 5a shows the experiment configuration in the indoor environment.

1) Result of feature extraction experiment
: Through the experiment, we establish each feature. Figure 5b shows a scatter plot of the features with 9 people in a communication link in an indoor meeting room. The x-axis is the first feature (i.e. CSI attenuation (X 1 )), which can be obtained from Section 4.2. In other words, it shows the average attenuation of a CSI subcarrier that is bigger than eff . The y-axis is the second feature (i.e. CSI variation (X 2 )), which can be obtained from Section 4.3. In other words, it shows the weighted average of the top n standard deviations of CSI amplitude.
The first feature and the second feature increase according to the number of people. The change of features is represented in Table 1, which indicates that our feature extraction algorithm can find effective characteristics about raw CSI.

FIGURE 6
Test step and probability model 2) Feature set construction : With these features, we process bootstrapping to find the characteristics of a population. Bootstrapping is a method that allows duplication to randomly make a sample set from the raw data set. At this point, it can be used to determine the probability distribution of a population even if the measured samples are insufficient and even when the distribution of the collected data sets is not clear. That is, it is possible to make multiple data sets by the shuffling of samples for calculating a probability distribution of the population. To figure out the bootstrapped data set, data sets (i.e. raw collected signal of N 1 , N 2 , … N 8 , N 9 ) are generated by the bootstrapping 300 times. As a result, a feature set for a two-dimensional probability model can be made to find the number of people with test data. So far, the extraction algorithm for the features (i.e. X 1 and X 2 ) in this study has been explained. With these features, we will be able to estimate the number of people in the link using the following test step.

4.5
Test step for human counting Figure 6a shows the procedure of the test step and our probability model in DFC algorithm. To determine the number of people in the link, we measured the CSI signal in a link with the knowledge of the existing people. Also, a probability model for the number of people based on statistics was created. This model is designed as a Gaussian distribution by using the extracted parameters (i.e. X 1 and X 2 ) through the feature extraction procedure. The input data x 1 , x 2 , … , x n are the collected raw CSI signal of each link with N people. These input data are changed with the number of people in the link between a WiFi transmitter and receiver. As the number of the located people increases, the raw CSI signal is changed dynamically by fading and scattering. Based on this characteristic, we can estimate the number of people to each link (i.e. F 1 , F 2 , … , F n ). Therefore, we will be able to estimate the total number of people in an indoor environment by summing up the number of people measured in each link. Note that we leave the consideration of double counting as future work, where the coverage of links is overlapped, leading to double counting [21]. Probability model: This study's probability model is as shown in Figure 6b. First of all, x i is the input data, which is a row vector of features x 1 and x 2 that are CSI average attenuation (X 1 ) and CSI average variation (X 2 ), respectively. The probability that n people exist in the ith link given input data x i is expressed as follows: where n represents the event that n people exist in a link.
To find a probability that n people exist in the ith link given input data x i , the P ( n |x i ) in Equation (7) needs to be calculated. However, the distribution of P ( n ) cannot be determined because the number of people there is unknown. Therefore, it is assumed that the distribution of P ( n ) is uniform. Also, when comparing the probability of each person, the probability P (x i ) is the same. Therefore, only P (x i | n ) in (7) needs to be calculated. To process the maximum probability of N people, a manipulation is done using statistics information based on features, which are obtained by Sections 4.2 and 4.3. The probability P (x i | n ) can be expressed using a Gaussian distribution [22] as follows: where Σ n is the covariance matrix of the average attenuation and average variation of CSI amplitude, and n is the mean vector of the average attenuation and average variation of CSI when n people exist in the link for calculating a two-dimensional Gaussian distribution [22]. As a result, such a two-dimensional Gaussian distribution is obtained through Equation (8) for calculating the expected maximum probability about input data x i in order to estimate how many people exist in the link from Equation (7). In addition, the DFC algorithm can support crowd detection with multiple levels such as low, moderate, and high presence of people. For example, in Figure 5b, we can classify three levels System configuration such as low density (1-3 people), moderate density (5-7 people), and high density (9 people) by estimating the human number with our DFC algorithm. Note that our proposed DFC uses real-world CSI data to train a Gaussian distribution model with two extracted features of CSI signals. The real-world CSI data may include noises caused by environments and interferences caused by other sources (e.g. WiFi APs and microwave ovens). Even though raw CSI signals may include noises and interferences, the features extracted during the training step in our DFC system are based on dominant, effective CSI signals, which mitigate the impact of those noises and interferences. In Section 6.3, it is shown how much interference sources (i.e. WiFi APs with the same WiFi channel with our DFC system) affect the performance of our DFC system. So far, we have explained our system design for human counting. The remaining sections will describe the system configuration and performance evaluation.

SYSTEM CONFIGURATION
This section describes the software and hardware configuration for experiments of the DFC algorithm. For the experiments, we prepared two laptops as a WiFi transmitter and receiver, respectively. Also, we set up a desktop PC to analyse the collected raw CSI signal.

Hardware configuration
The DFC algorithm is implemented based on the COTS Intel's WiFi Link 5300 NICs. The laptop model of the transmitter is LG ZD360 installed with the 'hostapd' tool for configuring a software-based AP [23]. To receive CSI signals from the transmitter, another laptop is used as a receiver with the same NIC. The receiver laptop is installed with the 'Linux CSI Tool' to collect CSI from the transmission link [24]. The transmit-ter and receiver are equipped with 2.4 GHz omnidirectional, 5 dBi dipole antennas. To analyse CSI and perform the DFC algorithm, a desktop PC with a 3.4 GHz CPU (Model: Intel i7-3770) and 16 GB of memory was used. Figure 7 shows the hardware configuration of the transmitter laptop and the mounted NIC, respectively. Figure 7a shows a transmitter laptop with three antennas for wireless communications. The red box in Figure 7b shows the mounted NIC on the main board of the transmitter laptop. Note that laptops with a pluggable Mini PCIe slot are needed to mount the NIC. Recent laptop models do not supports the slots to accommodate the NIC. If a testing laptop dose not have such a kind of slots, it can use a Mini PCIe to USB adapter to run experiments.

Experiment configuration
To verify the DFC algorithm, we conducted experiments in a typical meeting room and cafeteria at Sungkyunkwan University in Suwon, South Korea, as shown in Figure 8. For the meeting environment, a meeting room with size 1050 × 840 cm, as shown in Figure 8a, is used and a long table is located in the center of the room along with a number of chairs. Both a WiFi transmitter and receiver were put at a height over 60 cm from the floor. Two experiment scenarios, such as a static-target scenario and a dynamic-target scenario, were considered in the meeting room. The experiment was conducted with up to 10 people standing between the transmitter and receiver. The meeting room case was experimented from 1 to 5 PM on a sunny day.
For the cafeteria case, as shown in Figure 8b, the experiment was conducted in a public environment. People were sitting and talking in the selected cafeteria. Also, there were 7 tables and 10 chairs, and the experiment was conducted from 1 to 3 PM on a cloudy day. Since there were 3 or 4 people sitting between the LoS range of the two antennas, the ground truth number of people was 3. The height of the transmitter and receiver were 40 cm over the floor. The length of the communication link was 450 cm. The reason for the shorter height of laptops than that in the meeting room case was that most of the people were sitting on chairs around tables. The detailed impact of targets' heights is explained in Section 6.4. Note that there were many deployed COTS WiFi APs in the building for our experiments, which could affect experiment results. Each experiment was performed by different conditions over 2 days.
For the performance evaluation, we developed a baseline scheme using RSSI in [1], which is called 'RSSI' in this study. For a fair comparison, we evaluated the proposed DFC and the RSSI scheme on the same condition. The signal collection frequency was five times per second for 5 min.

PERFORMANCE EVALUATION
We compare the DFC algorithm with the RSSI-based human counting algorithm [1]. Also, tests were carried out by varying the number of people standing in the wireless communication link. Estimation error is defined as the difference between our estimation and the ground truth for the number of people. The results of the estimation of the number of people over time are shown in Figures 9 and 11a. Cumulative distribution functions (CDFs) of an estimation error are shown in Figures 10 and 11b.

Meeting room case
The testing was performed in a meeting room for statistical analysis with both dynamic and static cases. Note that in Figure 9, the estimation frequency is from 20 to 23 s during the measurement of 240 s, and an error bar for this estimation frequency is constructed with 95% confidence interval. This variable frequency is because that the CSI data collection is performed until the expected number of samples are collected. Thus, there are results about 240 s rather than 250 s.

1) Estimation result of static target(s)
: Figure 9a shows the result of the estimation of the DFC algorithm for 1, 4, and 7 people as static target(s) where each point in each line is the mean estimation result. According to the Figure 9a, the static-target case has relatively unstable and less accurate results. For example, in N = 7 case, the average of the estimation result is 3.33 and the deviation of the estimation result is 0.4.

2) Estimation result of dynamic target(s)
: Figure 9b shows the result of the estimation by the DFC algorithm for 1, 4, and 7 people as dynamic target(s). The result of a dynamic-target scenario is better than that of a static-target scenario. The more dynamic targets in FFZ exist, the more impact they have on CSI. That is, the more dynamic targets exist there, the more diffraction and reflection occur. Especially, the result of estimation with 4 and 7 people is almost accurate. For example, in N = 7 case, the average of estimation result was 6.91 and the deviation of the estimation result is 0.46.

3) Estimation error of static target(s)
: This estimation error includes the error of the number of people in the communication link between WiFi devices, as described in Section 5.1. Figure 10 shows the CDFs about DFC and RSSI algorithms in the same meeting room. Figure 10a represents the CDF of a static-target(s) experiment using both algorithms. As shown in this figure, the probability that the estimation error of the DFC algorithm is at most 2 is 57% in the static-target(s) scenario. Also, the probability that the estimation error of the DFC algorithm is at most 4 is 85%. The RSSI algorithm shows the probability that the estimation error is at most 2 is 59%, and the probability that the estimation error is at most 4 is 73%. Note that the horizontal axis in Figure 10a is limited to 4 for estimation error (i.e. the erroneous human number at human counting) because 4 is enough to show that the CDF curve of DFC is above that of RSSI. Thus, the DFC algorithm shows a better performance than the RSSI algorithm in the static-target case.  Figure 10b represents the CDF of the dynamic-target experiment using both algorithms. As shown in this figure, the probability that the estimation error of the DFC algorithm is at most 2 is 79% in the dynamic-target scenario. Also, the probability that the estimation error of the DFC algorithm is at most 4 is 94%. By contrast, the RSSI algorithm shows the probability that the estimation error is at most 2 is 70% and the probability that the estimation error is at most 4 is 79%. Note that the horizontal axis in Figure 10b is also limited to 4 for estimation error (i.e. the erroneous human number at human counting) by the same reason described in the previous subsection. Thus, it can be seen that DFC outperforms RSSI as the number of moving people (especially in the dynamic-target scenario) increases.

Cafeteria case
To get a more reliable human counting result, the cafeteria case was also tested. Section 5.2 explained the detailed description of a cafeteria experiment environment. Figure 11 shows the experiment result in the cafeteria over time. Note that in Figure 11a Figure 11b shows the estimation error CDFs of DFC and RSSI. As shown in this figure, DFC has an estimation error of 2 people with 86% probability. On the other hand, RSSI has an estimation error of 2 people with 39% probability. Therefore, DFC can provide a higher accuracy than RSSI in an indoor cafeteria environment.
Overall, experiment results have shown that DFC can achieve a higher accuracy in indoor environments such as a meeting room and cafeteria.

Impact of interference
This subsection investigates the impact of the interference of WiFi signals, which is caused by interference sources, on the FIGURE 12 Impact of interference links DFC algorithm. For this investigation, we conducted an experiment with up to five interference links (caused by WiFi APs with the same WiFi channel with our DFC system) in the meeting room. The five interference links are generated by five WiFi links that are produced by five station-AP pairs. We configured five Raspberry Pi 4 boards as five APs that use the same channel with the WiFi link for CSI data collection. The five APs are placed beside the CSI data receiver, and the five stations are located near the transmitter. That is, the five interference links are parallel to the CSI data collection link for our DFC system. During the experiment, one station associated with one of the five APs can produce one interference link by continuously pinging its connected AP. The interval of pinging is 0.5 s. We put five people walking back and forth perpendicularly to the WiFi links. Figure 12 shows the estimated number of persons with the different number of interference links (denoted by I ). When no interference link exists (i.e. I = 0), we obtained the best performance relatively. As the number of interference links increases, the estimation accuracy of our DFC system decreases. However, when three interference links exist, the estimated person number is very close to the case without any interference source. Thus, based on Figure 12, it can be concluded that one impact of the interference links is that the estimation accuracy is reduced, but due to the reflection and diffraction of the interference signals, it is hard to obtain a regular influence pattern for the reduced accuracy. Note that the building where the meeting room is located for our experiment has quite a number of WiFi APs running for the campus, which may add extra interferences to the results.

6.4
Analysis and discussion

1) Analysis of CSI and RSSI approaches :
In real experiments, the DFC algorithm achieved a higher accuracy than the RSSIbased human counting algorithm in static/dynamic-target scenarios at a meeting room environment.
The proposed DFC algorithm collects training data for estimating the number of people, whereas the RSSI algorithm only uses a mathematical model to estimate the number. One of the reasons that the DFC algorithm can show a good performance is that it uses real-world data to train a probability model. On the other hand, the RSSI scheme is totally based on a sophisticated probability model without relying on real-world data. Thus, by collecting real-time CSI data, the DFC algorithm outperforms the RSSI algorithm.
The RSSI and CSI signals are collected at the MAC and PHY layers, respectively. RSSI data from the MAC layer is an aggregation of PHY layer information received from the transmitter, but CSI data from the PHY layer is generated by fast Fourier transform (FFT)/inverse fast Fourier transform (IFFT) during an OFDM process. Also, a CSI signal has the power information of each subcarrier from a WiFi NIC, so it includes much richer signal information of received data. As mentioned previously, the RSSI and CSI can be expressed as a coarse-grained feature and a fine-grained feature of a WiFi signal, respectively [5]. Since the DFC algorithm is based on CSI having fine-grained signal information, it can achieve a better performance than the RSSI scheme.

2) Analysis of static and dynamic target(s) :
The results in the dynamic case are better than those in the static case because the dynamic case makes both CSI average attenuation and variation to increase due to signal power fading (e.g. propagation fading, diffraction fading, and target absorption fading) by the mobility of people. Figure 9 shows the results of the estimation of static target(s) and dynamic target(s) over time for DFC algorithm. Also, Figure 10 shows the CDFs of the DFC and the RSSIbased approaches. As shown in Figures 9 and 10, the dynamictarget scenario has better performance than the static-target scenario. This is because as the number of people increases, the phenomenon of signal fading, attenuation, and scattering becomes more distinct too. Figure 5 shows the distribution features according to the target number. The features of dynamic target(s) can be well characterised by the moving, blocking, and attenuation of obstacles for the estimation of the number of people.
3) Impact of height : The purpose of using FFZ theory was to analyse the impact of obstacles for a link between two antennas in a room. As described in Section 4.1, if about 80% of FFZ is not blocked by any obstacles, the power attenuation of the wireless signal is almost equal to that of free space. The proposed DFC algorithm uses the signal reduction caused by obstacles in an LoS path of FFZ. Thus, the height of APs can affect the performance of DFC algorithm. To evaluate the impact of the height of the transmitter and receiver, another experiment was set up by varying the height of the laptops, such as 7, 20, 50, 80, 110, or 150 cm over the floor. In this experiment, the height of a person standing between the antennas of the two laptops is 180 cm. Figure 13 shows the impact of the height of APs on the features used in DFC algorithm (i.e. CSI average attenuation (X 1 ) and CSI average variation (X 2 )). That is, Figure  13a shows the trend of the changes of CSI average attenuation (X 1 according to the height of APs, and Figure 13b shows the trend of the changes of CSI average variation (X 2 ) according to the height of APs. An effective height for the experiment can be between 70 to 110 cm as the height difference between the AP and the person falls into this range. As shown in Figure 13, the effective and distinct impact happens between 80 to 110 cm of AP height. Therefore, the APs shall be placed at an effective height where persons can block the LoS path of the WiFi link.

4) Considerations on deployment :
Most of buildings (e.g. houses and offices) have WiFi devices such as public APs and desktop computers. With these existing WiFi devices, the DFC can estimate the number of people indoors. To cover a large indoor area, low-cost WiFi receivers can be deployed as auxiliary devices for the human counting. Therefore, as long as the WiFi devices can construct and measure wireless links for CSI data collection that can be reported to the proposed DFC system, the DFC system can perform human counting in a cost-effective way for a much smarter building management.

CONCLUSION
Here, we proposed a DFC algorithm for determining the number of people using CSI signal between a WiFi transmitter and receiver. The DFC algorithm uses the CSI average attenuation and the CSI average variation to determine how many people exist in a wireless link. With this system, energy can be saved by controlling electronic and electrical devices more efficiently in buildings such as companies and campuses. To verify the DFC algorithm, we tested the static-target and dynamic-target scenarios in indoor environments with 10 people. The DFC algorithm had a good performance for human counting in indoor environments with general COTS 802.11n WiFi cards to support the measuring CSI signal. As future work, a machine learning (ML) technique such as SVM and deep learning will be used to train the collected CSI signal to achieve a higher accuracy. In addition, considering the mobility and location of mobile devices (e.g. smartphone) and static devices (e.g. desktop PCs), we will develop a system for human counting using the temporary wireless links of WiFi transmitter (AP) and those devices in general office environments.