# Simultaneous Indoor Tracking and Activity Recognition Using Pyroelectric Infrared Sensors
## 6 Experiments
### Recognition Result  
In our experiments, the accuracy was calculated based on the classification result of each data frame, as shown in Figure 7. The recognition result was compared with the ground truth labeled manually for every second according to the video. Through a random partition, 90% of the datasets were selected as the training set, and 10% of the datasets were selected as the testing set. We employed 10-fold cross-validation (CV) to evaluate the performance of our system. In each CV, the training set included 14,841 data frames, and the testing set included 1487 data frames.  
Some typical frames of video and PIR data frames are shown in Figure 12. The right column of each subfigure is the snapshot captured from the video. The middle column is the human moving trace projected on the floor. The mean localization error of our system is about 0.85 m. The red square  
Figure 11: The overview of data processing. The feature vector for the first-layer RF is \(\{x_{t},y_{t},v_{t}\}\). The feature vector for the second-layer RF is \(\{x_{t},y_{t},v_{t},D_{t}\}\), where \((x_{t},y_{t})\) is the location of the human target at the \(t\)th data frame, \(v_{t}\) is the moving speed, and \(D_{t}\) is the activity duration time.  
is the region of chairs. The green square is the location of the bed, where sitting, lying, and transitional activities may occur. The left column is the ground truth labels of each second, the classification results of the first-layer RF and second-layer RF, respectively.  
In the left column of each subfigure, labels for the ground truth and activity classification results are as follows: 1. lying, 2. sitting, 3. standing, 4. walking, and 5. transitional activities. In Figure 11(a), the human subject stands up and then walks towards the bed. The activities mainly include sitting and walking. In Figure 11(b), she walks around and then sits down on the chair. The activities include walking and sitting. In Figure 11(c), she walks to the bed, sits on the bed, and then lies on the bed. The activities mainly include walking, transitional activities, and lying. In Figure 11(d), she walks around and then stands still for a while. The activities indicate walking and standing. In Figure 11(e), she lies on the bed for a while and then sits on the bed, which represents the transitional activities of lie-to-sit.  
In order to compare the effect of different parameter settings, we calculated the mean accuracy and standard deviation of 10-fold CV for different numbers of decision trees in RF, as shown in Figure 13. The improvement of the second-layer RF compared to the first-layer RF is obvious; for the second-layer RF, the accuracy is much higher, and the standard deviation is much lower.  
According to Figure 13, 20 decision trees represent a good trade-off between accuracy and algorithm complexity, and we  
Figure 12: Typical snapshots of video, moving trace of the human target, and the classification results of our two-layer RF. (**a**–**e**) The left column represents the ground truth labels of each second, the results of the first-layer RF, and the results of the second-layer RF, respectively. The y-axis represents the activity classification result of each second (s): 1. lying, 2. sitting, 3. standing, 4. walking, 5. transitional activities. The middle column is the moving trace of the human target on the map. The red square is the region of chairs, and the green square is the location of the bed. The right column is the snapshot captured from the video, where (**a**–**e**) represent walking, sitting, lying, standing, and lie-to-sit, respectively.