Skip to main content

Create image labelling software for machine learning applications.

Project description

Labeller

Quickly set up an image labelling web application for the tagging of images by humans for supervised machine learning tasks.

Introduction

Labeller allows you to quickly set up an image tagging web application for labelling of images.

Usage

  1. Install Labeller using pip install labeller from the command line
  2. Navigate to the directory where you wish to create your web application. This directory should contain a subdirectory named static/images that contains the images you wish to label
  3. Run python -m labeller class_1 class_2 ... class_n where class_1 class_2 ... class_n is a list of your class names separated by spaces
  4. Run python -m flask run to start the web application

Example:

$ python -m labeller car tree bike house
$ python -m flask run

See the Options section below for configuration options.

Run python -m labeller -h for quick help.

How Labeller Works

When you create a new labelling application, Labeller will generate a web application based on the number of classes you have defined during initialisation. Images stored in static/images will be displayed randomly to the user, and they can be labelled with one of the classes provided during the app initialisation.

The built application will have the following structure:

project_folder
├── app.py
├── db
│   └── labels.db
├── static
│   ├── favicon.ico
│   ├── images
│   │   ├── im_1.jpg
│   │   ├── im_2.jpg
│   │   ├── ...
│   │   └── im_n.jpg
│   └── styles
│       └── dashboard.css
└── templates
    ├── about.html
    ├── footer.html
    ├── index.html
    ├── labels.html
    └── navbar.html

The labels.db file is an SQLite database containing the labels for the images that have been labelled so far. To export them to CSV format, run the following:

$ sqlite3 -header -csv labels.db "select * from labels;" > labels.csv

FAQ

  • I want to clear the database and start labelling again
    • Delete the sqlite database in the db directory. The app will regenerate a new, empty database when run if no database exists.
  • How can I export the data from the database as a CSV file?
    • Try something like: sqlite3 -header -csv labels.db "select * from labels;" > labels.csv

Ensure you place your images in a the directory path static/images, so that a path to an image would be ./static/images/im_1.png for example. In other words your directory structure should look as follows before you build your application:

project_folder
└── static
    └── images
        ├── im_1.jpg
        ├── im_2.jpg
        ├── im_3.jpg
        ├── ...
        └── im_n.jpg

Options

Currently, the only user definable parameters is the list of class names. This will change as the application develops.

Flask Options

Labeller uses Flask as its web development framework. You can pass arguments to Flask as normal when invoking python -m flask run, or through environment variables. For example development mode can be enabled by setting an environment variable, e.g: export FLASK_ENV=development in Linux (in Windows use set FLASK_ENV=development or $env:FLASK_ENV = "development" in Powershell).

Some common options that can be passed with python -m flask run are:

  • To serve the application over the network pass --host=0.0.0.0, so python -m flask run --host=0.0.0.0
  • To use a different port other than the default of 5000, e.g. port 5001, pass --port 5001, so python -m flask run --port 5001

Requirements

  • Python >=3.5

The following Python packages are required, and will be downloaded automatically by pip during installation:

  • flask
  • flask-bootstrap

as well and their requirements.

Known Issues

  • HTML formatting of generated output needs work
  • Images that are particularly large may have issues rendering and this will be fixed in the next update

Future Work

  • Text snippet labelling
  • Consensus labelling (combining labelling efforts across users)
  • Multi class labelling (labelling an image with more than one label)
  • Free-text tagging/labelling
  • Allow an option to resize all images in the images directory to a certain size when creating the web app
  • API access for running instances to get image tags
  • Provide option to not use CDNs for JQuery and Bootstrap
  • Docker image?

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

labeller-0.2.0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

labeller-0.2.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file labeller-0.2.0.tar.gz.

File metadata

  • Download URL: labeller-0.2.0.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for labeller-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5c5c36761cc5eaadae947cfb98703411a696bde38bac59d796a993c789ff5910
MD5 62cd46db92dc177d733b61fd354aa14a
BLAKE2b-256 06508d6132cdf947f881d3a0ccb11f970ff881a6ffa1b2e0f44330595056d70d

See more details on using hashes here.

File details

Details for the file labeller-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: labeller-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for labeller-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bec9fbaae3bfa3a6f5503931c9d758d3cbc277f1df5eb511802378717d45d222
MD5 68d96ab4486374f00e19b13bddad9217
BLAKE2b-256 1aea753fcda8e2d7120d4c3fc2f9f73689b5c6251b4ad92e46b1abdabfb53a3e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page