Skip to content

YoloDotNet - A C# .NET 8.0 project for Classification, Object Detection, OBB Detection, Segmentation and Pose Estimation in both images and live video streams.

License

Notifications You must be signed in to change notification settings

NickSwardh/YoloDotNet

Repository files navigation

YoloDotNet πŸš€

Blazing-fast, production-ready YOLO inference for .NET

YoloDotNet is a fully featured C# library for real-time computer vision using YOLOv5u–v12, YOLO-World, and YOLO-E models.
Built on .NET 8 and ONNX Runtime, it delivers high-performance, predictable inference on Windows, Linux, and macOS β€” with explicit control over execution, memory, and preprocessing.

No Python. No magic. Just fast, deterministic YOLO β€” done properly for .NET.

⭐ Why YoloDotNet?

YoloDotNet is designed for developers who need:

  • βœ… Pure .NET β€” no Python runtime, no scripts
  • βœ… Real performance β€” CPU, CUDA / TensorRT, OpenVINO, CoreML
  • βœ… Explicit configuration β€” predictable accuracy and memory usage
  • βœ… Production readiness β€” engine caching, long-running stability
  • βœ… Large image support β€” not limited to toy resolutions
  • βœ… Multiple vision tasks β€” detection, OBB, segmentation, pose, classification

Ideal for desktop apps, backend services, and real-time vision pipelines that require deterministic behavior and full control.

πŸ†• What’s New v4

  • Modular execution providers (CPU, CUDA/TensorRT, OpenVINO, CoreML)
  • New OpenVINO and CoreML providers
  • Cleaner dependency graph
  • Improved GPU behavior and predictability
  • Grayscale ONNX model support

πŸ“– Full release history: CHANGELOG.md

πŸš€ Quick Start

1️⃣ Install the core package

dotnet add package YoloDotNet

2️⃣ Install exactly one execution provider

# CPU (recommended starting point)
dotnet add package YoloDotNet.ExecutionProvider.Cpu

# Hardware-accelerated execution (choose one)
dotnet add package YoloDotNet.ExecutionProvider.Cuda
dotnet add package YoloDotNet.ExecutionProvider.OpenVino
dotnet add package YoloDotNet.ExecutionProvider.CoreML

πŸ’‘ Note: The CUDA execution provider includes optional TensorRT acceleration.
No separate TensorRT package is required.

3️⃣ Run object detection

using SkiaSharp;
using YoloDotNet;
using YoloDotNet.ExecutionProvider.Cpu;

using var yolo = new Yolo(new YoloOptions
{
    ExecutionProvider = new CpuExecutionProvider("model.onnx")
});

using var image = SKBitmap.Decode("image.jpg");

var results = yolo.RunObjectDetection(image, confidence: 0.25, iou: 0.7);

image.Draw(results);
image.Save("result.jpg");

You’re now running YOLO inference in pure C#.

πŸ’‘ Important: Accuracy Depends on Configuration

YOLO inference accuracy is not automatic.

Preprocessing settings such as image resize mode, sampling method, and confidence/IoU thresholds must match how the model was trained.
These settings directly control the accuracy–performance tradeoff and should be treated as part of the model itself.

πŸ“– Before tuning models or comparing results, read:
πŸ‘‰ Accuracy & Configuration Guide

Supported Tasks

Classification Object Detection OBB Detection Segmentation Pose Estimation
pexels.com pexels.com pexels.com pexels.com pexels.com

πŸ“ Demos

Hands-on examples are available in the demo folder:

πŸ‘‰ Browse the demo projects

Includes image inference, video streams, GPU acceleration, segmentation, and large-image workflows.

Execution Providers

Provider Windows Linux macOS Documentation
CPU βœ… βœ… βœ… CPU README
CUDA / TensorRT βœ… βœ… ❌ CUDA README
OpenVINO βœ… βœ… ❌ OpenVINO README
CoreML ❌ ❌ βœ… CoreML README

ℹ️ Only one execution provider package may be referenced.
Mixing providers will cause native runtime conflicts.

⚑ Performance Characteristics

YoloDotNet focuses on stable, low-overhead inference where runtime cost is dominated by the execution provider and model.

πŸ“Š Benchmarks: /test/YoloDotNet.Benchmarks

  • Stable latency after warm-up
  • Clean scaling from CPU β†’ GPU β†’ TensorRT
  • Predictable allocation behavior
  • Suitable for real-time and long-running services

πŸš€ Modular Execution Providers

  • Core package is provider-agnostic
  • Execution providers are separate NuGet packages
  • Native ONNX Runtime dependencies are isolated

Why this matters: fewer conflicts, predictable deployment, and production-safe behavior.

Support YoloDotNet

⭐ Star the repo
πŸ’¬ Share feedback
🀝 Sponsor development

GitHub Sponsors
PayPal

License

Β© 2023–2025 Niklas SwΓ€rd
Licensed under GPL v3.0 or later.

See LICENSE for full details.

About

YoloDotNet - A C# .NET 8.0 project for Classification, Object Detection, OBB Detection, Segmentation and Pose Estimation in both images and live video streams.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages