# Pedestrian Trajectory Prediction Based on Dual Social Graph Attention Network
## 3 Methods
### Dual Social Graph Attention Network
#### 3.3.1 Directed Social Attention Function  
To extract the directed interaction between pedestrians that conforms to the actual situation, we constructed the directed social attention function, which needs to accurately model the influence that pedestrians experience during walking. When pedestrians are moving forward, they will judge whether the pedestrians in front may collide with themselves and make way for and plan the route accordingly. Based on this description, we can identify two key factors: forward and collision. Next, we build the directed social attention function between pedestrians around these two keywords. During the process of moving forward, due to the limitation of vision, pedestrians cannot consider the influence of everyone present on themselves, but can only focus on the individuals in the direction of their walking. Therefore, the influence between pedestrians is directed, rather than an indiscriminate two-way influence. Based on this, we calculate the directed interaction between pedestrians and construct a directed adjacency matrix representation. Regarding collisions, pedestrians have actual volume, so it is inevitable to consider the factor of collision in the actual walking process. The factors affecting collisions include the relative speed of movement between pedestrians, the distance between them, and whether they are walking in the direction of movement. The traditional methods of modeling collisions are mostly designed based on relative distance, which cannot effectively express the complex relationships between pedestrians. Unlike most traditional methods, we comprehensively consider the approach speed, relative angle, and relative position to model individuals. In response to this series of complex interaction situations, we designed the directed social attention function \(F_{sr}\) to cover these features, aiming to calculate the relationship weight \(w_{ij}^{t}\) between pedestrian \(i\) and \(j\) at time \(t\) to construct the directed graph \(G_{1}\), so as to calculate the unique interaction influence of each pedestrian at every moment. The specific function is represented as follows:  
\[w_{ij}^{t}=F_{sr}(\Delta v,\cos\theta^{t},dist_{ij}^{t}) \tag{5}\]  
That is,  
\[w_{ij}^{t}= \begin{cases}max\left(0,\frac{\Delta v\cos\theta^{t}}{dist_{ij}^{t }}\right)&i\
eq j\\ \alpha&i=j\end{cases}  \tag{6}\]  
As shown in Equation (5), our directed social attention function uses \(\Delta v\), \(\cos\theta^{t}\), and \(dist_{ij}^{t}\) to represent the relative speed, relative angle, and relative distance between pedestrians, respectively. We take the direction of the vector \(v_{i}^{t}\) as the positive direction and calculate the influence of relevant nodes within \(180^{\circ}\) in front of node \(i\) on node \(i\). Taking node \(j\) as an example, we calculate the influence of node \(j\) on node \(i\) at time \(t\). As shown in Figure 3, \(v_{i}^{t}\) represents the velocity vector \(v\) of node \(i\) at time \(t\), which expresses the displacement of node \(i\) within unit time \(i\), calculated via \((x_{i}^{t}-x_{i}^{t-1},y_{i}^{t}-x_{i}^{t-1})\). \(dist_{ij}^{t}\) represents the Euclidean distance between node \(i\) and node \(j\) at time \(t\), and similarly, \(dist_{ij}^{t-1}\) is the Euclidean distance between node \(i\) and node \(j\) at time \(t-1\). \(\Delta v\) represents the distance change between node \(i\) and node \(j\) from time \(t-1\) to \(t\), calculated via \(\triangle v=dist_{ij}^{t-1}-dist_{ij}^{t}\), representing their approach speed. \(\theta^{t}\) represents the angle between the direction of node \(i\)'s movement and node \(j\) at time \(t\), which we use to determine whether node \(j\) is in the direction of node \(i\)'s movement. \(\alpha\) is the attention constant of the self-loop in the graph, that is, the size of the pedestrian's attention to itself, which is based on the data level. If it is too large, it will reduce the influence of surrounding pedestrians, and if it is too small, it will not pay enough attention to itself.