## 4 Model Application on Air Cruiser
### Instance Segmentation and Localization  
Our network is built by Python for code programming and model training output in Linux system. In order to use the model to carry out image sample inference in the cross-platform Winforn software with better performance, ONNX conversion and C# ONNX Runtime invocation of the trained video instance segmentation model.pt weight file are required. Firstly, the Onnxruntime environment code is introduced into Python and the onnx.export function is called to sort out the weight value of the model, the network flow information of the neural network, the input and output information of each layer network, and other auxiliary information and output it into an ONNX file. Then, the converted video instance segmentation model ONNX file is imported into the flight control software  
Figure 8: The platform structure diagram of the air cruiser control system. running directory, and the InferenceSession object is created by the API of ONNX Runtime in C# project to load the model in ONNX format. Subsequently, input data are prepared according to the requirements of the model, which involves image preprocessing (such as scaling, normalization, etc. ), and the preprocessed input data are passed to the model, and the output of the model is obtained. Then, the ONNX model is calculated to obtain the float DenseTensor including mask features, mask predictions, and bounding box regression predictions to perform three tasks of classification, bounding box regression localization, and instance mask region color coverage, respectively. In addition, the Rectangle function of OpenCVSharp is introduced to build the rectangular boxes of instances according to the bounding box regression corners. The PutText function is applied to label and draw the scores of the instances and probabilities and construct the rectangular boxes for the instances. Next, the mask areas are generated after the mask feature binarization process and the output is shown in Figure 9. Finally, the instance positioning coordinates are solved based on the instance mask center point coordinates. The location of target instance is mainly solved by the geometric relationship model between image point and target point. The ideal projection imaging model is the central projection in optics, which refers to the camera model in which all objects are projected onto the imaging plane through the center point of the camera optical axis. In this chapter, the ideal plane camera model is used to approximate the actual vision acquisition device. As shown in Figure 10, the photosensitive element of the visual acquisition device of the navigator is first established as the coordinate point \(C\), and the axis \(w\) is the lens optical axis. Then, the origins of the world coordinate system \(W\) and the corresponding coordinate system are established, in which the world coordinates of the origin of the photosensitive element are \((X_{C},Y_{C},Z_{C})\). According to the principle of similar triangle, the parameter relationship can be obtained as follows:  
\[\frac{X-X_{C}}{f_{c}}=-\frac{Z-Z_{C}}{y_{c}}=-\frac{Y-Y_{C}}{x_{c}}, \tag{17}\]  
Further, according to the image coordinates of the image point \(o\) with the camera focal length transformation, the world coordinates of the cruise flying origin are \(C\) and the target world coordinates are in \(X_{w}\) and \(Y_{w}\) directions from \(dX=X-X_{C}\), \(dY=Y-Y_{C}\). Further, we consider the Earth as a regular sphere, where the Earth's radius is 6,371,000 m, the  
Figure 9: Diagram of video instance segmentation and positioning output. circumference of any Earth's longitude is 40030173, and the circumference of a particular latitude \(latl_{c}\) can be calculated as 40030173 \(\times\) cos(\(lat\)) meters. On the basis of combining cruise flying shot coordinates \((lat_{CAM},lon_{CAM})\) calculating the target coordinates, the specific expression is  
\[lat_{o}=\frac{lat_{cam}+dX\times 360^{\circ}}{40030173\times\cos(lat_{cam})}, \tag{18}\] \[lon_{o=}\frac{lon_{cam}+dY\times 360^{\circ}}{40030173}\]