Giter Site home page Giter Site logo

labelmeai / labelme Goto Github PK

View Code? Open in Web Editor NEW
12.4K 148.0 3.2K 45.68 MB

Image Polygonal Annotation with Python (polygon, rectangle, circle, line, point and image-level flag annotation).

License: Other

Python 99.83% Makefile 0.17%
image-annotation python computer-vision annotations deep-learning semantic-segmentation instance-segmentation video-annotation classification

labelme's People

Contributors

708yamaguchi avatar aboudev avatar akindofyoga avatar aksharpatel47 avatar alexander-g avatar alexmyczko avatar anonymousdouble avatar cclauss avatar cmerchant-camgian avatar eisoku9618 avatar greatv avatar haraduka avatar iamgd67 avatar ilyaovodov avatar jonnedtc avatar latentix avatar latticetower avatar lolipopshock avatar markub3327 avatar mbuijs avatar mpitid avatar narumiruna avatar ompugao avatar pelennor avatar sebastian-ruiz avatar sergeyshilin avatar timgates42 avatar wkentaro avatar wosiu avatar zhangchn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

labelme's Issues

Could you help me a question?

Hello, I use the labelme software of your write recently. But I only need to label two class, one is road, and the other is background. So I want to modify the code, which to achieve the goal: we only mark the road, the rest of the image is not marked could auto marked a class, it it unnecessary to mark by our hands.Could you help me solve it?
Thanks very much.

Visualization Legend Bugs?

Hi,

I have tried to visualize a labeled .json file. But the visualization result is wrong.

Specifically, I labeled one image in labelme and it looks like
image

Then I visualized labeled json file.
image

As you can see, the legend in visualization is wrong.

I guess that the error is caused by overlapped label area between water (red polygon in the first image) and lamppost (blue polygon in the first image)

Is it a bug? Does this error cause wrong label id in final dataset?

Any solutions will be appreciated.

Error in installation.

Hi there,

Im trying to install labelme in a mac (OS Sierra). Everything goes fine until I type "labelme" to launch the GUI. This errors appears:

Traceback (most recent call last):
File "app.py", line 32, in
from PyQt5.QtGui import *
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/sip.so, 2): Symbol not found: _PyCObject_Type
Referenced from: /usr/local/lib/python2.7/site-packages/sip.so
Expected in: flat namespace
in /usr/local/lib/python2.7/site-packages/sip.so

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "app.py", line 37, in
from PyQt4.QtGui import *
ImportError: No module named 'PyQt4'

Any help, very appreciated. Thanks

Generate TFRecord for Deeplab

Hello,
I created with labelme some annotations, and I used labelme_json_to_dataset to convert json files.
Now I want to use generated files to create tfrecord as input for deeplab, to run local_test.sh

Have you got any script or sample to create tfrecord, using files generated in labelme?
I already saw issue #71 but it could be useful a more complete sample.
Thanks

Label all images in a directory

Currently, labelme can be called using -O to preset the output file and the actual image to label as an argument. Using these options one could write a script that iterates over all images in a directory to label them all.

To make labeling all images in a directory more convenient, I think it would be helpful to be able to 'open dir' from the file menu and show a list of the images in the selected directory. Ideally the list would also provide some feedback whether the image is labeled yet.

Label image is Black

Hello,
Thank you for your extra work !!
when i use this command labelme_json_to_dataset, the label image(label.png) seems to be black!!!!
The whole image color is black(graylevel = 0)!! and we need this mask for training
PLease i really need your help
Thank you
Lafi

Visualization doesnt have background

when visualizing my labeling i see the original image with the label on but there is no black background, shouldn't it bt automaticaly generated?

Cannot run labelme

I follow the instruction to install labelme, but there is an error when running it.

File "/usr/local/bin/labelme", line 7, in
from labelme.app import main
File "/usr/local/lib/python2.7/dist-packages/labelme/app.py", line 41, in
from labelme import resources
File "/usr/local/lib/python2.7/dist-packages/labelme/resources.py", line 9, in
from PyQt5 import QtCore
ImportError: No module named PyQt5

I install it with python2.7 in Ubuntu 16.04. It should import PyQt4(which I installed). Why does it import PyQt5 in python2.7?

Thanks!

ubuntu16.04 Annaconda3 install labelme, Run Error!!!

conda create --name=labelme python=2.7
source activate labelme
conda install pyqt
conda install numpy
pip install labelme

**
(labelme) wjy@wjy-Z270X-UD3:~$ pip install labelme
Collecting labelme
Requirement already satisfied: scipy in ./anaconda3/lib/python3.5/site-packages (from labelme)
Requirement already satisfied: Pillow>=2.8.0 in ./anaconda3/lib/python3.5/site-packages (from labelme)
Requirement already satisfied: PyYAML in ./anaconda3/lib/python3.5/site-packages (from labelme)
Requirement already satisfied: matplotlib in ./anaconda3/lib/python3.5/site-packages (from labelme)
Requirement already satisfied: six in ./anaconda3/lib/python3.5/site-packages (from labelme)
Requirement already satisfied: olefile in ./anaconda3/lib/python3.5/site-packages (from Pillow>=2.8.0->labelme)
Requirement already satisfied: numpy>=1.7.1 in ./anaconda3/lib/python3.5/site-packages (from matplotlib->labelme)
Requirement already satisfied: python-dateutil in ./anaconda3/lib/python3.5/site-packages (from matplotlib->labelme)
Requirement already satisfied: pytz in ./anaconda3/lib/python3.5/site-packages (from matplotlib->labelme)
Requirement already satisfied: cycler>=0.10 in ./anaconda3/lib/python3.5/site-packages (from matplotlib->labelme)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 in ./anaconda3/lib/python3.5/site-packages (from matplotlib->labelme)
Installing collected packages: labelme

**
(labelme) wjy@wjy-Z270X-UD3:~$ labelme
Traceback (most recent call last):
File "/home/wjy/anaconda3/envs/labelme/bin/labelme", line 7, in
from labelme.app import main
File "/home/wjy/anaconda3/envs/labelme/lib/python2.7/site-packages/labelme/init.py", line 1, in
from labelme import utils
File "/home/wjy/anaconda3/envs/labelme/lib/python2.7/site-packages/labelme/utils.py", line 8, in
import matplotlib.pyplot as plt
File "/home/wjy/anaconda3/lib/python3.5/site-packages/matplotlib/init.py", line 122, in
from matplotlib.cbook import is_string_like, mplDeprecation, dedent, get_label
File "/home/wjy/anaconda3/lib/python3.5/site-packages/matplotlib/cbook.py", line 32, in
import numpy as np
File "/home/wjy/anaconda3/lib/python3.5/site-packages/numpy/init.py", line 142, in
from . import add_newdocs
File "/home/wjy/anaconda3/lib/python3.5/site-packages/numpy/add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "/home/wjy/anaconda3/lib/python3.5/site-packages/numpy/lib/init.py", line 8, in
from .type_check import *
File "/home/wjy/anaconda3/lib/python3.5/site-packages/numpy/lib/type_check.py", line 11, in
import numpy.core.numeric as _nx
File "/home/wjy/anaconda3/lib/python3.5/site-packages/numpy/core/init.py", line 26, in
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try git clean -xdf (removes all
files not under version control). Otherwise reinstall numpy.

Original error was: cannot import name multiarray

how to extract Encoded PNG for each label for building TF Record

I have trained several datasets, but am new to using mask
RCNN. I have already built a script to do the following with the output JSON file from labelme

  • read image, get height width
  • get normalized box coordinates (calculated by reading the points and getting min, max for X and Y)

my question, is how do I get a serialized PNG image for each label?
example
image/object/mask = ["\x89PNG\r\n\x1A\n\x00\x00\x00\rIHDR\...", ...]

Possibly unused code

https://github.com/wkentaro/labelme/blob/58693e6e9b485c6c61c704095a0f5620d31f2c8a/labelme/app.py#L124
in labelme/app.py
line 117 - 125
listLayout = QVBoxLayout() listLayout.setContentsMargins(0, 0, 0, 0) listLayout.addWidget(self.labelList) self.editButton = QToolButton() self.editButton.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.labelListContainer = QWidget() self.labelListContainer.setLayout(listLayout) listLayout.addWidget(self.editButton)#, 0, Qt.AlignCenter) listLayout.addWidget(self.labelList)

  1. The listLayout added self.labelList twice.
  2. The listLayout added self.editButton, but I didn't see the button in the polygon labels dock. I tested by drawing multiple polygons and delete them, however, there's no sign of this button. Maybe I didn't cover the right usage.
  3. The app works the same if I delete the last two lines of the snippet.

git blame shows that the code was introduced like 6 years ago. The readability will be improved if unused code is deleted.

Label is all zeros

Hi, i labeled my images and for all images the label.png is all zeros. why is this happening? the label_viz is ok and im using binary class ( one class and the rest is background)

TOOL can not zoom in

My environment is python2.7 + pyqt4 + linux (ubuntu 14.04).
And I open an image in labelme. But it can not zoom in.
How to zoom in an image?
Thanks for your help.

