openvinotoolkit / datumaro

Dataset Management Framework, a Python library and a CLI tool to build, analyze and manage Computer Vision datasets.
https://openvinotoolkit.github.io/datumaro/
MIT License
538 stars 133 forks source link

Creating semantic or panoptic masks instead of instances masks #679

Open bertinma opened 2 years ago

bertinma commented 2 years ago

Hi,

I tried to create semantic masks (or at least panoptic masks) for a segmentation task. I used CVAT to annotate and I tried multiple export formats.

I achieve to create masks only with COCO format but it not matters. I follow the following steps :

!datum create -o ./coco_project !datum import -p ./coco_project -f coco ./dataset_coco !datum transform -t polygons_to_masks -p ./coco_project/ --overwrite source-1

As said in the documentation, it produces instances masks, I tried to use the following command to extract masks by class (if I understand well the doc)

!datum transform -t merge_instance_segments -p ./coco_project/ --overwrite source-1 --include-polygons

But it didn't change anything ..

Is it the right way to create semantic masks ? Is it possible with datumaro ?

Thanks for your help !!

PS : Using datumaro==0.3

zhiltsov-max commented 2 years ago

Hi, I'm not sure I understood well the result you're trying to achieve. The actions above should be enough to produce panoptic masks in the COCO format, they're going to be in the annotations/panoptic/ directory.

As said in the documentation, it produces instances masks, I tried to use the following command to extract masks by class (if I understand well the doc)

COCO panoptic format contains .png masks with special encoding. Please check the VOC segmentation format, which contains "normal" 3-channel colored masks. To convert from your project, call

datum export -p coco_project -o source-1-voc -f voc source-1 -- --save-images

https://github.com/openvinotoolkit/datumaro/tree/develop/tests/assets/voc_dataset/voc_dataset1/SegmentationClass