Skip to content

asus4/onnxruntime-unity

Repository files navigation

ONNX Runtime Plugin for Unity

upm

Pre-built ONNX Runtime libraries for Unity.

https://github.com/asus4/onnxruntime-unity-examples

Yolox

2023-12-25-onnx-yolox.mp4

NanoSAM

2024-02-16-nanosam.mp4

Tested environment

  • Unity: 2022.3.20f1 (LTS)
  • ONNX Runtime: 1.19.2
  • ONNX Runtime Extensions: 0.12.0

Execution Providers & Extensions

Execution Providers are hardware acceleration libraries for each platform. See official docs for more details.

Platform CPU CoreML NNAPI CUDA TensorRT DirectML XNNPACK
macOS
iOS 🚧
Android 🚧
Windows 🚧 🚧
Linux 🚧 🚧

ONNX Runtime Extensions are a set of pre/post-processing.

Platform Extensions
macOS 🚧
iOS 🚧
Android 🚧
Windows 🚧
Linux 🚧

✅ : Supported in Unity Core library
🚧 : Experimental Preview

How to Install

Pre-built libraries are available on NPM. Add the following scopedRegistries and dependencies in Packages/manifest.json.

  "scopedRegistries": [
    {
      "name": "NPM",
      "url": "https://registry.npmjs.com",
      "scopes": [
        "com.github.asus4"
      ]
    }
  ]
  "dependencies": {
    "com.github.asus4.onnxruntime": "0.2.6",
    "com.github.asus4.onnxruntime.unity": "0.2.6",
    "com.github.asus4.onnxruntime.win-x64-gpu": "0.2.6",
    "com.github.asus4.onnxruntime-extensions": "0.2.6",
    ... other dependencies
  }

What is included in each package

  • com.github.asus4.onnxruntime : Core library
    • CPU provider for all platforms
    • GPU provider for iOS, Android, macOS and Windows(only DirectML)
  • com.github.asus4.onnxruntime.unity : (Optional) Utilities for Unity
  • com.github.asus4.onnxruntime.win-x64-gpu : (Optional) GPU provider for Windows
  • com.github.asus4.onnxruntime.linux-x64-gpu : (Optional) GPU provider for Linux
  • com.github.asus4.onnxruntime-extensions : (Optional) ONNX Runtime Extensions