Closed PhilippMarquardt closed 2 years ago
Hi @PhilippMarquardt , Indeed it is not very accurate if you convert the mask from bitmap to counter first then convert it back to bitmap. Actually you can choose directly encode the mask into RLE format which should be more accurate.
Hi, while trying to train a model on a dataset (cell segmentation) that requires quite accurate segmentations from the instance segmentation model I've noticed that the predictions always introduce quite a "big" gap between cells which is not present in the original dataset which was converted to coco. While trying to find the error I found out that decoding the segmentations with pycocotools doesn't give back the original segmentation. It is missing a few pixels which might not be important for many instance segmentation tasks but for many medical instance segmentation tasks, accurate masks are very important. I've created a small toy image that shows the problem on an image with a single white circle on back blackground .
To reproduce the problem run the following code with the white circle on the back blackground:
The drawn_contours.png are the contours of the original image drawn which is the correct and expected mask. The coco_out.png is the output when decoding the segmentation from the coco dataset. When looking at the images the coco_out.png is missing just a few pixels which is not usable for many datasets that require accurate segmentation. Of course you are not the authors of the pycocotools but since this is a data format very often used in this repo I've asked myself if this is a known problem (I've opened a smiliar issue in the cocoapi repo). If a made an error please let me know :) Thanks
Appendix if you don't want to create the output images. To see the difference quickly switch between them: The coco_out.png The drawn_contours.png
The output more visible on my dataset with cells: The output when decoding mask with pycocotools: The original output like it should be: