Open PhilippMarquardt opened 2 years ago
I'm having the same problem. I think this is a bug..
I used this instead:
w, h = img.shape[:2]
mask = np.zeros((w, h))
segmentation = coco.loadAnns(annId)[0]['segmentation'][0]
mask[segmentation[i][1::2], segmentation[i][::2]] = 1
Hi, I was having some problems when trying to use the mmdetection framework instance segmentation with the coco format. My dataset requires real precise segmentations for each object but the results were not good enough. To narrow down the problem I tried the pycocotools to decode the segmentations of the coco annotation json file. And to my suprise the resulting segmentation is not exactly the original segmentation but a segmentation that is missing a few pixels. Is this really an error in the cocoapi? To reproduce see the following code:
The test_file.png I have used is just a white circle drawn over a black background in paint. Feel free to download it and use it as input to the function. See here:
I am quite sure that I did everything right when creating the annotation file. To my understand the drawn_contours.png which are just the contours directly drawn onto a black image and the coco_out.png should be exactly the same. But as you can see when running the code this is not the case. The coco_out.png is missing a few pixels which makes the overall white circle smaller than it should be. Thanks :)