%global _empty_manifest_terminate_build 0 Name: python-mpl-image-labeller Version: 1.1.2 Release: 1 Summary: Use interactive matplotlib to label images for classification License: BSD-3-Clause URL: https://mpl-image-labeller.rtfd.io Source0: https://mirrors.nju.edu.cn/pypi/web/packages/b2/a4/147e4bc6074e648908c10cf6b39ebd6dcd176752715825be2056c86efc01/mpl_image_labeller-1.1.2.tar.gz BuildArch: noarch Requires: python3-matplotlib Requires: python3-black Requires: python3-flake8 Requires: python3-flake8-docstrings Requires: python3-ipython Requires: python3-isort Requires: python3-jedi Requires: python3-mypy Requires: python3-pre-commit Requires: python3-pydocstyle Requires: python3-pytest Requires: python3-Sphinx Requires: python3-jupyter-sphinx Requires: python3-myst-nb Requires: python3-numpydoc Requires: python3-sphinx-book-theme Requires: python3-sphinx-copybutton Requires: python3-sphinx-panels Requires: python3-sphinx-thebe Requires: python3-sphinx-togglebutton Requires: python3-pytest %description # mpl-image-labeller [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ianhi/mpl-image-labeller/main?urlpath=lab/tree/docs/examples) [![Documentation Status](https://readthedocs.org/projects/mpl-image-labeller/badge/?version=stable)](https://mpl-image-labeller.readthedocs.io/en/stable/?badge=stable) [![License](https://img.shields.io/pypi/l/mpl-image-labeller.svg?color=green)](https://github.com/ianhi/mpl-image-labeller/raw/master/LICENSE) [![PyPI](https://img.shields.io/pypi/v/mpl-image-labeller.svg?color=green)](https://pypi.org/project/mpl-image-labeller) [![Python Version](https://img.shields.io/pypi/pyversions/mpl-image-labeller.svg?color=green)](https://python.org) Use Matplotlib to label images for classification. Works anywhere Matplotlib does - from the notebook to a standalone gui! For more see the [documentation](https://mpl-image-labeller.readthedocs.io/en/stable/?badge=stable). ## Install ```bash 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 - Displays images with correct aspect ratio - Easily configurable keymap - Smart interactions with default Matplotlib keymap - Callback System (see `examples/callbacks.py`) **single class per image** ![gif of usage for labelling images of cats and dogs](docs/_static/single_class.gif) **multiple classes per image** ![gif of usage for labelling images of cats and dogs](docs/_static/multi_class.gif) ## Usage ```python 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. ### 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. - https://github.com/wbwvos/pidgey - https://github.com/agermanidis/pigeon - https://github.com/Serhiy-Shekhovtsov/tkteach - https://github.com/robertbrada/PyQt-image-annotation-tool - https://github.com/Cartucho/OpenLabeling %package -n python3-mpl-image-labeller Summary: Use interactive matplotlib to label images for classification Provides: python-mpl-image-labeller BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-mpl-image-labeller # mpl-image-labeller [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ianhi/mpl-image-labeller/main?urlpath=lab/tree/docs/examples) [![Documentation Status](https://readthedocs.org/projects/mpl-image-labeller/badge/?version=stable)](https://mpl-image-labeller.readthedocs.io/en/stable/?badge=stable) [![License](https://img.shields.io/pypi/l/mpl-image-labeller.svg?color=green)](https://github.com/ianhi/mpl-image-labeller/raw/master/LICENSE) [![PyPI](https://img.shields.io/pypi/v/mpl-image-labeller.svg?color=green)](https://pypi.org/project/mpl-image-labeller) [![Python Version](https://img.shields.io/pypi/pyversions/mpl-image-labeller.svg?color=green)](https://python.org) Use Matplotlib to label images for classification. Works anywhere Matplotlib does - from the notebook to a standalone gui! For more see the [documentation](https://mpl-image-labeller.readthedocs.io/en/stable/?badge=stable). ## Install ```bash 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 - Displays images with correct aspect ratio - Easily configurable keymap - Smart interactions with default Matplotlib keymap - Callback System (see `examples/callbacks.py`) **single class per image** ![gif of usage for labelling images of cats and dogs](docs/_static/single_class.gif) **multiple classes per image** ![gif of usage for labelling images of cats and dogs](docs/_static/multi_class.gif) ## Usage ```python 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. ### 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. - https://github.com/wbwvos/pidgey - https://github.com/agermanidis/pigeon - https://github.com/Serhiy-Shekhovtsov/tkteach - https://github.com/robertbrada/PyQt-image-annotation-tool - https://github.com/Cartucho/OpenLabeling %package help Summary: Development documents and examples for mpl-image-labeller Provides: python3-mpl-image-labeller-doc %description help # mpl-image-labeller [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ianhi/mpl-image-labeller/main?urlpath=lab/tree/docs/examples) [![Documentation Status](https://readthedocs.org/projects/mpl-image-labeller/badge/?version=stable)](https://mpl-image-labeller.readthedocs.io/en/stable/?badge=stable) [![License](https://img.shields.io/pypi/l/mpl-image-labeller.svg?color=green)](https://github.com/ianhi/mpl-image-labeller/raw/master/LICENSE) [![PyPI](https://img.shields.io/pypi/v/mpl-image-labeller.svg?color=green)](https://pypi.org/project/mpl-image-labeller) [![Python Version](https://img.shields.io/pypi/pyversions/mpl-image-labeller.svg?color=green)](https://python.org) Use Matplotlib to label images for classification. Works anywhere Matplotlib does - from the notebook to a standalone gui! For more see the [documentation](https://mpl-image-labeller.readthedocs.io/en/stable/?badge=stable). ## Install ```bash 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 - Displays images with correct aspect ratio - Easily configurable keymap - Smart interactions with default Matplotlib keymap - Callback System (see `examples/callbacks.py`) **single class per image** ![gif of usage for labelling images of cats and dogs](docs/_static/single_class.gif) **multiple classes per image** ![gif of usage for labelling images of cats and dogs](docs/_static/multi_class.gif) ## Usage ```python 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. ### 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. - https://github.com/wbwvos/pidgey - https://github.com/agermanidis/pigeon - https://github.com/Serhiy-Shekhovtsov/tkteach - https://github.com/robertbrada/PyQt-image-annotation-tool - https://github.com/Cartucho/OpenLabeling %prep %autosetup -n mpl-image-labeller-1.1.2 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-mpl-image-labeller -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Mon May 15 2023 Python_Bot - 1.1.2-1 - Package Spec generated