Skip to content

Use YOLOv8 in your C# project, for object detection, pose estimation and more, in a simple and intuitive way, using ONNX Runtime

License

Notifications You must be signed in to change notification settings

RVShershnev/YoloV8

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YOLOv8

Use YOLOv8 in real-time, for object detection, instance segmentation, pose estimation and image classification, via ONNX Runtime

Use

Export from PyTorch

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', opset=15)

Note: Pay attention to specify opset=15 because the ONNX Runtime currently only supports up to Opset 15.

Use in C# with ONNX Runtime

using var predictor = new YoloV8(model);

var result = predictor.Detect("path/to/image");

Console.WriteLine(result);

Plotting

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")

Examples:

Detection:

detect_demo!

Pose:

pose_demo!

Segmentation:

seg_demo!

License

MIT License

About

Use YOLOv8 in your C# project, for object detection, pose estimation and more, in a simple and intuitive way, using ONNX Runtime

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%