Kentaro Wada 2a1b0dd83c Update examples/single_image/README.md 7 rokov pred
..
.readme 135b39eca3 Update README.md 7 rokov pred
apc2016_obj3_json a0c3ece730 tutorial/ -> examples/single_image/ 7 rokov pred
README.md 2a1b0dd83c Update examples/single_image/README.md 7 rokov pred
apc2016_obj3.jpg a0c3ece730 tutorial/ -> examples/single_image/ 7 rokov pred
apc2016_obj3.json a0c3ece730 tutorial/ -> examples/single_image/ 7 rokov pred
load_label_png.py a0c3ece730 tutorial/ -> examples/single_image/ 7 rokov pred

README.md

Single Image Example

Annotation

labelme apc2016_obj3.jpg -O apc2016_obj3.json

Visualization

To view the json file quickly, you can use utility script:

labelme_draw_json examples/single_image/apc2016_obj3.json

Convert to Dataset

To convert the json to set of image and label, you can run following:

labelme_json_to_dataset examples/single_image/apc2016_obj3.json -o examples/single_image/apc2016_obj3_json

It generates standard files from the JSON file.

Note that loading label.png is a bit difficult (scipy.misc.imread, skimage.io.imread may not work correctly), and please use PIL.Image.open to avoid unexpected behavior:

# see examples/single_image/load_label_png.py also.
>>> import numpy as np
>>> import PIL.Image

>>> label_png = 'examples/single_image/apc2016_obj3_json/label.png'
>>> lbl = np.asarray(PIL.Image.open(label_png))
>>> print(lbl.dtype)
dtype('int32')
>>> np.unique(lbl)
array([0, 1, 2, 3], dtype=int32)
>>> lbl.shape
(907, 1210)