Files
HSAP/algorithms/dms_yolo/code.embedded.bak/examples/YOLOv8-ONNXRuntime
Chengfang Lu e72bc061c5 feat: HSAP platform v2 — modular navigation, quality review, audit log, world model simulation
Major changes:
- New frontend (platform/web/): Vite + React 18 + TypeScript + Tailwind
- 4-module navigation: 数据送标 / 模型管理 / 车队管理 / 系统管理
- Data catalog with charts (DMS/ADAS/Lane 3-tab view)
- Quality review workflow (标注质检): Good/Fine/Bad scoring with auto-advance
- Audit enhancements: batch operations, rejection categories, Feishu notifications
- Operation audit log (操作日志)
- World model simulation studio (仿真工坊)
- Dataset version management with snapshots and diff
- ADAS 7-class dataset integration (138K images organized + compressed)
- User management with Feishu integration and pagination
- CRUD/search/filter on all pages, card layout redesign
- PIL-optimized image overlay rendering
- Auto-snapshot on build, in_review workflow stage
- Removed embedded algorithm code (now in workspace)
2026-06-03 11:40:21 +08:00
..

YOLOv8 - ONNX Runtime

This repository provides an example implementation for running Ultralytics YOLOv8 models using the ONNX Runtime. This allows for efficient inference across various hardware platforms supporting the ONNX format.

⚙️ Installation

To get started, you'll need Python installed. Then, install the necessary dependencies.

Installing Required Dependencies

Clone the repository and install the packages listed in the requirements.txt file using pip:

git clone https://github.com/ultralytics/ultralytics.git
cd ultralytics/examples/YOLOv8-ONNXRuntime
pip install -r requirements.txt

Installing ONNX Runtime Backend

You need to choose the appropriate ONNX Runtime package based on your hardware.

GPU Acceleration (NVIDIA)

If you have an NVIDIA GPU and want to leverage CUDA for faster inference, install the onnxruntime-gpu package. Ensure you have the correct NVIDIA drivers and CUDA toolkit installed. Refer to the official ONNX Runtime GPU documentation for compatibility details.

pip install onnxruntime-gpu

CPU Only

If you don't have a compatible NVIDIA GPU or prefer CPU-based inference, install the standard onnxruntime package. Check the ONNX Runtime installation guide for more options.

pip install onnxruntime

🚀 Usage

Once the dependencies and the appropriate ONNX Runtime backend are installed, you can perform inference using the provided Python script.

Exporting Your Model

Before running inference, you need a YOLOv8 model in the ONNX format (.onnx). You can export your trained Ultralytics YOLOv8 models using the Ultralytics CLI or Python SDK. See the Ultralytics export documentation for detailed instructions.

Example export command:

yolo export model=yolov8n.pt format=onnx # Export yolov8n model to ONNX

Running Inference

Execute the main.py script with the path to your ONNX model and input image. You can also adjust the confidence and Intersection over Union (IoU) thresholds for object detection.

python main.py --model yolov8n.onnx --img image.jpg --conf-thres 0.5 --iou-thres 0.5
  • --model: Path to the YOLOv8 ONNX model file (e.g., yolov8n.onnx).
  • --img: Path to the input image (e.g., image.jpg).
  • --conf-thres: Confidence threshold for filtering detections. Only detections with a score higher than this value will be kept. Learn more about thresholds in the performance metrics guide.
  • --iou-thres: IoU threshold for Non-Maximum Suppression (NMS). Boxes with IoU greater than this threshold will be suppressed. See the NMS glossary entry for details.

The script will process the image, perform object detection, draw bounding boxes on the detected objects, and save the output image as output.jpg.

Contributing

Contributions to enhance this example or add new features are welcome! Please refer to the main Ultralytics repository for contribution guidelines. If you encounter issues or have suggestions, feel free to open an issue on the ONNX Runtime GitHub or the Ultralytics repository.