# Stream: Spatial Trajectory Enhanced Attention Mechanism for Abnormal UAV Trajectory Detection
## 3 System Design
### Deep Interpolation Model
We use a DNN model that shows excellent performance in the problem of filling empty spaces called a hole in the image as an interpolation method. Our proposal begins with the idea that, when arranging the location data calculated based on the information collected from the UWB sensor in chronological order, missing values, which may occur for various reasons, are ultimately represented as holes in the images derived during the trajectory visualization process, and we can use an appropriate DNN to fill these holes through a rational process based on surrounding information. We can generally use convolution for image processing, but we consider a few more considerations. Since our data are not a continuous image, we do not have enough information to describe the context, and basically we need as much information as possible around the damaged pixels to fill the holes in the image, but our image sets do not have enough information to describe the UWB trajectory. It contains very little information and the information available is limited. For this reason, the use of standard convolutions can cause various artifacts such as blurriness and color discrepancy in the results. However, through research, we determined that partial convolutions, an advanced technique for image inpainting, would have excellent performance in our case, and the application results are shown in Figure 4.  
The trajectory shown in Figure 4 is derived from simulation data, which include the coordinates of the UAV's location, following the methodology outlined in Section 3.1. Figure 4c shows that interpolation close to the original image is achieved even though the loss rate is almost 70-80%, and, when compared to the results using the Kalman filter in Figure 3, interpolation using partial convolutions shows better performance. The base network of the interpolation neural network we consider has a U-net-based architecture, as shown in Figure 5, which can be seen as the most general network structure for image inpainting. The main difference in our network from a traditional U-net lies in the adoption of partial convolution across all layers instead of standard convolution. Partial convolution operates with a mechanism that gradually fills in holes within the original image by referencing a mask containing information about these holes [48]. As the input image traverses successive partial convolutional layers structured in a U-net architecture, the vacant areas progressively become filled starting from the periphery, and the value of each hole is computed based on surrounding pixel information. The first layer of our network receives as input a visualized UWB trajectory and a mask that covers the holes due to missing values and part of the surrounding area. After this, when performing partial convolution while sliding, convolution is applied only to the masked features of the image, and the renormalized image is passed as the input image of the next layer. At the same time, the effective region of the inpainted mask is updated and this is also passed on to the next layer. Afterwards, as it goes through stacked partial convolution layers, the previous operations are repeated identically, and, as a result, holes in the image corresponding to missing values are gradually filled. Our loss function is expressed as follows:  
\[\mathcal{L}_{total}=\mathcal{L}_{valid}+10\mathcal{L}_{hole}+0.05\mathcal{L}_{ perceptual}+60(\mathcal{L}_{style_{out}}+\mathcal{L}_{style_{comp}})+0.8\mathcal{L}_{tv}. \tag{10}\]  
Due to the nature of the data, it was necessary to focus on hole restoration accuracy and hole boundary information, and the weights of related loss terms were set through empirical search.