# Intelligent Monitoring of Tunnel Fire Smoke Based on Improved YOLOX and Edge Computing
## 4 Model Deployment of Edge Computing Based on Knowledge Distillation
### Model Deployment on the Edge Computing Side  
ONNNXv1.17.0 (Open Neural Network Exchange) is an open-source format for representing deep learning models [56; 57]. It was developed by Microsoft and Facebook in 2017 to facilitate interoperability between different deep learning frameworks, such as TensorFlow, PyTorch, and Caffe2. ONNX provides a standardized way to represent deep learning models, making it easier to transfer models between different frameworks and deploy them \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Model** & **Parameters** & **Capacity** & **Map** \\ \hline Standard model & 52.3 M & 80.1 G & 85.0\% \\ CKD small model & 8.9 M & 14.8 G & 84.2\% \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Distillation experimental results. Figure 7: General framework of knowledge distillation. on various hardware platforms. ONNX models are represented as computation graphs, composed of a set of nodes representing mathematical operations and tensors representing inputs, outputs, and intermediate values of the computation. The ONNX format supports a wide range of deep learning models, including Convolutional Neural Networks (CNNs), Recurrent Neural Networks (RNNs), and Transformer models. The ONNX ecosystem includes tools for converting models from different frameworks to the ONNX format, optimizing and quantizing ONNX models for deployment on different hardware platforms, and running ONNX models on devices like CPUs, GPUs, and specialized accelerators. It provides a standardized, interoperable format for deep learning models, improving portability, performance, and ease of deployment across a range of hardware platforms. TensorRT is a deep learning inference optimizer and runtime library developed by NVIDIA [58]. It aims to maximize the performance of deep learning inference on NVIDIA GPUs by optimizing the computations required for inference and reducing the model's memory footprint. The key features of TensorRT include graph optimization, dynamic precision calibration to improve accuracy while minimizing computational and memory overhead, layer fusion to reduce the number of computations required for inference, and support for distributed inference across multiple GPUs to scale performance. TensorRT can be used in conjunction with other NVIDIA tools such as CUDA, cuDNN, and NCCL to maximize the performance of deep learning workloads on NVIDIA GPUs [59]. Given the performance considerations of edge computing devices, native PyTorch models with Python interfaces may not meet real-time requirements. Therefore, this experiment involves converting native PyTorch models into the ONNX intermediate format and then using the TensorRT toolbox to convert the ONNX model into a TensorRT model, followed by inference using a C++ interface. Model quantization is a process of converting floating-point parameters and computations in deep learning models into lower precision (typically integers) to reduce memory usage and computational load, thus accelerating the inference process of the model. Model quantization is typically divided into two types: weight quantization and activation quantization. Weight quantization involves converting floating-point model weights into lower precision integer weights. This can significantly reduce the memory footprint of the weights and accelerate matrix multiplication operations. Common weight quantization methods include symmetric quantization and asymmetric quantization. Activation quantization involves converting floating-point activation values in the model into lower precision integer activations. This reduces the memory footprint of activation values and speeds up their calculations and propagation. Activation quantization often requires retraining or fine-tuning the model to maintain its accuracy. Model quantization can greatly reduce model memory and computation while preserving model accuracy, making it easier to deploy deep learning models on devices with limited memory and computational resources, such as mobile and edge devices.