Glossary

ONNX (Open Neural Network Exchange)

Discover how ONNX enhances AI model portability and interoperability, enabling seamless deployment of Ultralytics YOLO models across diverse platforms.

Train YOLO models simply
with Ultralytics HUB

Learn more

In the realm of artificial intelligence and machine learning, interoperability is key to leveraging the best tools and deploying models across diverse environments. ONNX (Open Neural Network Exchange) is an open format built to represent machine learning models, ensuring that AI developers are not locked into a single framework and can streamline the process of moving models between different tools. It provides a unified representation for models, regardless of the framework used for training, making it simpler to deploy these models in various inference engines, hardware platforms, and environments.

Relevance of ONNX

The primary relevance of ONNX lies in its ability to promote portability and interoperability in the AI ecosystem. By defining a common set of operators and a standard format for machine learning models, ONNX allows models trained in frameworks like PyTorch or TensorFlow to be easily transferred and run using different inference engines such as TensorRT or OpenVINO. This is particularly beneficial for developers using Ultralytics YOLO models, as ONNX export simplifies model deployment across various platforms, from cloud servers to edge devices. Ultralytics facilitates exporting YOLOv8 models to ONNX format, allowing users to leverage optimized inference engines for improved performance and faster real-time inference.

Applications of ONNX

ONNX's cross-framework compatibility makes it valuable in numerous AI applications. Two concrete examples are:

  • Edge Deployment: Deploying AI models on edge devices often requires optimized performance and compatibility with specific hardware. ONNX allows developers to train a model using a high-level framework like PyTorch and then export it to ONNX to run efficiently on edge devices using inference engines like TensorRT on NVIDIA Jetson or OpenVINO on Intel devices. This ensures that applications like smart cameras or robotics can perform object detection tasks with Ultralytics YOLO models effectively in real-time.
  • Cross-Platform Inference: In scenarios where AI solutions need to operate across different operating systems and hardware, ONNX provides a consistent model format. For instance, a medical image analysis application might be trained on powerful servers but needs to perform inference on lower-powered machines in hospitals or clinics. ONNX enables seamless transition and execution of the same model across diverse environments, ensuring consistent and reliable performance regardless of the deployment platform.

Related Concepts

Understanding ONNX also involves recognizing related concepts that play a role in model deployment and optimization:

  • Inference Engines: These are software libraries that optimize and execute machine learning models on specific hardware. ONNX models are often used with inference engines like TensorRT and OpenVINO to accelerate inference speed and efficiency.
  • Model Export: The process of converting a trained model from its original framework's format (e.g., PyTorch .pt files) into the ONNX format. Ultralytics provides straightforward tools for exporting YOLO models to ONNX and other formats.
  • Framework Interoperability: ONNX addresses the challenge of framework lock-in by allowing models to be used across different frameworks. While each framework has its strengths, ONNX ensures that developers can choose the best tool for each stage of the AI lifecycle without compatibility barriers.

By adopting ONNX, developers can significantly simplify their AI workflows, reduce deployment complexities, and ensure their models are versatile and performant across a wide range of applications and platforms.

Read all