YoloV8.Gpu
5.0.3
See the version list below for details.
dotnet add package YoloV8.Gpu --version 5.0.3
NuGet\Install-Package YoloV8.Gpu -Version 5.0.3
<PackageReference Include="YoloV8.Gpu" Version="5.0.3" />
paket add YoloV8.Gpu --version 5.0.3
#r "nuget: YoloV8.Gpu, 5.0.3"
// Install YoloV8.Gpu as a Cake Addin #addin nuget:?package=YoloV8.Gpu&version=5.0.3 // Install YoloV8.Gpu as a Cake Tool #tool nuget:?package=YoloV8.Gpu&version=5.0.3
YoloV8
Integrate YOLOv8 into your C# project for a variety of real-time tasks including object detection, instance segmentation, pose estimation and more, using ONNX Runtime.
Features
- YOLOv8 Tasks 🌟 Support for all YOLOv8 tasks (Detect, Segment, Classify, Pose and OBB)
- High Performance 🚀 Various techniques and use of .NET features to maximize performance
- Reduced Memory Usage 🧠By reusing memory blocks and reducing the pressure on the GC
- Plotting Options 📊 Plotting operations for preview of model results on the target image.
- YOLOv10 Support 🔧 Includes additional support for YOLOv10
Installation
This project provides two NuGet packages:
- For CPU inference, use the package: YoloV8 (includes the Microsoft.ML.OnnxRuntime package)
- For GPU inference, use the package: YoloV8.Gpu (includes the Microsoft.ML.OnnxRuntime.Gpu package)
Usage
1. Export model to ONNX format:
For convert the pre-trained PyTorch model to ONNX format, run the following Python code:
from ultralytics import YOLO
# Load a model
model = YOLO('path/to/best.pt')
# Export the model to ONNX format
model.export(format='onnx')
2. Load the ONNX model with C#:
Add the YoloV8
(or YoloV8.Gpu
) package to your project:
dotnet add package YoloV8
Use the following C# code to load the model and run basic prediction:
using Compunet.YoloV8;
// Load the YOLOv8 predictor
using var predictor = new YoloPredictor("path/to/model.onnx");
// Run model
var result = predictor.Detect("path/to/image.jpg");
// or
var result = await predictor.DetectAsync("path/to/image.jpg");
// Write result summary to terminal
Console.WriteLine(result);
Plotting
You can to plot the target image for preview the model results, this code demonstrates how to run a inference, plot the results on image and save to file:
using Compunet.YoloV8;
using Compunet.YoloV8.Plotting;
using SixLabors.ImageSharp;
// Load the YOLOv8 predictor
using var predictor = new YoloPredictor("path/to/model.onnx");
// Load the target image
using var image = Image.Load("path/to/image");
// Run model
var result = await predictor.PoseAsync(image);
// Create plotted image from model results
using var plotted = await result.PlotImageAsync(image);
// Write the plotted image to file
plotted.Save("./pose_demo.jpg");
You can also predict and save to file in one operation:
using Compunet.YoloV8;
using Compunet.YoloV8.Plotting;
using SixLabors.ImageSharp;
// Load the YOLOv8 predictor
using var predictor = new YoloPredictor("path/to/model.onnx");
// Run model, plot predictions and write to file
predictor.PredictAndSaveAsync("path/to/image");
Example Images:
Detection:
Pose:
Segmentation:
License
AGPL-3.0 License
Important Note: This project depends on ImageSharp, you should check the license details here
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Clipper2 (>= 1.4.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.ML.OnnxRuntime.Gpu (>= 1.19.1)
- SixLabors.ImageSharp (>= 3.1.5)
- SixLabors.ImageSharp.Drawing (>= 2.1.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
5.3.0 | 116 | 10/30/2024 | |
5.2.0 | 426 | 10/16/2024 | |
5.1.1 | 105 | 10/15/2024 | |
5.1.0 | 196 | 10/8/2024 | |
5.0.4 | 160 | 9/29/2024 | |
5.0.3 | 102 | 9/26/2024 | |
5.0.2 | 101 | 9/24/2024 | |
5.0.1 | 233 | 9/15/2024 | |
5.0.0 | 115 | 9/15/2024 | |
4.2.0 | 284 | 8/23/2024 | |
4.1.7 | 659 | 6/27/2024 | |
4.1.6 | 269 | 6/10/2024 | |
4.1.5 | 672 | 4/14/2024 | |
4.1.4 | 140 | 4/14/2024 | |
4.0.0 | 510 | 3/6/2024 | |
3.1.1 | 386 | 2/4/2024 | |
3.1.0 | 183 | 1/29/2024 | |
3.0.0 | 2,089 | 11/27/2023 | |
2.0.1 | 1,183 | 10/10/2023 | |
2.0.0 | 260 | 9/27/2023 | |
1.6.0 | 254 | 9/21/2023 | |
1.5.0 | 200 | 9/15/2023 | |
1.4.0 | 245 | 9/8/2023 |