python-3.xtensorflowconv-neural-networkfaster-rcnnsemantic-segmentation

How to define inner polygon in coco dataset?


I'm looking to understand how to define inner or interior polygon in segmentation part of coco dataset

I'd like to teach the convolution network to recognize holes in building polygons

Example of the polygon with hole

enter image description here


Solution

  • The best solution is to define shapes with holes using RLE (Run Length Encoded) masks.

    In the Matterport Mask R-CNN implementation, all polygonal segmentations are converted to RLE and then converted to masks. Check out annToMask() and annToRLE() in coco.py. The reason for the polygons is that they're more efficient to store in json and will shrink the size of the annotation file. If you can't define your shape with a solid polygon, you're stuck with a potentially larger RLE unless you want to make your own custom annotations within COCO and modify your neural net to convert those polygon holes to RLE on your own.

    Note that if you are using a neural net that only finds bounding boxes, this is all unneccesary because it won't be capable of returning holes anyway.