How to run labelme_json_to_dataset

I use windows 10 and install labelme by conda.
I can use command labelme but I dont know how to use command labelme_json_to_dataset. When I type it on cmd, it tells me such command does not exist.

labelme_json_to_dataset not generating a right label.png file

As title, I just tried to generate a mask using labelme_json_to_dataset,
it did generate a directory which contains 5 file, and the label_viz.png showed the mask correctly.
However, the generated file label.png was not showing anything, and all of the pixels were 0.
Here's how I checked the pixels:

>>> import numpy as np
>>> import cv2
>>> np.unique(cv2.imread('1/label.png'))
array([0], dtype=uint8)

Please let me know if I was mistaken or making any mistake, thanks!

How to create a COCO-format training set

Thank you for sharing this tool. I'm interested in creating a COCO-format training set. I've looked at the COCO 2017 downloads and they seem to have a set of images and a single JSON file with instance information in it. I think that corresponds to the JSON output of LabelMe but I'm not clear. Is labelme_json_to_dataset intended to create a COCO-style training set?

IOError: cannot identify image file

Traceback (most recent call last): main()
img = utils.img_b64_to_array(data['imageData'])
File "build\bdist.win-amd64\egg\labelme\utils.py", line 39, in img_b64_to_array
File "E:\Anaconda2\lib\site-packages\PIL\Image.py", line 1980, in open
raise IOError("cannot identify image file")
IOError: cannot identify image file

how could I do?

python3, save label data has gone wrong

I am sorry to bother you again.
I test labelme in python3 envoronment, anaconda3.
when I save the label data, there shows an error: "Error saving label data. a bytes-like object is required, not 'str'."
bug

mayde the error caused by in labelFile.py:

def save(self, filename, shapes, imagePath, imageData,
            lineColor=None, fillColor=None):
        try:
            with open(filename, 'wb') as f:
                json.dump(dict(
                    shapes=shapes,
                    lineColor=lineColor, fillColor=fillColor,
                    imagePath=imagePath,
                    imageData=b64encode(imageData)),
                    f, ensure_ascii=True, indent=2)
        except Exception as e:
            raise LabelFileError(e)

with open(filename, 'wb') as f: changed to
with open(filename, 'w') as f: for python3?
I am not sure.

In addition, it is works fine for python2 in ubuntu env.

error happens when I run labelme_json_to_dataset

I cd into my folder where include image files and its corresponding  json files(built success)
But error happens when I run  labelme_json_to_dataset imageName.json in the terminal

OS:ubuntu 14.04

Traceback (most recent call last):
  File "/usr/local/bin/labelme_json_to_dataset", line 45, in <module>
    main()
  File "/usr/local/bin/labelme_json_to_dataset", line 27, in main
    img = utils.img_b64_to_array(data['imageData'])
  File "/usr/local/lib/python2.7/dist-packages/labelme/utils.py", line 36, in img_b64_to_array
    img_arr = np.array(PIL.Image.open(f))
  File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 2028, in open
    raise IOError("cannot identify image file")
IOError: cannot identify image file

Is this a bug of the source code?

The output of label.png is the black.

After the operation of Convert to Dataset. The output of label.png is all the black. The depth of the image is 16. But the image size is the 60kb. Did anyone have this problem?

one error

when I use labelme_json_to_dataset , error like the following:
(labelme) F:\labelme>python .\scripts\labelme_json_to_dataset .\mytest\test1.json
Traceback (most recent call last):
File ".\scripts\labelme_json_to_dataset", line 45, in
main()
File ".\scripts\labelme_json_to_dataset", line 30, in main
lbl_viz = utils.draw_label(lbl, img, lbl_names)
File "C:\Anaconda2\envs\labelme\lib\site-packages\labelme\utils.py", line 89, in draw_label
label_viz = label2rgb(label, img, n_labels=len(label_names))
File "C:\Anaconda2\envs\labelme\lib\site-packages\labelme\utils.py", line 57, in label2rgb
lbl_viz = alpha * lbl_viz + (1 - alpha) * img_gray
MemoryError

and how much is the max polygen points?

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/......

I had this error when I install labelme on my macbook.

(venv) ➜  labelme git:(zxdev) brew install pyqt 
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
baresip                   bento4                    cimg                      cppad                     folly                     gmic                      paket                     urh

Warning: pyqt 5.9_1 is already installed
(venv) ➜  labelme git:(zxdev) pip install labelme
Collecting labelme
  Using cached labelme-2.6.2.tar.gz
    Complete output from command python setup.py egg_info:
    Please install PyQt4 or PyQt5.
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/f_/shl432s55dl5766kw7tc5zsr0000gn/T/pip-build-kZKPyQ/labelme/

