Installation¶
Requirements¶
- Python 3.10+
- (Optional) CUDA-capable GPU for accelerated inference
Using uv (Recommended)¶
uv is the recommended package manager. Install it first, then:
onnxruntime-gpu is a base dependency — GPU acceleration is enabled by default with uv sync. There is no separate --extra gpu.
# Default install (GPU via onnxruntime-gpu)
uv sync
# With model export support
uv sync --extra export
# With test support
uv sync --extra test
# With documentation tools
uv sync --extra docs
CPU-only override
If you don't have a GPU, override onnxruntime-gpu after syncing:
Using pip¶
From the repository root:
With optional extras:
pip install ".[export]" # Model export from .pth checkpoints
pip install ".[test]" # Accuracy testing with pytest
pip install ".[docs]" # Build documentation locally
CPU-only installation
If you don't have a GPU and onnxruntime-gpu fails to install, replace it with the CPU version:
C++ Build Requirements¶
The C++ implementation requires:
| Dependency | Version | Notes |
|---|---|---|
| CMake | ≥ 3.15 | Build system |
| OpenCV | ≥ 4.x | Image processing |
| ONNX Runtime C++ | ≥ 1.17 | Inference engine |
Build¶
Tip
Set ONNXRUNTIME_ROOT_DIR to the root of your ONNX Runtime C++ installation (the
folder that contains include/ and lib/). The default search path is /opt/onnxruntime.
Downloading Models¶
Pre-converted ONNX models are available from:
- Hugging Face: Download manually.
- Automatic download: The benchmark script will download models automatically if none are found.
Place model files in the models/ directory (any subfolder is OK).