Segmentation Mask to COCO JSON Converter — Python Script for Detectron2
Stop writing COCO annotation scripts from scratch.
This ready-to-use Python script automatically converts segmentation mask images into MS COCO format JSON annotation files — compatible with Detectron2, YOLO, and any COCO-based training pipeline.
Built and tested on the Ecole Centrale Paris (ECP) Facade Dataset. Works out of the box on any custom segmentation dataset.
What this script does: ✦ Converts color-coded mask images to COCO-format JSON instantly ✦ Extracts polygons, bounding boxes & category labels automatically ✦ Compatible with Detectron2 custom dataset pipeline ✦ Follows official MS COCO annotation format (cocodataset.org) ✦ Clean, documented Python code — easy to customize for your dataset
Perfect for: ✦ Machine learning engineers & data scientists ✦ Computer vision researchers ✦ Detectron2 & YOLO users ✦ Anyone building custom object detection datasets
What you get: ✦ Full Python script (ready to run) ✦ Step-by-step usage instructions ✦ Tested on real facade segmentation dataset ✦ Instant download · Use on unlimited projects
Works with Python 3.x · Detectron2 · OpenCV · NumPy
One script. Hours saved. Clean annotations guaranteed.
✦ Instant download · One-time payment · Commercial use allowed