## 4 Elevator People-Counting System
### People-Counting Method  
The algorithm used for people flow tracking utilizes MobileNet as the image recognition model combined with the SSD object-tracking algorithm. MobileNet, chosen as the image recognition model, exhibits attributes of low latency and low power consumption. These characteristics make it well suited for deployment on embedded development boards, aligning with our research objectives. Despite its comparatively lower accuracy, its lightweight nature is a dominant advantage. Specifically, we employed MobileNet V3, an improved version, which incorporates depthwise separable convolution from V1 and the linear bottleneck inverted residual structure from V2. Notably, V3 replaces the ReLU activation function with h-swish(x), resulting in an enhanced neural network accuracy. For our dataset, we employed the publicly available COCO dataset and selected target objects labeled as people for recognition. The SSD object tracking algorithm was employed due to its superior processing speed compared to the Faster RCNN. It shares the image processing concept with YOLO, conducting verification (classification) and bounding box regression simultaneously. In our approach, MobileNet V3 identifies candidate regions in the image, followed by SSD detection of all candidate regions. Subsequent to detection and localization, we determine the current waiting count based on whether the tracked target crosses the LOI that we have set. Our model's dataset was derived from the \"person\" data within the COCO open dataset, consisting of a total of 66,808 data samples (i.e., images). Among these, we randomly selected 20,000 samples for training to keep our model at a reasonable size, of which 17,000 samples were used for training, and the remaining 3000 were reserved for testing. After 3000 iterations, the loss stabilized at approximately 1.5 to 2.5, with a mean average precision (mAP) of 0.727. Recognition involves the consideration of confidence values and frame rates, both of which exert considerable influences on subsequent detection. To explore their influences, we conducted experiments with different camera angles, using horizontal formation as a benchmark to adjust the two parameters. Initially, we tuned the confidence value, which measures the model's recognition of objects similar to the target in the image. By adjusting this value, we ensured that the model focused on objects that closely resembled the target. We utilized Equation (1) and parameterized the confidence value using the variable \(I_{c}\), denoting the confidence threshold adjustment with the parameter \(i\). The parameter range for \(i\) spanned from 0.6 to 0.8, with adjustments made in increments of 0.005. This process yielded intermediate accuracy values \(IP_{c_{i}}\), which allowed us to determine the optimal confidence threshold parameter \(I_{c}\) via Equation (1). Subsequently, we adjusted the frame rate parameter \(I_{F}\). In scenarios where adjusting the confidence value still led to objects being omitted, frame rate adjustment was needed. \[I_{c}=MAX(IP_{c_{i}}). \tag{1}\]  
We defined the frame rate variable as \(I_{F}\), beginning at 10 and increasing incrementally until the optimal accuracy was achieved. Equation (2) facilitated the identification of the optimal frame rate using \(IP_{f_{j}}\), where \(j\) ranged from 1 to 10. The frame rate was adjusted by two frames at a time, up to a maximum of thirty frames. Once the ideal accuracy was achieved in the horizontal formation, we applied these parameter adjustments to the other three formations, vertical, diagonal, and zigzag, achieving effective parameters for all four formations. \[I_{c}=MAX(IP_{f_{i}}). \tag{2}\]  
The tracking method involves the centroid tracker algorithm. Upon a target's initial appearance, its centroid is computed, assigned an ID, and tracked. Subsequently, the Euclidean distance between the centroids in consecutive images is calculated.