Code Monkey home page Code Monkey logo

imagetagger's Introduction

ImageTagger

This is a collaborative online tool for labeling image data.

If you are participating in RoboCup, you should not install your own instance but rather use the one provided by the Hamburg Bit-Bots (https://imagetagger.bit-bots.de). This enables you to use already labeled images from other teams and to share your own.

For a short overview of the functions please have a look at the following poster: https://robocup.informatik.uni-hamburg.de/wp-content/uploads/2017/11/imagetagger-poster.pdf

Table of Contents:

Features

  • team creation
  • image sets
  • bounding box, polygon, line and point labeling
  • imageset download
  • export format creation
  • label export
  • image preloading for labeling and verification
  • label verification
  • upload of existing labels
  • tools exchange

Planned Features

  • collections of filtered images from multiple imagesets
  • image metadata (e.g. robot pose, camera parameters)

Reference

This paper describes the Bit-Bots ImageTagger more in depth. Please cite if you use this tool in your research:

FIEDLER, Niklas, et al. ImageTagger: An Open Source Online Platform for Collaborative Image Labeling. In: RoboCup 2018: Robot World Cup XXII. Springer, 2018.

@inproceedings{imagetagger2018,
   author={Fiedler, Niklas and Bestmann, Marc and Hendrich, Norman},
   year={2018},
   title={ImageTagger: An Open Source Online Platform for Collaborative Image Labeling},
   booktitle={RoboCup 2018: Robot World Cup XXII},
   organization={Springer}
}

Installing and running ImageTagger

ImageTagger can be installed and run locally (best for development), in a docker container or in Kubernetes (used in our deployment).

Locally

In some of the following code snippets, the DJANGO_CONFIGURATION environment variable is exported. This defines the type of deployment by selecting one of our predefined configuration presets. If ImageTagger is running in a development environment, no export is necessary.

  1. Install the latest release

    You need to have Pipenv installed on your system.

    Replace v… with the latest release tag.

    git checkout v…
    cd imagetagger
    pipenv sync
  2. Setup a database server

    As a database server postgresql is required. Please seek a guide specific to your operating system on how to install a server and get it running.

    Once postgresql is installed, a user and database need to be set up for ImageTagger. Of course, the user and password can be changed to something else.

    CREATE USER imagetagger PASSWORD 'imagetagger';
    CREATE DATABASE imagetagger WITH OWNER imagetagger;
    
  3. Select a Configuration preset

    When running ImageTagger as a developer, no step is necessary because a development configuration is used per default when not running as a docker based deployment. However if this is supposed to be a production deployment, export the following environment variable.

    Currently available presets are Dev and Prod

    export DJANGO_CONFIGURATION=Prod
  4. Configuring ImageTagger to connect to the database

    Please see the lower Configuration section on how to configure ImageTagger for your specific database credentials.

  5. Initialize the database

    Run the following to create and setup all necessary database tables:

    ./manage.py migrate
  6. Create a user

    ./manage.py createsuperuser
  7. Run the server

    ./manage.py runserver

In a production deployment it is necessary to run the following commands after each upgrade:

./manage.py migrate
./manage.py compilemessages
./manage.py collectstatic

for additional steps on some releases see instructions in UPGRADE.md

In-Docker

  1. Checkout the latest release

    git checkout v…
  2. Build the container image

    Note: the Dockerfile has been tested with podman as well.

    docker build -t imagetagger .
  3. Run the container

    docker run -it -p 8000:80 --name imagetagger imagetagger

    This step will not work out of the box because configuration still needs to be done. See the lower section about configuring ImageTagger on how to fix this.

  4. Create a user

    Note: This step requires a container running in the background.

    docker exec -it imagetagger /app/src/imagetagger/manage.py createsuperuser

About the Container

Kind Description
Volume /app/data is where persistent data (like images) are stored
Volume /app/config is where additional custom configuration files can be placed. See the Configuration section below
Environment ImageTagger can mostly be configured via environment variables
Ports The container internal webserver listens on port 80 for incoming connections.

On Kubernetes

  1. Follow the steps for In-Docker on how to build a container image

  2. Apply kubernetes configuration

    Note: This assumes you have access to a kubernetes cluster configured and can use kubectl

    We use kustomize for management of our kubernetes configuration. It can be applied by running the following commands:

    kustomize build . > k8s.yml
    kubectl apply -f k8s.yml

Generated Kubernetes resources

Kind Name Description
Namespace imagetagger The namespace in which each resource resides
Deployment + Service imagetagger-postgres postgresql server which is required by ImageTagger. The replica count can be dialed down to 0 if an the usage of an external server is desired.
PersistentVolumeClaim imagetagger-database Where the postgresql server stores its data
ConfigMap imagetagger-postgres Configuration of the postgresql server. Also available inside the application server deployment so that settings can be referenced.
Deployment + Service imagetagger-web application server. Per default this deployment references the image imagetagger:local which is probably not resolvable and should be replaced by a reference to where your previously built container image is available.
PersistentVolumeClaim imagetagger-image-data Where the application server stores its images (and tools).
ConfigMap imagetagger-web Configuration of the application server. Mounted as environment variables. See Configuration for details.

Configuration

ImageTagger is a Django application and uses django-configurations for better configuration management.

ImageTagger is configured to use a Dev configuration when running locally and Prod when running in a container. This can be overridden via the environment variable DJANGO_CONFIGURATION.

For a list of available configuration values see settings.py. Towards the bottom is a list of values. These are taken from environment variables where the key is the variable name but with an IT_ prefix.

If completely custom configuration is desired, imagetagger/imagetagger/settings_local.py can be created in which a custom configuration class may be created. In Docker this file may be located at /app/config/settings.py so that mounting it should be simple. To use this custom configuration class, the environment variables DJANGO_SETTINGS_MODULE=imagetagger.settings_local and DJANGO_CONFIGURATION=MyCustomClass must be set.

If downloading zip files of Imagesets is desired, the feature can be enabled by settings IT_ENABLE_ZIP_DOWNLOAD to true. A separate zip generation daemon must then be started via the following command. This feature is enabled and running automatically in Docker based deployments.

export DJANGO_CONFIGURATION=Prod
./manage.py runzipdaemon

To create annotation types, log into the application and click on Administration at the very bottom of the home page.

Minimal production Configuration

In production, the following configuration values must be defined (as environment variables)

Key Description
IT_SECRET_KEY The django secret key used by ImageTagger. It is used for password hashing and other cryptographic operations.
IT_ALLOWED_HOSTS django ALLOWED_HOSTS as comma separated list of values. It defines the hostnames which this application will allow to be used under.
IT_DB_HOST Hostname (or IP-address) of the postgresql server. When deploying on kubernetes, the provided Kustomization sets this to reference the database deployment.
IT_DB_PASSWORD Password used for authenticating against the postgresql server.
IT_DOWNLOAD_BASE_URL Base-URL under which this application is reachable. It defines the prefix for generated download links.

Database Configuration

The following environment variables configure how the postgresql server is accessed

Key Required Default Description
IT_DB_HOST yes Hostname (or IP-address) of the postgresql server. When deploying on kubernetes, the provided Kustomization sets this to reference the database deployment.
IT_DB_PORT no 5432 Port on which the postgresql server listens.
IT_DB_NAME no imagetagger Database name on the postgresql server. ImageTagger requires full access to it.
IT_DB_USER no imagetagger User as which to authenticate on the postgresql server.
IT_DB_PASSWORD yes Password used for authentication.

Used dependencies

The ImageTagger relies on the following plugins, libraries and frameworks:

We are grateful to the maintainers and contributors of the respective projects.

imagetagger's People

Contributors

akasch avatar catharasis avatar dependabot[bot] avatar flova avatar ftsell avatar jenmeyer avatar jgueldenstein avatar johagge avatar lucas-camp avatar nfiedler avatar timonegk avatar wasabifan avatar wichmannpas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imagetagger's Issues

Image scale not calculated until the image is resized

It seems that the when images are resized to fit into the window, the scale factor for the annotations sometimes does not match the image scale factor, so the boxes appear in the wrong place and are the wrong size. I have noticed when the window is resized then the scale factor is recomputed and then the boxes go to the correct location.
A simple solution to this is to add a call to calculateImageScale() on line 288 of imagetagger/imagetagger/annotations/static/js/annotations.js so that the image scale is always computed right before drawing the boxes.
I have seen this problem occur in Firefox and Chrome. I am working with large images which are scaled down to fit in the window.

Simple (mobile) verification view

Team Rhoban has a very simple verification view, on which the user only has to select the images containing balls. This has the advantage that they can give it to any person and this person can do the job without prior knowledge. Furthermore this is also simple to do on a mobile device, e.g. smart phone.
A very simple verification view which shows only the area around the label together with the label and a yes/no button would be good. This would then also be possible to run on a mobile platform.

Customizable import format

Right now, the import format is fixed and not customizable like the export format. A custom regular expression could solve this issue, especially when it is automatically provided with every new export format.

Annotate a whole Set with "Not in Image"

In an image set an option should be given to annotate all the images in the set with "Not in Image" of a given type. This would help to handle negative data sets. The feature is very powerful, so only team admins and the creator of the image set should be allowed to use it. Creating that high amount of labels at once generates too many points for a user. As a solution i'd propose using Null as user. The user creating the annotation verifies them automatically (maybe a checkbox has to be set to validate them all).

having "not in image" and "keep selection" both selected leads to following annotations not loading

When you have the checkbox for "not in the image" and "keep selection for next" checked at the same time, the existing annotations below the pictures will be stuck on "Loading...".
They will load again after reloading the page or unselecting "keep selection for next" and loading the next image.
Not in image also does not keep selected, even though it seems like it should with keep selection.

"Create imageset" field visible for everyone on team page

If you visit the page of any team you will be shown a "Create imageset" field. Actually creating one will show the user an error, but this is confusing for users and should only be shown on team pages where the user has the right to create imagesets.

Don't update missing annotation filter on save

If a filter for say robot is activated in annotation view as missing annotation, an image is removed from the list as the first robot is annotated. So you can't annotate multiple robots in a single image successively.

Maybe only update the filtered images if you explicitly change the selected image (last, next, back, skip, click image link).

Create imageset on home page

It would be more intuitive if an imageset could be created on the home page below the existing imagesets. The create form would only require an additional dropdown input for choosing the corresponding team.

zoom when hover

optionally zoom into image section when hovering to increase accuracy

Save image size

When the images gets uploaded as a bulk (not in a .zip folder), the image size is set by default to 800x600. The actual image size won't get measured on upload.

Delete image from Imageset

The creator of a set and team admins of the owning team should be able to delete images from imagesets

The image set download script should be updated

#! /bin/bash

echo "Please enter Username and Password for imagetagger.mafiasi.de. This script will download into the current directory"
read -p "User: " USER
read -s -p "Password: " PASSWD

BASEURL="https://imagetagger.bit-bots.de"
TMP=mktemp -d imagetagger-XXXX

echo ""

Login

CSRF=wget -nv --keep-session-cookies --save-cookies ${TMP}/cookie ${BASEURL} -O - | grep csrfmiddlewaretoken | tail -n 1 | sed -E "s/.*value='(.*)' .*/\1/g"
wget -nv --referer ${BASEURL}/users/login/ --keep-session-cookies --save-cookies ${TMP}/cookie --load-cookies ${TMP}/cookie --post-data "username=${USER}&password=${PASSWD}&csrfmiddlewaretoken=$CSRF&login=Log in" $BASEURL/users/login/ -O - >/dev/null
if grep --quiet sessionid ${TMP}/cookie; then
echo "Login success"
else
echo "Login failure"
exit 1
fi

Download images

images=wget -nv --keep-session-cookies --save-cookies ${TMP}/cookie --load-cookies ${TMP}/cookie ${BASEURL}/images/imagelist/$1/ -O -
for image in ${images}
do
if ! wget -nv --keep-session-cookies --save-cookies ${TMP}/cookie --load-cookies ${TMP}/cookie --trust-server-names --content-disposition ${BASEURL}${image}; then
echo "Download Failed"
exit 2
fi
done

Dataset right managment

Some teams seem to be interested in having the possibility to forbid other from changing labels, thus making some sort of "read only" datasets.
This would need some sort of rights management for datasets. Probably, just an option for everybody can change/add labels and only team members can do it, is enough.

adding meta data to images

Some meta is very interesting for some approaches of computer vision
Most importantly and wide spread is the camera angle and height at the moment of recording.
Furthermore the aperture of the camera as well as maybe some camera calibration values would be interesting
These values should be stored in a standardized format (e.g. euler angles with a defined 0° position) on the server but it has to be possible to export them into different values (e.g. other orientations, or representation as quaternion)
Additionally, there should be the possibility to attach arbitrary meta data to images and image sets for information which go beyond camera angle and height.

Instructions/Help page

It would be good to have an instruction/help page which shows the user how to label objects.
This could also automatically be displayed when the user first logs in

Quick button for team list

A button in the menu bar (maybe between tools and user) that opens a dropdown list of all the user's teams for quickly reaching the team's site

Support PASCAL-VOC-like export format

I notice that placeholders in Create new Exportformat page isn't sufficient to create a PASCAL-VOC-like export format.

For example, PASCAL VOC format looks like this:

<annotation>
	<folder>demo</folder>
	<filename>demo3.jpg</filename>
	<path>/home/yuthon/Workspace/demo/demo3.jpg</path>
	<source>
		<database>Unknown</database>
	</source>
	<size>
		<width>799</width>
		<height>401</height>
		<depth>3</depth>
	</size>
	<segmented>0</segmented>
	<object>
		<name>class-1</name>
		<pose>Unspecified</pose>
		<truncated>0</truncated>
		<difficult>0</difficult>
		<bndbox>
			<xmin>487</xmin>
			<ymin>107</ymin>
			<xmax>790</xmax>
			<ymax>318</ymax>
		</bndbox>
	</object>
	<object>
		<name>type-f</name>
		<pose>Unspecified</pose>
		<truncated>0</truncated>
		<difficult>0</difficult>
		<bndbox>
			<xmin>141</xmin>
			<ymin>68</ymin>
			<xmax>363</xmax>
			<ymax>334</ymax>
		</bndbox>
	</object>
</annotation>

The filename and path part isn't shown on given placeholders, thus it's impossible to create a PASCAL-VOC-like export format.

I'll appreciate it if you could supply more placeholders, or directly support built-in PASCAL-VOC-like export format.

handling of long image names

in the annotation view, long image names look extremely ugly. It would help to shorten them or to add a horizontal scroll bar to the image list. The itemisation points take a lot of the space and are unnecessary.

Formatting in annotation formats is not preserved

When exporting annotations the indentation of each line is not preserved. This breaks formats that rely on indentation to work (like YAML).

For example, a format like this:

# Base format
imageset_%%imageset:
    description: %%setdecsription
    team: %%team
    location: %%setlocation
    %%content

# Image format
    %%imagename:
        dimensions: [%%imagewidth, %%imageheight]
        num_annotations: %%annoamount
        %%annotations

Produces an output like this:

imageset_bitbots-nagoya-01:
    description: %%setdecsription
    team: Bit-Bots
    location: nagoya
    
ball_move_1_00001.png:
        dimensions: [800, 600]
        num_annotations: 5

Here, the issue is that ball_move_1_00001.png: should be indented to line up with location. The same issue occurs with the annotation formats too.

It also appears as though an extra newline is appended to the base format. While this shouldn't break YAML syntax, it is an unexpected occurrence.

Automatic team deletion

Deletes team automatically when the last user leaves the team. Imagesets still owned by the team should get set as public.

Allow editing of export formats

For the moment you can create export formats, but not edit them. So when you make an error you have to start over again :/
Some possibility for editing, or at least cloning export formats would be very nice :D

label export filter not working properly

Exporting labels in (for example) "AI Ball" format should only include ball labels, nothing else. However, some exports showed goalpost "filename|not_in_image" labels in the export.txt. Tested on two different imagesets now and also re-created the exports -> same behavior.

Most likely the labels are not filtered correctly. Maybe it is just "not_in_image" labels that are not filtered.

Fix should have high priority imho, since this highly affects the usability of exports.

Preloading images for faster tagging

As tagging is for itself very fast, the loading time for the image is relatively long. It would be nice to preload images, so that when going to the next page the image is already in the browser cache.

Loading the image of the next page with javascript or in a hidden object should do this.

Tab layout for imagesets on team profile view

If the ImageTagger is used frequently teams will have several datasets making some kind of sorting an importing feature. A first step would be to include a tabbed layout, e.g. "default", "date created", "by size", "test sets", where the default behavior is retained with the "default" tab and the others sort image sets by date of creation, number of images and "test*" matching the beginning of a dataset's name respectively.

Add tool section

Add a tool section in the top right corner, where people can download the scripts (e.g. for rosbag transformation). Each script should have a small explanation.

Allow setting of label export file name

Currently the file name for label exports is always autogenerated. It would be nice to be able to set this also in the export format, e.g. to make something like "%%imageset.yaml".

Global/Team announcements

It would be nice to be able as admin to send announcements (new version/feature/imageset etc.) to all users. These could be displayed in the home screen. A global admin would send the announcements to all users while the team-specific announcements just get sent to all the team members.

Imageset priorities

Imagesets could have priorities (i'd suggest high, normal and low) in which they get ordered in the user's home view and a little lable when they are listed elsewhere. So it would be easier to direct the focus of the collaborators towards the most important sets.

Labeling of goals and lines

It is not clear how goals and lines are to be labelled.
For goals the posts and bars can be labelled. But using a bounding box is not optimal since the shape of the object can be askew. So a different labelling would be necessary, e.g. bottom and top center point together with width.
For the lines, it is possible to label arbitrary line section or intersections (T, X, L) and special points (penalty and center point).

Seperate settings.py into settings.py and settings_base.py

settings_base.py should include all the settings which should work in most environments. For example:

  • installed apps
  • context processors
  • middleware
  • upload handlers
  • etc.

The settings.py are specific to your deployment. Therefore only an example is provided.

Export files do not contain labels for bounding boxes

Currently the exported files do not contain any information about the tagged label (i.e. ball or concealed ball).
The current columns are
imagename|x1|y1|x2|y2

Changing this might introduce incompatibilities with current software using this format.

Main annotation type of an imageset

Add an option to imagesets to select a main annotation type. This annotation type will be the preselected annotation type when a user starts to label images of the set.

Hotkey for type of annotation

It would be great to be able to switch between types of annotations (ball, goalpost etc.) by pressing a hotkey e.g. 1-9.

Upload previously made markings

Hello,

I'd like to propose a new feature to the Imagetagger.
It would be very useful a option for uploading previously made markings.
Of course, these old markings has to be in the same standards used by the Imagetagger.

Best regards

Tags/labels for datasets

For ease of use with a high number of datasets we need a fast & simple method to sort & filter datasets. One convenient way would be the implementation of tags/labels for datasets like GitHub for example does with issues. This way admins could create labels and each dataset could be assigned with any number of labels, like "ball", "nagoya", "2017", "eu-ball", "test-set". In order to easily identify labels they should at least have colors (like in GitHub) or even small icons.

How to use this tool?

Hello, I git clone this repository and install the required dependencies. But when I type "python3 manage.py runserver 134.100.14.61:5432" on my terminal, I get "Is the server running on host "134.100.14.61" and accepting TCP/IP connections on port 5432?" Is there a user-guide for who want to try this tool?

"Concealed" as annotation attribute

"Concealed" should be an annotation attribute with a checkbox (like "not in image").
This would permit users to

  • filter for annotations like "ball" and concealed balls would also be filtered
  • annotate concealed balls easier

When adding new annotation types, the "concealed" checkbox should be optional.

Redirect instead of 403

Some permission checks just return a 403 error when the user has not the required permissions. This is not really user friendly and should be replaced by a useful redirect and a message.

Non-data/header lines should be marked with a comment character

As the data format for the export file is still evolving, new lines may need to be included into the export file format. The data format, however, is in principle a CSV file format and as such supported by common libraries, such as Pandas for Python etc. To continue to support those libraries and make parsing of the file not harder than it should be, lines which are neither data nor header, should be commented out with a single comment character at the beginning of the line.

For example:

previously the (BitBots) data format looked like this:

Export of Imageset <imagesetname> (ball annotations in bounding boxes)
imagename|x1|y1|x2|y2
FullPic0.jpg|322|308|396|359

the format has changed and now includes an additional line:

Export of Imageset <imagesetname> (ball annotations in bounding boxes)
set[<imagesetname>]
imagename|x1|y1|x2|y2
aufnahme9_FullPic.jpg|296|131|441|282
...

In my oppinion it would be better to mark the first two lines (and possibly more in the future) with a comment char like this:

# Export of Imageset <imagesetname> (ball annotations in bounding boxes)
# set[<imagesetname>]
imagename|x1|y1|x2|y2
aufnahme9_FullPic.jpg|296|131|441|282
...

This should enable common libraries to ignore those lines, and there is no need to write a parser which first finds the first line, which is not part of the header.

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.