Coder Social home page Coder Social logo

smalldan1022 / coco-converter Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.59 MB

Segmentation tool for converting the AI segmentation model inference back into the coco annotator.

License: MIT License

Python 100.00%
coco-annotations coco-annotator

coco-converter's Introduction

Coco converter for the AI model inference segmentation tasks

Logo

Website online

Introduction

This project aims to help the label problem of reusing the inferenced data.

When it comes to the segmentation task , labeling is the hardest and the most time-consuming part, not to mention if you want to improve your segmentation model by reusing inferenced data.

Coco annotator provides us a good way for labeling. However, if we want to reuse the results of our AI model inference, the best way is that we create a Json file that is in the coco dataset format. By doing so, we could get these results into coco annotator and refine these results. After, we use these refined data to train the AI model again so as to make the AI model more general and robust.

Pipeline

1.Train an AI model 

2.Use the AI model to inference 

3.Use the coco converter to convert these inference data into coco format Json file

4.Create a new category in your coco annotator

5.Create a new dataset in your coco annotator

6.Get all the images and the coco format Json file into the folder created by step 5.6.

7.Get into the dataset you created (in your local computer, it should be a fold) and press scan

8.Press import COCO and import the coco format Json file 

Hint:You should create the category (step 5.) and the dataset (step 6.) in the same name

Result

Result

Limitation

There are still some limitations of the coco converter.

  • You need to manually check your dataset id, image id and category id.
  • Can not be used in multi label tasks ( But of course you can modify the code yourself to help you do this)
  • Slightly imprecise between the model inference and the converted coco annotations

Hint:The dataset id, image id and category id are important, and these three values are cumulated by the coco annotator. You can check these three numbers at the Undo section of the coco annotator

How to use the Coco converter

Assume you have all the needed dataset. If not, go through the Pre-requisites and get all the needed dataset

Use the main.py and modify the parameters

python main.py


Below are parameters desciptions. You need to change manually.
====================================================

# Parameters needed to be modified are below:

# Change the image paths to yours
path = "/home/smalldan/Downloads/QuPath-0.2.3/bin/coco_test/"
    
# Change the image size 
width = 512
height = 512

# The coco dataset id is accumulated, thus you need to check your own accumulated number and replace it
dataset_id = 31
categories_id = dataset_id
    
# The coco image id (starting_id) and annotation id (starting_annotation) are accumulated, thus you need to check your own accumulated number and replace them
starting_id = 6078
starting_annotation = 2002

# The dataset and category name (basically I set the same name)
dataset_name = "coco_dataset"

Reference

Thanks to the coco-annotator authors

  @MISC{cocoannotator,
    author = {Justin Brooks},
    title = {{COCO Annotator}},
    howpublished = "\url{https://github.com/jsbroks/coco-annotator/}",
    year = {2019},
  }

coco-converter's People

Contributors

smalldan1022 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.