Was fine in the windows only/System.Drawing version.
Added to your test case:
[Fact]
public void TestYolov9()
{
using var yolo = new Yolov9("./assets/yolov9-c.onnx"); //yolov9 模型,需要 nms 操作
// setup labels of onnx model
yolo.SetupYoloDefaultLabels(); // use custom trained model should use your labels like: yolo.SetupLabels(string[] labels)
Assert.NotNull(yolo);
foreach (var tuple in _testImages)
{
var ret = yolo.Predict(tuple.image, useNumpy: false);
CheckResult(ret, tuple.label);
using SKCanvas canvas = new(tuple.image);
using var paint = new SKPaint
{
Style = SKPaintStyle.Stroke,
Color = SKColors.Blue,
StrokeWidth = 3,
};
foreach (var prediction in ret)
{
canvas.DrawRect(prediction.Rectangle, paint);
}
using var data = tuple.image.Encode(SKEncodedImageFormat.Png, 100);
using var stream = File.OpenWrite($"{tuple.label} result.png");
data.SaveTo(stream);
}
}
Was fine in the windows only/System.Drawing version. Added to your test case: