YoloDotNet 3.1.1

dotnet add package YoloDotNet --version 3.1.1
                    
NuGet\Install-Package YoloDotNet -Version 3.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="YoloDotNet" Version="3.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="YoloDotNet" Version="3.1.1" />
                    
Directory.Packages.props
<PackageReference Include="YoloDotNet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add YoloDotNet --version 3.1.1
                    
#r "nuget: YoloDotNet, 3.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package YoloDotNet@3.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=YoloDotNet&version=3.1.1
                    
Install as a Cake Addin
#tool nuget:?package=YoloDotNet&version=3.1.1
                    
Install as a Cake Tool

<img src="https://github.com/NickSwardh/YoloDotNet/assets/35733515/994287a9-556c-495f-8acf-1acae8d64ac0" height=24> YoloDotNet v3.1.1

YoloDotNet is a blazing-fast, fully featured C# library for real-time object detection, OBB, segmentation, classification, pose estimation — and tracking — using YOLOv5u–v12, YOLO-World, and YOLO-E models.

Built on .NET 8, powered by ONNX Runtime, and supercharged with GPU acceleration via CUDA — or break the speed barrier entirely with NVIDIA TensorRT support, unleashing maximum inference performance through hardware-level optimization. YoloDotNet delivers exceptional speed and flexibility for both image and video processing, with full support for live streams, frame skipping, and custom visualizations.

Supported Versions:

Yolov5u Yolov8 Yolov9 Yolov10 Yolov11 Yolov12 Yolo-World YoloE

Supported Tasks:

Classification Object Detection OBB Detection Segmentation Pose Estimation
<img src="https://user-images.githubusercontent.com/35733515/297393507-c8539bff-0a71-48be-b316-f2611c3836a3.jpg" width=300> <img src="https://user-images.githubusercontent.com/35733515/273405301-626b3c97-fdc6-47b8-bfaf-c3a7701721da.jpg" width=300> <img src="https://github.com/NickSwardh/YoloDotNet/assets/35733515/d15c5b3e-18c7-4c2c-9a8d-1d03fb98dd3c" width=300> <img src="https://github.com/NickSwardh/YoloDotNet/assets/35733515/3ae97613-46f7-46de-8c5d-e9240f1078e6" width=300> <img src="https://github.com/NickSwardh/YoloDotNet/assets/35733515/b7abeaed-5c00-4462-bd19-c2b77fe86260" width=300>
<sub>image from pexels.com</sub> <sub>image from pexels.com</sub> <sub>image from pexels.com</sub> <sub>image from pexels.com</sub> <sub>image from pexels.com</sub>

Supported Execution Providers

ONNX Runtime CPU CUDA TensorRT

Nuget

> dotnet add package YoloDotNet

🚀 YoloDotNet v3.1.1 - Full-Throttle TensorRT Inference!

Say hello to TensorRT support in YoloDotNet!

Version 3.1.1 bolts on NVIDIA's high-performance inference engine to break the speed barrier and unleash maximum throughput on supported GPUs.

✨ Highlights:

New TensorRtExecutionProvider — Configure GPU ID, precision (FP32, FP16, or turbocharged INT8), builder optimizations, and engine cache handling — all from your C# code. Give the TensorRT demo project a spin to get you started in no time. No pun intended 😉

Hardware-Level Optimization — TensorRT builds a custom engine just for your machine, tailored to your GPU and inference settings. That means raw, uncompromising speed.

Engine Cache Support — Save and reuse compiled TensorRT engines between runs to skip the long optimization stage.

INT8 Calibration Cache — Drop your precision down to INT8 for maximum speed and minimal accuracy loss. Generate the .cache file once, reuse it forever.

Fully Configurable — Engine cache path, file prefix, calibration cache file location — it's all in your control.

💡 Heads up:
On the first run, TensorRT may take a couple of minutes to compile and optimize your model. But once the engine is built and cached, it’s warp-speed from there on out.

Segmentation upgraded — Now leaner with 85% less memory, and quicker than ever—8% CPU boost and 28% GPU turbocharged!

OrtEnv fix in 3.1.1 — Reusing or recreating YoloDotNet objects? No more "OrtEnv singleton instance already exists" drama.

Bottom Line? Real-time YOLO inference at breakneck speed! Check the Benchmarks.

Previously in v3.0

