Skip to content

This repository is for convert the list of binary masks into one COCO annotation json file

Notifications You must be signed in to change notification settings

Dilagshan/Binary-Mask-to-COCO-Annotation-Format

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Binary-Mask-to-COCO-Annotation-Format

Introduction

There are many annotations format for different types of models. Usually, binary masks are used for U-NET and FPN model training. Suppose, if we want to train the MASK R-CNN model for instance segmentation using the same dataset, we need the COCO format annotations. This is the method we developed to convert binary mask to COCO annotation format. Here, your images names should be in the format of "name_id.png" as image id for the COCO format annotation will create from the image name.

Installation process

Step 1: Clone this repository

!git clone https://github.com/Dilagshan/Binary-Mask-to-COCO-Annotation-Format.git


Step 2: Change the path of the directory

cd /Binary-Mask-to-COCO-Annotation-Format


Step 3: Install the requirement libraries

!pip install -r requirement.txt


Step 4: Import the file named " binary_to_coco.py"

from binary_to_coco import create_coco


Step 5: Define the input for the function create_coco.

input_path_list = "list containing the paths of all binary images" 
output_path = "path where you want to save the COCO annotations as json file"
create_coco(input_path, output_path)

Reference

  1. https://www.immersivelimit.com/tutorials/create-coco-annotations-from-scratch

About

This repository is for convert the list of binary masks into one COCO annotation json file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages