wkentaro / labelme Goto Github PK
View Code? Open in Web Editor NEWImage Polygonal Annotation with Python (polygon, rectangle, circle, line, point and image-level flag annotation).
Home Page: https://labelme.io
License: Other
Image Polygonal Annotation with Python (polygon, rectangle, circle, line, point and image-level flag annotation).
Home Page: https://labelme.io
License: Other
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?
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
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\...", ...]
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)
I can't actually save a file on mac OS running python 3.6.2. Every time I try to save I get:
AttributeError: 'bytes' object has no attribute 'encode'
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
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
Then I visualized labeled json file.
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.
While saving the json, I get the following error. Any idea to resolve this issue?
a bytes-like object is required, not 'str'
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.
Is there any way I can get coordinates of an object ?
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
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?
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?
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?
I use it on Windows. There isn't a file after I click save. I can't find the 'json' file.
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
It would be great if I can check in GUI to not save imageData
in json and to make imagePath
relative to folder with images.
EDIT: premature complaint, please delete
i can install labelme on windows and ubuntu sucessfully. the problem is that when i use labeme to label the image,It will exit the GUI when i slide the mouse pulley
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/
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?
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/
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`.
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.
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!
Help me, thanks!
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)
git blame shows that the code was introduced like 6 years ago. The readability will be improved if unused code is deleted.
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.
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?
Installation is not difficult, but there is still a need to look up some information.
So ,how to create a exe file by pyinstaller or py2exe?
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!
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
sometimes connect two points by mistake, cause the program crash!!!!!!
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'."
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.
It would be great to have ctrl + mouse wheel
for zoom functionality like LabelImg have ( https://github.com/tzutalin/labelImg )
And also this functionality (which LabelImg not yet have):
HumanSignal/labelImg#194
all the label.png generated are zeros
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
win10
Anaconda3
python3.6.4
qt5
setup.py
if sys.argv[1] == 'release':
IndexError: list index out of range
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.
Walking through the tutorial I did not find any suggestion about running label me on window? Can you give any advice to me?
I would like to know how to change the output label.png of 16-bit color to 8-bit color. I am confused about this. Is there anything like gray=True or something like this?
Anyone helps.... Thanks a lot.
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?
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
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.
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!
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.
Appveyor hangs, so I disabled it.
Hi,Thanks for sharing the code,I find a BUG that when I use the tool,if i sliding mouse,the tool will exit。what i have to do if i want to run the code and fix the bug?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.