Installing on windows

For windows this

conda create --name=labelme python=2.7
source activate labelme
conda install pyqt
pip install labelme

should be (I have anaconda python 3.6)

conda install pyqt
cd labelme-master
conda create --name=labelme python=3.6
activate labelme
pip install labelme

For some reason I can install conda install pyqt only outside of env, otherwise I get error:

CondaEnvironmentNotFoundError: Could not find environment: C:\Users\myuser\Anaco
nda3\envs\labelme .
You can list all discoverable environments with `conda info --envs`.

Option to merge polygons

In some images the middle of an object is occluded, causing two disjoint polygons belonging to the same instance. It would be nice if there was an option to merge polygons into a single object.

Nice tool by the way, thanks for making this!

consistency of label colors to multiple images

I have a question about using labelme to create image labels for training the fully convolutional network (FCN). I find the color of the label depends on the order of creating the polygon: 2 objects will be labelled with red and green color. But what if I have another 2 different objects on an new image? The label color for them will still be red and green, which would affect the label images for training the segmentation model. How can I make sure the label color of the same object on different images is the same? Thanks.

label.png is a black image

Hi all
the sample apc2016_obj3.png generated by labelme_json_to_data is a totally black image, how can it be a label image for a FCN model?

FileType Support?

Hello, I have set up the Labelme. However, it seems to only support the filetype like *.b'bmp'...
So I don‘t know how to use it. Besides, when I use your example codes, it has gone wrong. Problem presented as follows: "Error saving label data, a bytes-like object is required, not 'str' "

Can you tell me how to solve this problem? Thank you

How to contribute to labelme

for this repo, I am trying to use PyCharm for all me development and deployment. how do you guys currently test and deploy? I know how to use GIT, however this library has no callers for me to execute in pycharm or an IDE. I know running the setup will generate the exe file for me (labelme) in the bin folder.

I am able to run by calling main() in app.py, however none of the icons or anything loads.
please any tips? I want to start contributing.

problem viewing mask using labelme_json_to_dataset

Hi.
the utility looks great.
however, I was unable to view the mask saved to the *.json file.

I tried running
labelme_json_to_dataset , but got the following messege:
'labelme_draw_json' is not recognized as an internal or external command,
operable program or batch file.

I ran the anaconda installation and the GUI works fine.

Thanks

Problems on Windows

I use it on Windows. There isn't a file after I click save. I can't find the 'json' file.

Error in installation with ubuntu

When I use these commands to install the application, error. How to solve this problem?

Ubuntu
sudo apt-get install python-qt4 pyqt4-dev-tools
sudo pip install labelme

root@wangzheng:~# pip install labelme
The directory '/home/wangxheng/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/wangxheng/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting labelme
Downloading labelme-2.6.4.tar.gz (201kB)
100% |████████████████████████████████| 204kB 99kB/s
Requirement already satisfied: matplotlib in /usr/local/lib/python2.7/dist-packages (from labelme)
Requirement already satisfied: Pillow>=2.8.0 in /usr/local/lib/python2.7/dist-packages (from labelme)
Requirement already satisfied: scipy in /usr/local/lib/python2.7/dist-packages (from labelme)
Requirement already satisfied: six in /usr/local/lib/python2.7/dist-packages (from labelme)
Requirement already satisfied: PyYAML in /usr/lib/python2.7/dist-packages (from labelme)
Requirement already satisfied: numpy>=1.7.1 in /usr/local/lib/python2.7/dist-packages (from matplotlib->labelme)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python2.7/dist-packages (from matplotlib->labelme)
Requirement already satisfied: pytz in /usr/local/lib/python2.7/dist-packages (from matplotlib->labelme)
Requirement already satisfied: subprocess32 in /usr/local/lib/python2.7/dist-packages (from matplotlib->labelme)
Requirement already satisfied: python-dateutil>=2.0 in /usr/local/lib/python2.7/dist-packages (from matplotlib->labelme)
Requirement already satisfied: backports.functools-lru-cache in /usr/local/lib/python2.7/dist-packages (from matplotlib->labelme)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python2.7/dist-packages (from matplotlib->labelme)
Installing collected packages: labelme
Running setup.py install for labelme ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-2IkUCH/labelme/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-46kHpg-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
Please install pyrcc5 command.
(See https://github.com/wkentaro/labelme.git)

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-2IkUCH/labelme/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-46kHpg-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-2IkUCH/labelme/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.