FlorianVal / dataset_labeling

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dataset labeling

TODO

  • Hide boxes

Start the annotation service using docker

Specify the following environment variables:

  • IMAGES_PATH the folder containing the images to label
  • HUMAN_ANNOTATIONS_PATH the folder to store the (future) human annotations
  • MODEL_ANNOTATIONS_PATH optional, the folder containing pre-annotations (typically, generated by a model, for humans to check and correct).
  • CLASS_NAMES a non-empty list of class names (can be just one class).
  • CLASS_COLORS optional, sets the color of each class' bounding box. Must be of the same length as CLASS_NAMES .

Then start the server with docker-compose up. It will build the docker image if needed. For instance, for testing purposes:

export IMAGES_PATH=$(pwd)/assets/images
export HUMAN_ANNOTATIONS_PATH=$(pwd)/assets/human_annotations
export MODEL_ANNOTATIONS_PATH=$(pwd)/assets/model_annotations
export CLASS_NAMES=truck,red,orange,black
export CLASS_COLORS=#e5ff00,#ff0000,#ff7f00,#000000

mkdir -p $HUMAN_ANNOTATIONS_PATH # otherwise it would be created by docker/root and be unwritable
docker-compose up

You may define those env variable in the file .env, which is read by docker-compose. See sample.env for an example.

Please note that a file "class_names.txt" will be created in MODEL_ANNOTATIONS_PATH with the list of the class names. This file is useful for the next step: generating the tfrecord files.

Start the annotation service without docker

If everything is installed on your host computer, you can start the annotation service by running:

python3 app.py --images_path= \
               --human_annotations_path= \
               --model_annotations_path=

the images need to be in the static/ folder to be served with flask

Check the annotations

The annotation server can be hacked to check the annotations:

  • copy the human annotations to the model preannotations folder
  • launch a new server (different name and port) with docker-compose_check-annotation.yml .

Optional: preannotate images with a frozen model

Run cd tools/machine_annotation && python3 app.py . This script can be run from a docker container built with tools/machine_annotation/(cpu/gpu)-Dockerfile .

Optional : extract frame from a video

Run cd tools && python3 burst_video.py

To know the different options you can use, you can use the '--help' argument. You can provide these option using the command line, environment variables or by populate the config_video_bust.yml file created the first time you run the script

Contributing: code architecture

  • app.py contains the Flask backend code
  • front/src/App.vue contains the frontend template. To draw the rectangles on an image, it uses the custom rectangle component, defined below.
  • front/src/components/Rectangle.vue defines the rectangle component.

About


Languages

Language:Vue 49.4%Language:Python 41.8%Language:Dockerfile 4.8%Language:HTML 2.6%Language:JavaScript 1.5%