Giter VIP home page Giter VIP logo

coco2voc's Introduction

coco2voc

A tool for converting COCO style annotations to PASCAL VOC style segmentations

Requires pycocotools (see https://github.com/cocodataset/cocoapi). Also, the method does not download the COCO images but instead assumes they exist locally.

Use this to convert the COCO style JSON annotation files to PASCAL VOC style instance and class segmentations in a PNG format. This can be useful when some preprocessing (cropping, rotating, etc.) is required, where it is more convenient to have the labels as images as well.

Class segmentations are an 8-bit PNG images with each pixel value corresponding to the class id of the object in the pixel (https://tech.amikelive.com/node-718/what-object-categories-labels-are-in-coco-dataset/). This results in greyscale images that are not visually convenient, but makes more sense when used in training. It is recommended to load the images with PIL so that the values are not normalized (see example code).

In addition to the class and instance segmentations, this also creates an 'ID segmentation' which is a 1-D numpy array in the dimensions of the original image, where the [i, j] cell contains the id of the object at the [i, j] pixel of the image. This can be used to get other information that is not given by the class and instance segmentations (such as bounding boxes etc.).

The ID segmentation can be optionally compressed to an '.npz' file (this is default behavior). These arrays are pretty sparse so the compression is highly effective, but it requires some attention when loading the arrays from file (see example code).

Note that converting the entire dataset can take up to a few hours depending on your machine.

coco2voc's People

Contributors

alicranck 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.