# Situational Awareness and Problems of Its Formation in the Tasks of UAV Behavior Control
## 5 Forming Elements of Situational Awareness for UAVs
#### 5.2.6. Ways to Increase Data Processing Speed When Solving the Semantic Segmentation Problem  
To increase the performance of the neural network used, some combination of the following steps can be applied:  
* use more advanced neural network architectures;
* perform low-level optimization of the computation graph for the particular computing architecture used onboard (this can be done both manually and with third-party tools);
* perform downscaling of neural network weights, use simple quantization and quantization aware training;  
Figure 3: Examples of performance evaluation for pairs of networks Unet–MobileNetV2, PSPNet–ResNet34, and DeepLab–ResNet34. In the upper part of the figure the original images are shown, followed by the markup mask (the reference markup of the corresponding image). Then, the results of the specified pairs of networks are shown. apply low-rank factorization;
* optimize convolutional filters;
* build new, more efficient blocks;
* use neural network knowledge distillation to train a much simpler learner model on a mixture of responses from the larger teacher model and the original model itself;
* use automated neural network architecture (NAS) search. To achieve high performance while maintaining accuracy, we will use the knowledge distillation approach [109; 110; 111] based on the outputs of the teacher's model (response-based knowledge distillation). Figure 4 shows the teacher-student architecture used. The teacher model (marked in red) is pre-trained on the dataset being used. The student model is a simpler neural network architecture PSPNet with the network encoder MobileNetV2. This choice is due to the computational efficiency of the MobileNetV2 network on low-power devices and its availability in standard libraries. The loss function has two parts:  
* distillation loss This part of the loss function is responsible for comparing the soft predictions of the teacher and student models. The better the student's model repeats the results of the teacher's model, the lower the value of this part of the loss function. * student loss This part of the loss function, as in ordinary training, compares the results of the student's model (hard labels) with the markup (ground truth)  
As a teacher model, we will use the DeepLabV3 neural network architecture with a network encoder se-resnet50 ([[https://arxiv.org/pdf/1709.01507.pdf](https://arxiv.org/pdf/1709.01507.pdf)]([https://arxiv.org/pdf/1709.01507.pdf](https://arxiv.org/pdf/1709.01507.pdf)) (accessed on 26 November 2021)). As a student model, we will use the PSPNet neural network with the MobileNetV2 encoder network MobileNetV2. The neural network teacher was trained on the Semantic Drone Dataset dataset for seven days on an Nvidia Tesla V100 graphics card. The student model was trained in a similar way, but for four days. After that, knowledge was distilled from the larger DeepLabV3 model to a simpler model based on the PSPNet architecture. Comparison of models and results of distillation are shown in Table 2. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Model** & **Model** & **Backbone** & **Model** & **Mean IoU** & **Pixel** & **Prediction** \\
**Type** & & & **Size** & **Accuracy** & **Time, s** \\ \hline teacher & DeepLabV3 & SE-Resnet50 & 162 MB & 0.644 & 0.93 & 0.2 \\ student & PSPNet & MobileNetV2 & 9.4 MB & 0.516 (0.612) & 0.9 (0.91) & 0.041 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Comparison results of teacher and student models. Figure 4: Response-based knowledge distillation. As a result, we have obtained a student model, which is slightly inferior in accuracy to the teacher model--namely, the value of mean IoU is 0.644 for the teacher model vs. 0.612 for the student model after distilling the knowledge and pixel accuracy of 0.93 vs. 0.91 for the teacher and student models, respectively. At the same time, the resulting student model takes up much less space (almost 17 times less) and runs nearly five times faster.