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
- Install Labeller using
pip install labellerfrom the command line - Navigate to the directory where you wish to create your web application. This directory should contain a subdirectory named
static/imagesthat contains the images you wish to label - Run
python -m labeller class_1 class_2 ... class_nwhereclass_1 class_2 ... class_nis a list of your class names separated by spaces - Run
python -m flask runto 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
dbdirectory. The app will regenerate a new, empty database when run if no database exists.
- Delete the sqlite database in the
- 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
- Try something like:
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, sopython -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, sopython -m flask run --port 5001
Requirements
- Python >=3.5
The following Python packages are required, and will be downloaded automatically by pip during installation:
flaskflask-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
imagesdirectory 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?
Metadata
Release files for labeller 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| labeller-0.2.0.tar.gz | 17.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| labeller-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.2 kB
Release files / labeller-0.2.0.tar.gz
| Download URL | labeller-0.2.0.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c5c36761cc5eaadae947cfb98703411a696bde38bac59d796a993c789ff5910
|
|
BLAKE2b-256 checksum How to use checksums |
06508d6132cdf947f881d3a0ccb11f970ff881a6ffa1b2e0f44330595056d70d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / labeller-0.2.0-py3-none-any.whl
| Download URL | labeller-0.2.0-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bec9fbaae3bfa3a6f5503931c9d758d3cbc277f1df5eb511802378717d45d222
|
|
BLAKE2b-256 checksum How to use checksums |
1aea753fcda8e2d7120d4c3fc2f9f73689b5c6251b4ad92e46b1abdabfb53a3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|