Yolov5Net 1.1.0

dotnet add package Yolov5Net --version 1.1.0                
NuGet\Install-Package Yolov5Net -Version 1.1.0                
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="Yolov5Net" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Yolov5Net --version 1.1.0                
#r "nuget: Yolov5Net, 1.1.0"                
#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.
// Install Yolov5Net as a Cake Addin
#addin nuget:?package=Yolov5Net&version=1.1.0

// Install Yolov5Net as a Cake Tool
#tool nuget:?package=Yolov5Net&version=1.1.0                

Yolov5Net

YOLOv5 object detection with ML.NET, ONNX

example

Installation

Run this line from Package Manager Console:

Install-Package Yolov5Net -Version 1.1.0

For CPU usage run this line from Package Manager Console:

Install-Package Microsoft.ML.OnnxRuntime -Version 1.14.1

For GPU usage run this line from Package Manager Console:

Install-Package Microsoft.ML.OnnxRuntime.Gpu -Version 1.14.1

CPU and GPU packages can't be installed together.

Usage

Yolov5Net contains two COCO pre-defined models: YoloCocoP5Model, YoloCocoP6Model.

If you have custom trained model, then inherit from YoloModel and override all the required properties and methods. See YoloCocoP5Model or YoloCocoP6Model implementation to get know how to wrap your own model.

using var image = await Image.LoadAsync<Rgba32>("Assets/test.jpg");
{
    using var scorer = new YoloScorer<YoloCocoP5Model>("Assets/Weights/yolov5n.onnx");
    {
        var predictions = scorer.Predict(image);

        var font = new Font(new FontCollection().Add("C:/Windows/Fonts/consola.ttf"), 16);

        foreach (var prediction in predictions) // draw predictions
        {
            var score = Math.Round(prediction.Score, 2);

            var (x, y) = (prediction.Rectangle.Left - 3, prediction.Rectangle.Top - 23);

            image.Mutate(a => a.DrawPolygon(new Pen(prediction.Label.Color, 1),
                new PointF(prediction.Rectangle.Left, prediction.Rectangle.Top),
                new PointF(prediction.Rectangle.Right, prediction.Rectangle.Top),
                new PointF(prediction.Rectangle.Right, prediction.Rectangle.Bottom),
                new PointF(prediction.Rectangle.Left, prediction.Rectangle.Bottom)
            ));

            image.Mutate(a => a.DrawText($"{prediction.Label.Name} ({score})",
                font, prediction.Label.Color, new PointF(x, y)));
        }

        await image.SaveAsync("Assets/result.jpg");
    }
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
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 Yolov5Net:

Package Downloads
AIInspect

test

GitHub repositories (1)

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

Repository Stars
Vincentzyx/VinXiangQi
Xiangqi syncing tool based on Yolov5 / 基于Yolov5的中国象棋连线工具
Version Downloads Last updated
1.1.0 4,815 3/23/2023
1.0.9 8,113 10/26/2021
1.0.8 371 10/26/2021
1.0.7 462 10/8/2021
1.0.6 373 10/5/2021
1.0.5 385 10/5/2021
1.0.4 457 9/9/2021
1.0.3 329 8/24/2021
1.0.2 399 8/17/2021
1.0.1 380 8/16/2021
1.0.0 512 8/16/2021