cvat-ai / cvat

Annotate better with CVAT, the industry-leading data engine for machine learning. Used and trusted by teams at any scale, for data of any scale.
https://cvat.ai
MIT License
12.4k stars 2.98k forks source link

Instances order when exporting masks as segmentation format #7080

Closed lelouedec closed 11 months ago

lelouedec commented 11 months ago

Actions before raising this issue

Steps to Reproduce

Having multiple masks per image, and keeping their order consistent across frames (eg. first one is top most one, second one bottom most one in consecutive frames).

When exporting as segmentation mask, the order of instances (green or red coloured) changes randomly.

Expected Behavior

The segmentation mask should be consistent with order of the mask instances in the annotation tool once exported (mask 0 always top most object, mask 1 always bottom most object).

Possible Solution

No response

Context

No response

Environment

No response

bsekachev commented 11 months ago

Object index is not a marker of position on a frame from "far" to "near". Please, set correct z layer properties for objects.

Some discussion can be found here #6686

bsekachev commented 11 months ago

https://opencv.github.io/cvat/docs/manual/basics/workspace/#adding-layers-and-z-axis-slider Plus to background/foreground buttons in context menu: https://opencv.github.io/cvat/docs/manual/basics/objects-sidebar/#objects-properties

lelouedec commented 11 months ago

Perhaps I poorly worded my question. I didnt mean order from far to near, rather I would like to have a way to specify for consecutive frames which one of the masked instance should be exported as instance ZERO and instance ONE (when to instances of the same class). As right now when I am exporting the annotations, no matter what format the number for an instance seems random.

bsekachev commented 11 months ago

Please, provide any examples with screenshots What do you mean when speaking "instance number"?

lelouedec commented 11 months ago

image image Screenshot 2023-10-30 at 15 05 27

As you can see on the pictures, we try to keep consistent order and even tried to play with layers, but the masks keep getting us random order for the instances (last screenshot).

bsekachev commented 11 months ago

Okay, now I see. But I am not sure that instance segmentation assumes the way to persist objects color between different frames.

@zhiltsov-max Could you please comment on that?

zhiltsov-max commented 11 months ago

CVAT doesn't have a way to control instance ids in segmentation now. Please consider adding a custom label attribute instead. Then, you can export in some format that supports custom attributes, such as CVAT, Datumaro, COCO, Pascal VOC.