Improving Pedestrian Dynamics Predictions Using Neighboring Factors

Predicting pedestrian dynamics is a complex task as pedestrian speed is influenced by various external factors. This study investigates neighboring factors that can be used to improve pedestrian walking speed prediction accuracy in both low-and high-density scenarios. Different factors are proposed, including Mean Distance, Time-to-Collision, and Front Effect, and data for each factor is extracted from different public datasets. The collected data at time t is used to train a neural network to predict the pedestrian walking speed at time t + ∆ t . Predictions are evaluated using the Mean Absolute Error. Our results demonstrate that incorporating the Front Effect significantly improves prediction accuracy in both low-and high-density scenarios, whereas the Mean Distance factor only proves effective in high-density cases. On the other hand, no significant improvement is observed when considering the Time-to-Collision factor. These preliminary findings can be utilized to enhance the accuracy of pedestrian dynamics predictions by incorporating these factors as additional features within the model.


Introduction
Predicting pedestrian dynamics is a complex task as pedestrian walking speed is influenced not only by intrinsic factors, such as pedestrian's objectives and characteristics, but also by external factors like social groups [1], crowd density [2], environmental conditions [3,4], among others.Consequently, incorporating these external factors can improve the accuracy of predicting pedestrian behaviors.For instance, better prediction accuracy in pedestrian trajectories is archived by providing neural networks additional contextual information, such as integrating environmental layouts via hierarchical LSTMbased neural network [5], determining most interactions with neighbors using attention mechanisms [6,7], or including time-to-collision terms into the loss function [8,9].However, there remains a need to evaluate the impact of these factors, particularly those derived from neighboring pedestrians, on the performance of pedestrian dynamics prediction across different scenarios.
In this article, we propose and investigate different neighboring factors that can be used to improve pedestrian walking speed prediction accuracy in both low-and high-density scenarios.To do this, two types of datasets are prepared corresponding to these scenarios and data is analyzed using a neural network approach.

Methodology
This section presents data extraction for the proposed neighboring factors from different public datasets and our method to analyze the impact of these factors on predicting pedestrian walking speed.

Data extraction
We propose to investigate the impact of the following external factors derived from neighboring: Mean Distance, Time-to-Collision, and Front Effect.For each pedestrian i, the proposed factors are extracted with respect to each neighboring pedestrian j of its K nearest neighbors.Let p i = (x i , y i ), v i = (v x i , v x j ), and r i represent the position, velocity, and radius of the pedestrian i, respectively.
The walking speed of pedestrian i is denoted as ∥v i ∥ where ∥v∥ represents the Euclidean norm of vector v.The relative position and velocity between the pedestrians i and j are denoted as p i j = (∆x i j , ∆y i j ) = (x i − x j , y i − y j ) and v i j = (∆v x i j , ∆v y i j ) = (v x i − v x j , v y i − v y j ), respectively.The description of these factors is as follows: • Mean Distance (MD) is computed as the mean Euclidean distance to each of the K nearest neighbors.The MD represents local density information around the pedestrian; for example, a smaller MD indicates a higher local density level surrounding the pedestrian.
• Time-to-Collision (TTC) between the two pedestrians i and j, denoted as τ i j , is estimated as the remaining time until collision if they continue to move with their current velocities [10].The TTC is a sufficient indicator to model pedestrian-pedestrian interactions [10] rather than only relative distance.The TTC value is assigned to a large positive number if no collision is anticipated between the two pedestrians.
Here, the smallest TTC value in the K nearest neighbors is selected.
• Front Effect (FE) considers the K nearest neighbors who fall in a 180-degree field of vision of the pedestrian i.The reason for choosing this factor is that pedestrians are more influenced by neighbors who appear in their immediate field of vision.
In addition to these aforementioned neighboring factors, fundamental information is also extracted, which includes pedestrian speed and its relative position and relative velocity with respect to its neighboring pedestrians.

Datasets
Data is extracted from three widely used public pedestrian datasets using different values of K (3, 5, 7, and 10).The fundamental characteristics of these datasets are presented in Tab. 1.Given that high density is defined as greater than 1 pedestrian/m 2 [11], the datasets are classified as low-density (ETH [12] and UCY [13]) and high-density (FZJ [14]).The framerates of the low-and high-density datasets are 2.5 fps and 16 fps, respectively.

