# Stream: Spatial Trajectory Enhanced Attention Mechanism for Abnormal UAV Trajectory Detection
## 3 System Design
### Attention Mechanism  
Attention mechanisms enhance the performance of neural network models by focusing on the features of important data during the learning process. The STEAM for trajectory  
Figure 4: These are the results of image-based DNN interpolation. Figure 5: This is the network structure of the proposed interpolation methodology. patterns such as UAV surveillance integrates an approach that effectively captures both the features of trajectories and contextual backgrounds and then dynamically weights them to perform spatial attention mapping. The STEAM process can be expressed as follows:  
\[T=f_{\text{trajectory}}(X), \tag{11}\]  
\[C=f_{\text{context}}(X), \tag{12}\]  
\[F=\text{concatenate}(T,C), \tag{13}\]  
\[D=f_{\text{dynamic}}(F), \tag{14}\]  
\[A=f_{\text{spatial}}(D), \tag{15}\]  
\[X^{\prime}=X\odot A. \tag{16}\]  
where \(X\) is the input feature map, \(T\) and \(C\) are, respectively, trajectory and context features extracted using convolutional layers, \(F\) is their combination, \(D\) represents dynamically weighted features, \(A\) is the attention map using convolutional layer, and \(X^{\prime}\) is the final attended feature map. As shown in Equations (11) and (12), two separate convolutional layers are used to extract detailed features of the trajectory and to capture the surrounding context. We then dynamically weigh them to produce a balanced representation of both trajectory and context, as shown in Equation (14). Finally, we generate a spatial attention map through the convolutional layer that highlights the areas of the images most relevant to understanding the trajectory of UAVs, as shown in Equation (15). As a result, the attached feature map generated by Equation (16) allows the model to focus on the most important aspects of the trajectory, improving the interpretability and performance of the neural network model for the trajectory pattern. Methods such as SE and CBAM focus on channel relationships or provide sequential spatial and channel-specific attention. These are methods of focusing throughout the channel level or emphasizing important spatial areas in the feature map. In contrast, STEAM specifically targets dual aspects: it not only emphasizes the trajectory features of UAV movements but also pays particular attention to the contextual backgrounds. This dual focus is crucial, especially in cases where UAV trajectories are overlaid onto diverse or complex backgrounds. Unlike CBAM, which applies channel and spatial attention in a sequential manner and focuses on either trajectory or contextual information at a time, STEAM employs a more integrated approach. It simultaneously processes both trajectory and contextual information, ensuring a more comprehensive analysis of UAV trajectory images. This distinction allows STEAM to effectively handle the nuances and complexities inherent in UAV surveillance imagery, where both the path of the UAV and its interaction with the surrounding environment are critical for accurate interpretation. Existing methods can be widely applied to many architectures for various image analysis tasks. On the other hand, visible trajectories or movement patterns may be insufficient to effectively capture subtle nuances. Although there are research results such as transformer-based ViT in terms of performance, it is unclear whether it will be appropriate for detecting UAV trajectories that require a real-time agile response in that prior learning is required. We demonstrate how STEAM operates, as shown in Algorithm 1, and how suitable STEAM is for UAV trajectories compared to conventional methods by performance evaluation in the following sections.