# Passive Indoor People Counting by Bluetooth Signal Deformation Analysis with Deep Learning
## 3 BLE-Based Passive Human Sensing
### The Proposed Deep Learning Model  
In the literature, both classification and regression have been used for Passive Human Counting (PHC). Classification is often the simpler approach, depending on the specific classification technique used [32; 33]. Furthermore, measuring classification performance by counting the percentage of correct predictions, i.e., calculating its accuracy, also provides an understandable evaluation of the reliability of the proposed approach, which is valuable information when the main motivation for the work is the safety of people. Regression is conceptually better suited to a numerical estimation problem, such as the one at hand [24; 25]. However, the quantities being predicted are discrete and finite numbers and may as well be considered as non-numeric labels, thus suggesting the use of classification instead. Nevertheless, regression retains the important advantage that it allows for estimating values that the model has never seen before, that is, the regressive model can in principle predict an occupancy value that it has not been trained on. As will be shown in Section 5, this occurs at the cost of performance degradation, but it can still be carried out with regression, while most classification techniques would not support it. Some interesting work in the classification literature can deal with unseen labels, but at the cost of a severe increase in computational complexity and a significant degradation in accuracy [34]. We tested five different deep neural network models, characterized by increasing complexity and based on widely adopted architectures [35]:  
1. A Dense Neural Network model (DenseNN), composed of a stack of three dense layers. 2. A Convolutionary Neural Network (CNN), composed of three Convolutionary layers. 3. A Long Short-Term Memory (LSTM) network, composed of two Long Short-term Memory (LSTM) layers. A hybrid CNN+LSTM network structured as a sequence of three Convolutionary layers followed by two LSTM layers. * A legacy Transformer model with four heads, four Transformer blocks, and \(head\_size=3\). In all five architectures, the model was completed by an output dense layer in two different settings, i.e., a classification task and a regression task. In each model, only the last two layers change according to the setting. In the classification models, the final \"dense\" layer uses a Softmax activation function, whereas in the regression models, the final \"dense\" layer uses a linear activation function. All CNN layers in the models use a ReLU activation function, and all models are trained with the Adam optimizer. Furthermore, the classification models are trained using the Sparse Categorical Cross-Entropy Loss Function, whereas the regression models are trained using the Mean Squared Error Loss Function. Each architecture presents unique strengths and limitations, which are summarized below (Table 1). The approach presented is based on pre-training and fine-tuning a deep learning model, thus improving the final accuracy of the prediction. More specifically, the model was pre-trained and validated using a large dataset collected during several hours in different rooms and with different numbers of occupants sitting in different places. When collecting such data, an operator manually annotated the number of occupants. Subsequently, a smaller dataset was gathered during a few minutes session in the same environment (that is, in the same room) where the final test dataset was gathered, thus letting the model learn about the internal geometry of the testing environment. From the point of view of the final user, fine-tuning recalls the calibration of a measurement instrument before deploying it in production. Fine-tuning is a crucial step for the application at hand. The performance of the model depends on its implicit knowledge of the deployment geometry of the BLE transmitters and receivers involved. Consequently, several works in the literature propose to manually measure the distance between each transmitter and each receiver, in addition to fully