Use YOLOv8 in real-time, for object detection, instance segmentation, pose estimation and image classification, via ONNX Runtime
Run the following Python code to export the model to ONNX format:
from ultralytics import YOLO
# Load a model
model = YOLO('path/to/model')
# export the model to ONNX format
model.export(format='onnx')
using var predictor = new YoloV8(model);
var result = predictor.Detect("path/to/image");
Console.WriteLine(result);
You can use the following code to predict and plot a image, and save to file:
var image = "path/to/image";
using var predictor = new YoloV8("path/to/model");
var result = predictor.Pose(image);
using var origin = Image.Load<Rgb24>(image);
using var ploted = result.PlotImage(origin);
ploted.Save("./pose_demo.jpg")
MIT License