dme-compunet/YoloV8

How to get the boxes or mask from the results?

s1030512149 opened this issue · 4 comments

Sorry to bother.
Actually i just know the Python, but recently we are trying to deploy the model to other machine based on C#.
Here is the code:
using var model = new YoloV8(model)
var results = model.Detect(img)
or var results = model.Segment(img)

How can I get the boxes or the mask from the results with the conf and the classfied group ? It is the same like Python code: box = results.Boxes ?
Can you help me with that?
Thanks a lot!

This is different from Python, the list of boxes are in result.Boxes, which is an array of objects that implement the IBoundingBox interface.

I hope the following code will make it clear for you:

var firstBox = result.Boxes[0]; // get first box from the result

var boxConfidence = firstBox.Confidence;
var boxX = firstBox.Rectangle.X;
var boxY = firstBox.Rectangle.Y;
var boxWidth = firstBox.Rectangle.Width;
var boxHeight = firstBox.Rectangle.Height;
var className = firstBox.Class.Name;
var classId = firstBox.Class.Id;

Thanks, you helped a lot!

Hi @dme-compunet,
I can see the Boxes property of the result but can't see the masks.
Can you provide us more information?
Thank you!
image

Oh, I've found where the mask is. It is a property of ISegmentationBoundingBox.