This code transforms segmentation mask images to annotation JSON files as per the MS COCO format http://cocodataset.org/#format-data
I followed this as a guide when writing the script.
The original images and annotations used in this repo are available at: http://martinovi.ch/datasets/ECP_newAnnotations.zip
Register the dataset to detectron2, following the detectron2 custom dataset tutorial.