Method
Our method employs a Multilayer Perceptron (MLP) neural network with h hidden layers to learn data at time t and predict the pedestrian walking speed at time t + ∆t.It has been demonstrated that the MLP neural network is more effective in predicting pedestrian walking speed than classical models based on fundamental diagram [15].Different inputs are fed into four neural networks: • The first network is the baseline network whose input consists of the following fundamental information: the pedestrian's current speed, relative positions, and relative velocities to the K nearest neighbors.
• In the second neural network, the mean distance of K nearest neighbors is included as an additional feature along with the fundamental information: • The third neural network incorporates the smallest TTC in the K nearest neighbor as an additional feature along with the fundamental information: • The final neural network uses the fundamental information to the K nearest neighbor in front: The architecture of the MLP neural network is h = (6, 3), meaning there are two hidden layers: the first and second layers contain 6 nodes and 3 nodes, respectively.The input layer size of each neural network depends on the value K in each dataset.Training is conducted separately for low-density and high-density datasets, using the Adam optimizer with a learning rate of 0.001 and the Mean Squared Error as the loss function.Each dataset is split into two subsets, with 80% used for training and 20% used for testing.The Mean Absolute Error (MAE) is used to evaluate the predictions.All computations are performed on an AMD Ryzen 7 4800H CPU with 16 GB of memory.

Results
For each neural network, the average MAE result is computed from 30 trainings.Then, the average MAE results of the other neural networks are compared with the baseline result of NN K 0 1 with K 0 = 3 to calculate the improvement percentages: × 100%, for i = 1, 2, 3, 4 and K = 3, 5, 7, 10. (8) where MAE(NN K i ) presents the MAE of actual speed ∥v j ∥ and the corresponding speed predicted by the neural network NN K i over N data samples: Fig. 1 shows the MAE and improvement percentage results of predictions of different neural networks over different numbers of neighbors in both low-density and high-density datasets.It can be observed from both low-density and high-density datasets that the performance of all neural networks consistently improves when the number of neighbors increases.This trend indicates that including more neighbors provides more contextual information so neural networks can learn better.In the low-density dataset (see Fig. 1(a)), adding TTC to the neural networks worsens prediction accuracy.This can be explained by the fact that most of the time-to-collision to neighbors in low-density scenarios is typically large, while the interaction time horizon is 2 -4s [10].Consequently, at the macroscopic level, the influence of this factor on pedestrian movement becomes trivial in low-density situations.On the other hand, FE presents the best improvement in prediction accuracy (approximately 5.8% for NN K  4 with K = 10), while the effect of MD with NN 2 shows similar results with NN 1 .This observation suggests that in low-density situations, the FE is the most important factor, while the impact of MD is not particularly meaningful.
In the high-density dataset, adding any proposed neighboring factors to the neural networks helps to improve the results.Using MD and FE shows strong improvements (around 4.5% for NN K  2 with K = 10 and 4.0 % for NN K  4 with K = 10), while adding TTC slightly improves prediction accuracy.This suggests that the MD and FE are more effective than TTC in high-density scenarios.
Based on the results above, the two factors that yield the best improvement are Mean Distance and Front Effect and thus are chosen for comparison.For each number of K, the improved accuracy for MD and FE is calculated to the results of the neural network NN K 1 : × 100%, for i = 2, 4 and K = 3, 5, 7, 10.For MD, there is a clear difference in improvement between low-and high-density situations.The improvement in the high-density dataset is much higher than that in the low-density dataset for all different numbers of K neighbors.The lowest and highest improvement in the high-density dataset is 2.344% and 3.195%, respectively, while the highest improvement in the low-density dataset is just 0.793%.This indicates that MD in high-density scenarios provides more information than in low-density scenarios as it describes the local density surrounding pedestrians.
On the other hand, FE exhibits a noticeable improvement in accuracy in both lowdensity and high-density datasets.The highest improvement in the low-density dataset is 2.893 % with K = 5, while the improvement results remain stable from 2.103 to 2.361% in the high-density dataset.This suggests that pedestrian movement is primarily influenced by the neighboring pedestrians in directional relevance.These preliminary results can be incorporated into the simulation models and neural network algorithms to improve accuracy.

Conclusion
This paper investigates neighboring factors that can be used to improve pedestrian walking speed prediction accuracy in both low-and high-density scenarios.The data for these factors, collected from various public datasets, is analyzed using a neural network approach.It has been demonstrated that incorporating the appropriate contextual information from the neighboring pedestrians into the neural network's input can significantly improve prediction accuracy.The key finding reveals that the Front Effect is an impactful factor in both scenarios, while Mean Distance becomes particularly crucial only in high-density situations.Another factor is that Time-to-Collision has no significant effect at low density and is trivial at high-density situations.These preliminary findings can be utilized to enhance the accuracy of pedestrian dynamics predictions by incorporating these factors as additional features within the model.

Figure 1
Figure 1 Improvement results in (a) Low-density dataset and (b) High-density dataset.

Fig. 2
Fig. 2 presents the comparison of improvement percentage between the low-and highdensity datasets for Mean Distance and Front Effect over different numbers of K.

Figure 2
Figure 2 Comparison of percentage of improved accuracy between low-and high-density datasets over different numbers of K using (a) Mean Distance and (b) Front Effect.

Table 1
Fundamental characteristics of different datasets.