Skip to content

kida4bmel/coco-transformation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coco Dataset Transformations

General Info

Small library to do transformations of Coco Datasets. A couple of transformations are already implemented, see below.

  • Only works with Run Length Encoded (RLE) annotations at the moment!
  • If an annotation is cut in the process, even very tiny annotations are kept.
  • The specified versions of numpy, pycocotools and Pillow seem to work nicely together. But newer versions might work as well.

How to run

Create a python environment and install dependencies:

python -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt

then set environment variables ANNOTATION_PATH, IMAGES_PATH, OUTPUT_PATH and choose the correct transformation by uncommenting it in main.py.

then run python main.py.

Transformations

The following transformations are implemented, more can easily be implemented by writing respecting Transform classes.

Tiling

Tiling is done in a non-overlapping way. All annotations are kept, even if they are tiny after cutting.

Scaling

The image and annotations are resized according to a scaling factor.

Frame Cut

The exemplary dataset has exactly one frame per image that represents a frame in which all annotations are. This transformation fits a maximum size square into the image and cuts all annotations accordingly.

Maybe useful for the future

Remove tiny annotations

This transform could remove annotations that are smaller than a given size.

Author: Tim Wessels, Bundesamt für Verbraucherschutz und Lebensmittelsicherheit, im Auftrag von KIDA
Example dataset provided by Christoph Kämpfer, Julius Kühn-Institut

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages