Skip to main content

Use interactive matplotlib to label images for classification

Project description

mpl-image-labeller

License PyPI Python Version

Use Matplotlib to label images for classification. Works anywhere Matplotlib does - from the notebook to a standalone gui!

Install

pip install mpl-image-labeller

Key features

  • Simple interface
  • Uses keys instead of mouse
  • Only depends on Matplotlib
    • Works anywhere - from inside Jupyter to any supported GUI framework
  • Easily configurable keymap
  • Smart interactions with default Matplotlib keymap

gif of usage for labelling images of cats and dogs

Usage

import matplotlib.pyplot as plt
import numpy as np

from mpl_image_labeller import image_labeller

images = np.random.randn(5, 10, 10)
labeller = image_labeller(
    images, classes=["good", "bad", "meh"], label_keymap=["a", "s", "d"]
)
plt.show()

Controls

  • <- move one image back
  • -> move one image forward

To label images use the keys defined in the label_keymap argument - default 0, 1, 2...

Get the labels by accessing the labels property.

Overwriting default keymap

Matplotlib has default keybindings that it applied to all figures via rcparams.keymap that allow for actions such as s to save or q to quit. If you inlcude one of these keys as a shortcut for labelling as a class then that default keymap will be disabled for that figure.

Related Projects

This is not the first project to implement easy image labelling but seems to be the first to do so entirely in Matplotlib. The below projects implement varying degrees of complexity and/or additional features in different frameworks.

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

mpl_image_labeller-0.1.1.tar.gz (577.3 kB view hashes)

Uploaded Source

Built Distribution

mpl_image_labeller-0.1.1-py2.py3-none-any.whl (6.3 kB view hashes)

Uploaded Python 2 Python 3

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