A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/mpl-extensions/mpl-image-labeller below:

mpl-extensions/mpl-image-labeller: Matplotlib Image labeller for classifying images

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

For more see the documentation.

pip install mpl-image-labeller

single class per image

multiple classes per image

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()

accessing the axis You can further modify the image (e.g. add masks over them) by using the plotting methods on axis object accessible by labeller.ax.

Lazy Loading Images If you want to lazy load your images you can provide a function to give the images. This function should take the integer idx as an argument and return the image that corresponds to that index. If you do this then you must also provide N_images in the constructor to let the object know how many images it should expect. See examples/lazy_loading.py for an example.

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.

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.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4