Labelme is a graphical image annotation tool, It is written in Python and uses Qt for its graphical interface

Overview


labelme

Image Polygonal Annotation with Python


Description

Labelme is a graphical image annotation tool inspired by http://labelme.csail.mit.edu.
It is written in Python and uses Qt for its graphical interface.


VOC dataset example of instance segmentation.


Other examples (semantic segmentation, bbox detection, and classification).


Various primitives (polygon, rectangle, circle, line, and point).

Features

Requirements

Installation

There are options:

Anaconda

You need install Anaconda, then run below:

# python2
conda create --name=labelme python=2.7
source activate labelme
# conda install -c conda-forge pyside2
conda install pyqt
pip install labelme
# if you'd like to use the latest version. run below:
# pip install git+https://github.com/wkentaro/labelme.git

# python3
conda create --name=labelme python=3.6
source activate labelme
# conda install -c conda-forge pyside2
# conda install pyqt
# pip install pyqt5  # pyqt5 can be installed via pip on python3
pip install labelme
# or you can install everything by conda command
# conda install labelme -c conda-forge

Docker

You need install docker, then run below:

# on macOS
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\" &
docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=docker.for.mac.host.internal:0 -v $(pwd):/root/workdir wkentaro/labelme

# on Linux
xhost +
docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=:0 -v $(pwd):/root/workdir wkentaro/labelme

Ubuntu

# Ubuntu 14.04 / Ubuntu 16.04
# Python2
# sudo apt-get install python-qt4  # PyQt4
sudo apt-get install python-pyqt5  # PyQt5
sudo pip install labelme
# Python3
sudo apt-get install python3-pyqt5  # PyQt5
sudo pip3 install labelme

# or install standalone executable from:
# https://github.com/wkentaro/labelme/releases

Ubuntu 19.10+ / Debian (sid)

sudo apt-get install labelme

macOS

brew install pyqt  # maybe pyqt5
pip install labelme  # both python2/3 should work

brew install wkentaro/labelme/labelme  # command line interface
# brew install --cask wkentaro/labelme/labelme  # app

# or install standalone executable/app from:
# https://github.com/wkentaro/labelme/releases

Windows

Install Anaconda, then in an Anaconda Prompt run:

# python3
conda create --name=labelme python=3.6
conda activate labelme
pip install labelme

Usage

Run labelme --help for detail.
The annotations are saved as a JSON file.

labelme  # just open gui

# tutorial (single image example)
cd examples/tutorial
labelme apc2016_obj3.jpg  # specify image file
labelme apc2016_obj3.jpg -O apc2016_obj3.json  # close window after the save
labelme apc2016_obj3.jpg --nodata  # not include image data but relative image path in JSON file
labelme apc2016_obj3.jpg \
  --labels highland_6539_self_stick_notes,mead_index_cards,kong_air_dog_squeakair_tennis_ball  # specify label list

# semantic segmentation example
cd examples/semantic_segmentation
labelme data_annotated/  # Open directory to annotate all images in it
labelme data_annotated/ --labels labels.txt  # specify label list with a file

For more advanced usage, please refer to the examples:

Command Line Arguments

  • --output specifies the location that annotations will be written to. If the location ends with .json, a single annotation will be written to this file. Only one image can be annotated if a location is specified with .json. If the location does not end with .json, the program will assume it is a directory. Annotations will be stored in this directory with a name that corresponds to the image that the annotation was made on.
  • The first time you run labelme, it will create a config file in ~/.labelmerc. You can edit this file and the changes will be applied the next time that you launch labelme. If you would prefer to use a config file from another location, you can specify this file with the --config flag.
  • Without the --nosortlabels flag, the program will list labels in alphabetical order. When the program is run with this flag, it will display labels in the order that they are provided.
  • Flags are assigned to an entire image. Example
  • Labels are assigned to a single polygon. Example

FAQ

Testing

pip install hacking pytest pytest-qt
flake8 .
pytest -v tests

Developing

git clone https://github.com/wkentaro/labelme.git
cd labelme

# Install anaconda3 and labelme
curl -L https://github.com/wkentaro/dotfiles/raw/main/local/bin/install_anaconda3.sh | bash -s .
source .anaconda3/bin/activate
pip install -e .

How to build standalone executable

Below shows how to build the standalone executable on macOS, Linux and Windows.

# Setup conda
conda create --name labelme python==3.6.0
conda activate labelme

# Build the standalone executable
pip install .
pip install pyinstaller
pyinstaller labelme.spec
dist/labelme --version

How to contribute

Make sure below test passes on your environment.
See .github/workflows/ci.yml for more detail.

pip install black hacking pytest pytest-qt

flake8 .
black --line-length 79 --check labelme/
MPLBACKEND='agg' pytest tests/ -m 'not gpu'

