dme-compunet / 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.
https://www.nuget.org/packages/YoloV8
GNU Affero General Public License v3.0
242 stars 45 forks source link

Getting lower confidence values #42

Closed sabihoshi closed 6 months ago

sabihoshi commented 6 months ago

I am getting a lower confidence value, Typically lower with the one from python. The model is not OBB. Even with the image resized to 640x640 or 640 with the same aspect ratio.

Ultralytics YOLOv8.1.20 🚀 Python-3.10.11 torch-2.2.1+cu118 CPU (AMD Ryzen 9 7950X 16-Core Processor)

yolo predict model="...\best.onnx" source="...\cavity.jpg" save_txt=True save_conf=True device=cpu

cavity resized

.Net 8.0 SDK YoloV8.GPU 3.1.1

using Compunet.YoloV8;
using Compunet.YoloV8.Plotting;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;

var image = @"...\cavity.jpg";
var model = @"...\best.onnx";

using var predictor = new YoloV8(model);

using var origin = Image.Load(image);
using var resizedImage = origin.Clone(ctx => ctx.Resize(new ResizeOptions
{
    Size = new Size(640, 640),
    Mode = ResizeMode.Max
}));

var result = await predictor.DetectAsync(origin);
using var plotted = await result.PlotImageAsync(origin);
plotted.Save(Path.Combine("output", Path.GetFileName(image)));

cavity cavity

So you can test the model yourself weights.zip

dme-compunet commented 6 months ago

Hi @sabihoshi In the last published version there is a problem with the non-max suppression algorithm, which caused some problems (and also decrease in the confidence percentage), version 4.0.0 will be published soon and it is likely that these problems will be solved there.

sabihoshi commented 6 months ago

Thank you. I can confirm v4.0.0 solved my issues. Cheers!