can't set configuration for create a predictor
GuenKainto opened this issue · 4 comments
GuenKainto commented
aloksharma1 commented
here check this
_predictor = YoloV8Predictor.Create("yolov8x.onnx")); //path to model
using var image = Image.Load<Rgb48>(imageData.ToBytes());
var result = _predictor.Detect(image);
if (result != null)
{
foreach (var box in result.Boxes)
{
//draw or do your work here
}
}
should be easy to setup.
dme-compunet commented
using var predictor = YoloV8Builder.CreateDefaultBuilder()
.UseOnnxModel("path/to/model.onnx")
.WithConfiguration(configuration =>
{
configuration.Confidence = 3.5f,
configuration.IoU = ...
})
.Build();
GuenKainto commented
using var predictor = YoloV8Builder.CreateDefaultBuilder() .UseOnnxModel("path/to/model.onnx") .WithConfiguration(configuration => { configuration.Confidence = 3.5f, configuration.IoU = ... }) .Build();
Thankyou for reply ^.^
and i found an another way
private static YoloV8Predictor predictor = YoloV8Predictor.Create(Path.Combine(Environment.CurrentDirectory, "Assets\model\best.onnx"));
public static async Task PredictAsync(Image image, float? iou, float? confidence)
{
YoloV8Configuration config = new YoloV8Configuration();
config.IoU = iou ?? 0.45f;
config.Confidence = confidence ?? 0.3f;
ImageSelector imageSelector = new(image);
var result = await predictor.DetectAsync(imageSelector, config);
return await result.PlotImageAsync(image);
}
Is this okay ?
dme-compunet commented
Is this okay ?
Yes, it's only meant to pass configuration for a one prediction.