YoloDotNet 3.0 introduced massive performance upgrades and smarter APIs:

  • Up to 70% faster inference and 92% less memory usage, depending on task and hardware
  • Support for YOLOv5u, YOLO-E, and ONNX byte array loading
  • Direct inference on SkiaSharp types (SKBitmap, SKImage)
  • Improved video handling and built-in SORT tracking
  • Custom fonts, class colors, and smarter drawing tools
  • Dependency updates: ONNX Runtime 1.22.1, SkiaSharp 3.119.0

Install CUDA & TensorRT (optional)

CUDA - Installation Steps

  1. Download and install the following from NVIDIA’s official sites:

  2. Locate the folder containing the cuDNN DLL files, typically:

    C:\Program Files\NVIDIA\CUDNN\v9.x\bin\v12.x
    

    (Replace v9.x and v12.x with your installed versions.)

  3. Copy the full path of this folder from the File Explorer address bar.

  4. Add this path to your Windows system environment variables:

    • Search for Edit the system environment variables in the Start menu and open it.
    • Click on Environment Variables
    • Under System Variables find and select Path, then click Edit
    • Click New and paste the copied cuDNN folder path.
    • Click OK to save and close all dialogs.
  5. Important: Restart any open programs or reboot your computer to ensure Windows recognizes the new environment variable.