Acknowledgement

This repo is the fork of mpitid/pylabelme.

Comments
  • An error occurred while aiming at the boundary

    An error occurred while aiming at the boundary

    Traceback (most recent call last): File "D:\ProgramData\Anaconda3\lib\site-packages\labelme-3.14.1-py3.6.egg\labelme\widgets\canvas.py", line 216, in mouseMoveEvent self.boundedMoveVertex(pos) File "D:\ProgramData\Anaconda3\lib\site-packages\labelme-3.14.1-py3.6.egg\labelme\widgets\canvas.py", line 415, in boundedMoveVertex pos = self.intersectionPoint(point, pos) File "D:\ProgramData\Anaconda3\lib\site-packages\labelme-3.14.1-py3.6.egg\labelme\widgets\canvas.py", line 560, in intersectionPoint d, i, (x, y) = min(self.intersectingEdges((x1, y1), (x2, y2), points)) ValueError: min() arg is an empty sequence

    opened by dawin2015 43
  • [BUG] labelme does not read jpg images

    [BUG] labelme does not read jpg images

    Describe the bug In version 4.2.9, it still reads the jpg images. But after I upgraded to >=4.3, it stops reading the jpg images. You can see clearly this issue by trying to open an image and in the list of image types, you won't find the jpg in there.

    To Reproduce Steps to reproduce the behavior:

    1. Install labelme 4.3 using pip install labelme==4.3 or any latest version
    2. Try to open the image with Open button.
    3. You will find out that you won't see jpg images.

    Expected behavior The jpg images must be seen.

    Screenshots This is an example of version 4.2.9 (which have jpg type in the list) image

    This is version 4.5.1 (does not have jpg in the list) image

    Desktop (please complete the following information):

    • OS: Windows 10
    • Labelme Version > 4.3

    Additional context Maybe this is an intended feature because it cannot be a mistake that some guys decided to remove jpg and other extensions from the list. But then why do this? It causes a backward compatibility issue.

    opened by off99555 23
  • I cannot set the file as .jpg

    I cannot set the file as .jpg

    labelme_json_to_dataset An_Zhong_Left_1.json -o An_Zhong_Left_1_json lvelvelve:~ beauty$ labelme_json_to_dataset An_Zhong_Left_1.json -o An_Zhong_Left_1_json /Users/beauty/anaconda3/lib/python3.7/site-packages/labelme/cli/json_to_dataset.py:15: UserWarning: This script is aimed to demonstrate how to convert the JSON file to a single image dataset, and not to handle multiple JSON files to generate a real-use dataset. warnings.warn("This script is aimed to demonstrate how to convert the\n" Traceback (most recent call last): File "/Users/beauty/anaconda3/bin/labelme_json_to_dataset", line 11, in sys.exit(main()) File "/Users/beauty/anaconda3/lib/python3.7/site-packages/labelme/cli/json_to_dataset.py", line 34, in main data = json.load(open(json_file)) FileNotFoundError: [Errno 2] No such file or directory: 'An_Zhong_Left_1.json'

    my mistakes are above , what should I do?

    opened by Ashlyn0628 20
  • Easy way to change color of a label [Feature]

    Easy way to change color of a label [Feature]

    Is your feature request related to a problem? Please describe. To the best of my knowledge, the graphical user interface does not provide an easy way to change the color of a label.

    Describe the solution you'd like My suggestion is to have a context menu that opens up if the user clicks on a label in the 'Label List' on the right. The context menu could have an entry that is called 'change color'. This opens up a color selection dialog or at least lets you enter the RGB or HEX code of a color.

    Describe alternatives you've considered An alternative option could be to add an entry in the context menu that opens up if you right click on a polygon (or circle, or rectangle) and provide the color change option in there.

    Additional context labelme-screeny

    opened by beyse 17
  • Zooming fix

    Zooming fix

    3 main changes:

    1. Fixes scroll wheel zooming in my Ubuntu setup.
    2. Zoom shortcut adjusted to be more similar to browsers: Ctrl+0 to zoom to 100%, Ctrl+= to zoom in, Ctrl+- to zoom out.
    3. Zoom into the cursor location instead of towards (0,0).

    Regarding the Ubuntu setup: pixelDelta() is always 0 in my case, this is mentioned in the Qt documentation as a X11 specific issue: https://doc.qt.io/qt-5/qwheelevent.html#pixelDelta. I now changed it to angleDelta() instead, which based on the documentation I would expect to work on all platforms. However I don't have a Mac to test it.

    opened by mbuijs 16
  • Question about group ID

    Question about group ID

    I'm labeling for a instances segmentation project. The number of my class is one. And the class is cow. I notice that there is a new option group ID. I know I need to fill the object label with cow-1, cow-2... But the group ID of them should be the same or not?

    opened by Coconut443 15
  • Display polygon labels in the image itself.

    Display polygon labels in the image itself.

    Right now to know the label assigned to a polygon we have to check by de-selecting that particular instance of the label. This is a trail and error method and takes considerable amount of to recheck which label a particular polygon has been assigned. Is there a way to display label names around each polygon?

    opened by krishvishal 15
  • an error caused by non-latin label

    an error caused by non-latin label

    hi, I try to use the labelme tool to annotate the ocr dataset, and someone annotated some Chinese to the label in his computer, I use the json files and open the labelme tool, the error encountered like the following pic. How to fix this error, please help me, thanks.

    1556279866317

    the json file looks like this:

    1556279943371

    opened by passion3394 14
  • decode image string embedded in json

    decode image string embedded in json

    labelme saves everything (image and labels/polygons) in json files. I am trying to decode the image string that is stored along with the polygon-points in the json files in python, so I can convert both to a numpy-array and use the points to draw a binary mask (some models like mask rcnn don't use json, but require numpy-arrays for training).

    What type of encoding is used to store the image in the json files? (under "imageData")

    opened by mluerig 14
  • Aborted (core dumped)

    Aborted (core dumped)

    @latticetower @wkentaro

    when running labelme the following error pops up

    image following this stack I installed open-cv by pip3 install opencv-python==4.1.2.30 but it didnt fix the problem either.

    bug 
    opened by mfaramarzi 13
  • How to label a single category with labelme?

    How to label a single category with labelme?

    How to label a single category with labelme? After looking at the user-defined data set, there is no annotation naming method. For example, there is only one category in a graph: cat, cat, cat or cat1, cat2, Cat3 or cat-0, cat-1, cat-2, https://github.com/dbolya/yolact/issues/141

    opened by seawater668 12
  • Application shutdowns when sliding shapes out of bixmap

    Application shutdowns when sliding shapes out of bixmap

    When sliding the shape out of bixmap, the application stops and complains that the parameters of QtCore.QPoint methods need to be int instead of float.

    pos += QtCore.QPoint( TypeError: arguments did not match any overloaded call: QPoint(): too many arguments QPoint(int, int): argument 1 has unexpected type 'float' QPoint(QPoint): argument 1 has unexpected type 'float'

    opened by mhannani 0
  • This application failed to start because no Qt platform plugin could be initialized

    This application failed to start because no Qt platform plugin could be initialized

    Provide environment information

    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/pidl/.local/lib/python3.9/site-packages/cv2/qt/plugins" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

    Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.

    What OS are you using?

    Ubuntu 20.04

    Describe the Bug

    When I run labelme Folder. The bug happens

    Expected Behavior

    No response

    To Reproduce

    No response

    bug 
    opened by haithienld 2
  • Support High DPI Displays

    Support High DPI Displays

    Add new feature that supporting high DPI displays.

    When I switch position of labelme window from 4K display to FHD one and vice versa, scale of labels on 'Polygon Labels' does not match OS setting. So I add this feature, and it looks well.

    opened by pelennor 0
  • Mark lines for training but get areas

    Mark lines for training but get areas

    Provide environment information

    Python 3.7.13 labelme 5.0.0

    What OS are you using?

    Ubuntu 20.04.4

    Describe the Bug

    I use labelme to label linestrip SogouScreenshot_select-area_20221112102938 and use labelme2coco.py to get the coco data set of linestrip. SogouScreenshot_select-area_20221112103127

    But when I use this coco data for training, the predicted result is red region instead of linestrip. SogouScreenshot_select-area_20221112122202

    Why is that?

    Expected Behavior

    No response

    To Reproduce

    No response

    bug 
    opened by 1215232494 3
  • labelme2coco.py crash when just contines __ignore__ label

    labelme2coco.py crash when just contines __ignore__ label

    Provide environment information

    (DET2) D:\FPCs>python --version Python 3.9.13

    (DET2) D:\FPCs>pip list labelme Package Version Editable project location


    labelme 5.0.5

    What OS are you using?

    windows11

    Describe the Bug

    (DET2) D:\FPCs>python D:/DeepLearning/labelme/examples/instance_segmentation/labelme2coco.py --labels classes.txt 000003 labels Creating dataset: labels Generating dataset from: 000003\dog.json Traceback (most recent call last): File "D:\DeepLearning\labelme\examples\instance_segmentation\labelme2coco.py", line 209, in main() File "D:\DeepLearning\labelme\examples\instance_segmentation\labelme2coco.py", line 184, in main labels, captions, masks = zip( ValueError: not enough values to unpack (expected 3, got 0)

    Expected Behavior

    Skip the label file

    To Reproduce

    1. Just set ignore label of an image
    2. Create classes.txt file
    3. run labelme2coco.py
    bug 
    opened by withkun 1
Releases(v5.1.1)
Owner
Kentaro Wada
I'm a final-year PhD student at Imperial College London working on computer vision and robotics.
Kentaro Wada
Convert the SVG code to PNG and replace the line by a call to the image in markdown

Convert the SVG code to PNG and replace the line by a call to the image in markdown

6 Sep 06, 2022
This piece of code is a User Welcomer with Image Manipulation using Python and Pillow (PIL).

This piece of code is a User Welcomer with Image Manipulation using Python and Pillow (PIL).

Bero 4 Jan 11, 2022
Convert Image to ASCII Art

Convert Image to ASCII Art Persiapan aplikasi ini menggunakan bahasa python dan beberapa package python. oleh karena itu harus menginstall python dan

Huda Damar 48 Dec 20, 2022
sK1 2.0 cross-platform vector graphics editor

sK1 2.0 sK1 2.0 is a cross-platform open source vector graphics editor similar to CorelDRAW, Adobe Illustrator, or Freehand. sK1 is oriented for prepr

sK1 Project 238 Dec 04, 2022
🎨 Generate and change color-schemes on the fly.

Generate and change color-schemes on the fly. Pywal is a tool that generates a color palette from the dominant colors in an image. It then applies the

dylan 6.9k Jan 03, 2023
Python framework for creating and scaling up production of vector graphics assets.

Board Game Factory Contributors are welcome here! See the end of readme. This is a vector-graphics framework intended for creating and scaling up prod

Adam Volný 5 Jul 13, 2022
This script is for photographers to do timeslice with one click.

One Click TimeSlice Tool What is this for This is for photographers who want to create TimeSlice pictures without installing PS plugins. Before using

Xi Zhao 13 Sep 23, 2022
Computer art based on quadtrees.

Quads Computer art based on quadtrees. The program targets an input image. The input image is split into four quadrants. Each quadrant is assigned an

Michael Fogleman 1.1k Dec 23, 2022
A simple python script to reveal the contents of a proof of vaccination QR code.

vaxidecoder A simple python script to reveal the contents of a proof of vaccination QR code. It takes a QR code image as input, and returns JSon data.

Hafidh 2 Feb 28, 2022
hashmask reverse lookup

ImageHashMasks Lookup Hashmask NFT index from a picture Setup pip install pillow click imagehash Usage $ python imagehashmasks.py

17 Nov 29, 2021
Group of interfaces interesting for users

Project: Interface to create GIF animation based on Fourier Series.

5 Aug 17, 2021
A procedural Blender pipeline for photorealistic training image generation

BlenderProc2 A procedural Blender pipeline for photorealistic rendering. Documentation | Tutorials | Examples | ArXiv paper | Workshop paper Features

DLR-RM 1.8k Jan 02, 2023
Multi-view 3D reconstruction using neural rendering. Unofficial implementation of UNISURF, VolSDF, NeuS and more.

Multi-view 3D reconstruction using neural rendering. Unofficial implementation of UNISURF, VolSDF, NeuS and more.

Jianfei Guo 683 Jan 04, 2023
⚡ZenGL is a minimalist Python module providing exactly one way to render scenes with OpenGL.

ZenGL is a minimalist Python module providing exactly one way to render scenes with OpenGL.

Szabolcs Dombi 133 Dec 17, 2022
With this simple py script you will be able to get all the .png from a folder and generate a yml for Oraxen

Oraxen-item-to-yml With this simple py script you will be able to get all the .png from a folder and generate a yml for Oraxen How to use Install the

Akex 1 Dec 29, 2021
An automated Comic Book downloader (cbr/cbz) for use with SABnzbd, NZBGet and torrents

Mylar Note that feature development has stopped as we have moved to Mylar3. EOL for this project is the end of 2020 and will no longer be supported. T

979 Dec 13, 2022
An ascii art generator that's actually good. Does edge detection and selects the most appropriate characters.

Ascii Artist An ascii art generator that's actually good. Does edge detection and selects the most appropriate characters. Installing Installing with

18 Jan 03, 2023
ImageStrike是一款用于CTF中图片隐写的综合利用工具

🎈 简介 ImageStrike是一款使用PyQT5开发,用于CTF中图片隐写的综合利用工具

zR00t1 133 Dec 27, 2022
Fill holes in binary 2D & 3D images fast.

Fill holes in binary 2D & 3D images fast.

11 Dec 09, 2022
imgAnalyser - Un script pour obtenir la liste des pixels d'une image correspondant à plusieurs couleurs

imgAnalyser - Un script pour obtenir la liste des pixels d'une image correspondant à plusieurs couleurs Ce script à pour but, à partir d'une image, de

Théo Migeat 1 Nov 15, 2021