Multi Class#

You can also allow each image to belong to multiple categories with the multiclass argument.

# If in a notebook:
%matplotlib ipympl
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"],
    multiclass=True,
)
plt.show()

The natural representation of this multiclass is a onehot encoding accessible (and settable!) via the labels_onehot property.

print(labeller.labels_onehot)

If you can you can also get the labels as a ragged list of lists via the labels property

print(labeller.labels)