TensorRT - Installation Steps

  1. Download TensorRT from NVIDIA’s official site:
    https://developer.nvidia.com/tensorrt

  2. Click the Download Now button (you may need to log in with your NVIDIA account).

  3. Select TensorRT 10 and accept the terms and conditions.

  4. Choose the latest release of TensorRT 10.

  5. Download the Windows ZIP package for CUDA 12.x.

  6. Once downloaded, unzip the TensorRT archive to a folder on your system.

  7. Locate the lib folder inside the extracted TensorRT directory.

  8. Copy the full path of this lib folder.

  9. Add this folder path to your system’s PATH environment variable, following the same process as with CUDA (see CUDA installation step #4).

  10. Installation complete! Restart any open programs or reboot your system to ensure the environment variables take effect.

💡 Tip: Curious about how TensorRT works in practice? Check out the TensorRT Demo project and its README for a hands-on example and setup instructions.

Export Yolo models to ONNX with opset=17

All models — including your own custom models — must be exported to the ONNX format with opset 17 for best performance.
For more information on how to export yolo-models to onnx read this guide.

Note: Dynamic models are not supported.

The ONNX-models included in this repo for test and demo purposes are from Ultralytics s-series (small). https://docs.ultralytics.com/models.

🚀 Quick Start: Dive into the Demos

Can’t wait to see YoloDotNet in action? The demo projects are the fastest way to get started and explore everything this library can do.

Each demo showcases one of the supported tasks:

  • Classification – What is this thing?
  • Object Detection – What are all these things?
  • OBB Detection – Rotated objects? No problem.
  • Segmentation – Color between the lines… automatically.
  • Pose Estimation – Find the limbs, strike a pose!

Oh, and it doesn’t stop there — there’s a demo for real-time video inference too! Whether you’re analyzing local video files or streaming live, the demos have you covered.

Each demo is packed with inline comments to help you understand how everything works under the hood. From model setup and preprocessing to video streaming and result rendering — it's all there.

Pro tip: For detailed configuration options and usage guidance, check out the comments in the demo source files. That’s where the real magic happens.

Open the YoloDotNet.Demo projects, build, run, and start detecting at full speed. ✨

Bare Minimum — Get Up and Running in a Snap

Sometimes you just want to see the magic happen without the bells and whistles. Here’s the absolute simplest way to load a model, run inference on an image, and get your detected objects:

using SkiaSharp;
using YoloDotNet;
using YoloDotNet.Enums;
using YoloDotNet.Models;
using YoloDotNet.Extensions;

public class Program
{
    static void Main(string[] args)
    {
        // Fire it up! Create an instance of YoloDotNet and reuse it across your app's lifetime.
        // Prefer the 'using' pattern for automatic cleanup if you're done after a single run.
        var yolo = new Yolo(new YoloOptions
        {
            OnnxModel = "model.onnx",
            // Path to model

            // OnnxModelBytes = modelBytes
            // Load model in byte[] format (e.g. for embedded scenarios)

            ImageResize = ImageResize.Proportional,
            // Match this to how your training data was preprocessed.
            // Proportional = keeps aspect ratio (e.g. letterboxing)
            // Stretched = fits input size directly (e.g. distortion OK)

            ExecutionProvider = new CudaExecutionProvider(GpuId: 0, PrimeGpu: true),
            // Sets the execution backend.
            // Available options:
            //   - CpuExecutionProvider         → CPU-only (no GPU required)
            //   - CudaExecutionProvider        → GPU via CUDA (NVIDIA required)
            //   - TensorRtExecutionProvider    → GPU via NVIDIA TensorRT for maximum performance
        });

        // Display model metadata
        Console.WriteLine($"Model Type: {yolo.ModelInfo}");

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

        // Run object detection
        var results = yolo.RunObjectDetection(image, confidence: 0.20, iou: 0.7);

        image.Draw(results);         // Draw boxes and labels
        image.Save("result.jpg");    // Save to file – boom, done!

        yolo?.Dispose();             // Cleanup if not using 'using'
    }
}

That’s it! No fuss, just fast and easy detection.

Of course, the real power lies in customizing the pipeline, streaming videos, or tweaking models… but this snippet gets you started in seconds.

Want more? Dive into the demos and source code for full examples, from video streams to segmentation and pose estimation.

Make It Yours – Customize the Look

Want to give your detections a personal touch? Go ahead! If you're drawing bounding boxes on-screen, there’s full flexibility to style them just the way you like:

  • Custom Colors – Use the built-in class-specific colors or define your own for every bounding box.
  • Font Style & Size – Choose your favorite font, set the size, and even change the color for the labels.
  • Custom Fonts – Yep, you can load your own font files to give your overlay a totally unique feel.

If that's not enough, check out the extension methods in the main YoloDotNet repository — a solid boilerplate for building even deeper customizations tailored exactly to your needs.

For practical examples on drawing and customization, don’t forget to peek at the demo project source code too!

Support YoloDotNet

YoloDotNet is the result of countless hours of development, testing, and continuous improvement — all offered freely to the community.

If you’ve found this project helpful, consider supporting its development. Your contribution helps cover the time and resources needed to keep the project maintained, updated, and freely available to everyone.

Support the project:

GitHub Sponsors PayPal

Whether it's a donation, sponsorship, or just spreading the word — every bit of support fuels the journey. Thank you for helping YoloDotNet grow! ❤️

References & Acknowledgements

https://github.com/ultralytics/ultralytics
https://github.com/sstainba/Yolov8.Net
https://github.com/mentalstack/yolov5-net

License

YoloDotNet is © 2023–2025 Niklas Swärd (GitHub)
Licensed under the GNU General Public License v3.0 or later.

License: GPL v3 or later
See the LICENSE file for the full license text.

This software is provided “as is”, without warranty of any kind.
The author is not liable for any damages arising from its use.

Product 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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on YoloDotNet:

Package Downloads
VL.YoloDotNet

YoloDotNet for VL

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on YoloDotNet:

Repository Stars
Webreaper/Damselfly
Damselfly is a server-based Photograph Management app. The goal of Damselfly is to index an extremely large collection of images, and allow easy search and retrieval of those images, using metadata such as the IPTC keyword tags, as well as the folder and file names. Damselfly includes support for object/face detection.
Version Downloads Last Updated
3.1.1 115 7/31/2025
3.1.0 89 7/30/2025
3.0.0 289 7/15/2025
2.3.0 4,488 3/15/2025
2.2.0 8,557 10/13/2024
2.1.0 1,017 10/6/2024
2.0.0 3,247 7/12/2024
1.7.0 1,062 5/2/2024
1.6.0 553 4/4/2024
1.5.0 291 3/14/2024
1.4.0 1,456 3/6/2024
1.3.0 590 2/25/2024
1.2.0 285 2/5/2024
1.1.0 246 1/17/2024
1.0.0 388 12/8/2023

Say hello to YoloDotNet 3.1.1, packed with blazing fast inference thanks to brand-new TensorRT support! Now you can harness NVIDIA’s TensorRT execution provider to supercharge your YOLO models with ultra-low latency and killer throughput — perfect for real-time and edge deployments.

TensorRT Integration:
Enjoy powerful CUDA-accelerated inference that pushes your models to new heights with minimal fuss.

Segmentation Improvements:
Segmentation inference just got leaner and meaner — CPU inference is up to 11% faster, GPU up to 28% quicker, with memory usage slashed by a massive 85%. Your vision pipelines are now faster, lighter, and more reliable.

OrtEnv fix in 3.1.1:
Reusing or recreating YoloDotNet objects? No more "OrtEnv singleton instance already exists" drama.