2

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

Toren
  • 6,648
  • 12
  • 41
  • 62
  • Can you be more specific? May be an expected input / expected output? – thushv89 Jan 05 '20 at 23:07
  • The mask has a holes. I guess this implies two lists, one for the outer contour, and one for the inner contour.Or two overlapping masks: one for the object and one for the hole. – Jean-Pat Jan 18 '20 at 15:09

1 Answers1

2

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.

Adam Kelly
  • 71
  • 4