## 4 Indoor Occupancy Detection  
### CSI Amplitude Coloring  
In Figure 2, we depict the pipeline for people counting through CSI amplitude coloring. We denote the number of subcarriers measured by the Nexmon as \(S\). We also denote the number of classes that a Wi-Fi sensing system is requested to classify as \(C\). Since the ESP8266 transmits a UDP packet every 10 ms for CSI measurement, we discretize time based on the CSI measurement period. In other words, we use the \(t\)-th measured CSI data interchangeably with the CSI data measured at time \(t\). We denote the amplitude component of a subcarrier \(i\) in the CSI data measured at time \(t\) and belonging to a class \(c\) as \(a_{c,i}(t)\). Then, at the \(t\)-th measurement time, the amplitude vector of the CSI data belonging to class \(c\) is given as  
\[A_{c}(t)=(a_{c,1}(t),\ldots,a_{c,S}(t)). \tag{2}\]  
We construct the basic data samples for CNN by considering both the temporal correlation of CSI data and the spatial correlation between subcarriers. Specifically, we collect \(A_{c}(t)\)s measured over consecutive \(h\) measurement time to form the basic input data sample \(X_{c}(t:t+h)\) for the class \(c\) as follows:  
\[X_{c}(t:t+h)=(A_{c}(t),...,A_{c}(t+h))^{T}= \begin{bmatrix}a_{c,1}(t)&\cdots&a _{c,1}(t+h)\\ a_{c,2}(t)&\cdots&a_{c,2}(t+h)\\ \vdots&\vdots&\vdots\\ a_{c,S}(t)&\cdots&a_{c,S}(t+h)\\ \end{bmatrix} .\]  
where \(X_{c}(t:t+h)\) can be regarded as an image of the Wi-Fi signal propagation environment in grayscale. Since the difference between \(A_{c}(t)\) and \(A_{c}(t+1)\) is marginal, we construct \(X_{c}(t:t+h)\) every \(\tau\) measurement time from the collected CSI data for a class \(c\). In other words, we create a dataset for a class \(c\) as \((X_{c},c)\), where \(X_{c}=\{X_{c}(1:h),X_{c}(\tau,\tau+h),\ldots\}=\{X_{c}((t-1)\tau:(t-1)\tau+h) :t=1,2\ldots\}\). Then, the dataset for CNN is given as  
\[D=\{(X_{c},c):\forall c\in[1,C]\}. \tag{3}\]  
To expand each \(a_{c,S}(t)(\forall c\in[1,C]\cap s\in[1,S])\) into a three-dimensional vector, we use the jet colormap [16]. The jet colormap is a rainbow color palette that includes red (R), green (G), and blue (B) colors. It visualizes data values through a continuous change from blue (lowest value) to red (highest value), with middle values represented by green, yellow, and other intermediate colors. While the jet colormap changes colors sequentially,  
Figure 2: Pipeline for people counting via CSI amplitude coloring. it shows strong color changes in the middle range and in areas with noticeable color transitions, which makes data boundaries or features potentially appear more exaggerated than they actually are [20]. We utilize this characteristics of the jet colormap to amplify subtle differences between CSIs belonging to different classes but that have similar values. Specifically, the jet colormap consists of the following three functions \((f_{R}(x),f_{G}(x),f_{B}(x))\), each of which expands scalar data \(x\) into R, G, and B channels:  
\[f_{R}(x)= \begin{cases}0&\text{if }0\leq x\leq 0.35\\ 3.23(x-0.35)&\text{if }0.35\leq x\leq 0.66\\ 1&\text{if }0.66\leq x\leq 0.89\\ -4.55(x+0.89)&\text{if }0.89\leq x\leq 1\\ \end{cases}  \tag{4}\]  
\[f_{G}(x)= \begin{cases}0&\text{if }0\leq x\leq 0.125\\ 4(x-0.125)&\text{if }0.125\leq x\leq 0.375\\ 1&\text{if }0.375\leq x\leq 0.640\\ -3.703(x+0.64)&\text{if }0.640\leq x\leq 0.910\\ 0&\text{if }0.910\leq x\leq 1\\ \end{cases}  \tag{5}\]  
\[f_{B}(x)= \begin{cases}4.55x&\text{if }0\leq x\leq 0.11\\ 1&\text{if }0.11\leq x\leq 0.34\\ -3.23(x+0.34)&\text{if }0.34\leq x\leq 0.65\\ 0&\text{if }0.65\leq x\leq 1\\ \end{cases}  \tag{6}\]  
In Figure 3, we also show \(f_{R}(x),f_{G}(x),\) and \(f_{B}(x))\) graphically. To expand \(a_{c,s}(t)\) into three (i.e., RGB) channels by using the jet colormap, we first normalize \(a_{c,s}(t)\) in each \(X_{c}(t:t+h)\) via min-max normalization.