Image segmentation using yolov8 with zed 2i python

I have a trained model for image segmentation using yolov8. when i used that model with in zed sdk it gives bounding boxes instead of masks. how to modify the to display masks?

Hi @ash, welcome to the forums

I think you can only make the ZED SDK ingest bounding boxes and not masks, currently.
So, it’s not really a display issue.

That being said, the masks in the BodyData are 2D arrays with values being either 0 (not mask) or 255 (mask). Their dimensions are the ones of the bounding_box_2d attribute. They are located in the frame following the bounding_box_2d origin.

You can use the tool you want to display it.
@Gopi-htic used pyplot here for example: Mask is inconsistent

Is that true about masks not being supported? I also require masks of detected objects, its’s the entire reason I am using this setup!

If it is not supported, what is this line of code for?

detection_parameters.enable_segmentation = True # Outputs 2D masks over detected objects

@a11s @ash

I was not clear, sorry. The masks are supported, however the final output is masks computed by the ZED SDK, it can’t use masks from other detectors.
It should totally work and that’s exactly what this line is for.

But no we don’t have a method to display them right now.

Sorry again for the mistake.

@JPlou does it mean we cannot use the mask coordinates to find our region of interest and use some kind of cv method to create segmentations? Surely there must be some kind of a way to do that.


I don’t know of a way to do that, but there may be, yes.
To clarify, the ZED SDK can ingest bounding boxes from a custom detector, and it is able to infer masks from them. You can then exploit the mask output from ObjectData in any way you want, it is the result of the SDK segmentation.