File: README.md

package info (click to toggle)
labelme 5.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 31,728 kB
  • sloc: python: 6,012; xml: 147; makefile: 22
file content (66 lines) | stat: -rw-r--r-- 1,494 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Tutorial (Single Image Example)

## Annotation

```bash
labelme apc2016_obj3.jpg -O apc2016_obj3.json
```

![](.readme/annotation.jpg)


## Visualization

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

```bash
labelme_draw_json apc2016_obj3.json
```

<img src=".readme/draw_json.jpg" width="70%" />


## Convert to Dataset

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


```bash
labelme_export_json apc2016_obj3.json -o apc2016_obj3_json
```

It generates standard files from the JSON file.

- [img.png](apc2016_obj3_json/img.png): Image file.
- [label.png](apc2016_obj3_json/label.png): uint8 label file.
- [label_viz.png](apc2016_obj3_json/label_viz.png): Visualization of `label.png`.
- [label_names.txt](apc2016_obj3_json/label_names.txt): Label names for values in `label.png`.

## How to load label PNG 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:

```python
# see load_label_png.py also.
>>> import numpy as np
>>> import PIL.Image

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

Also, you can see the label PNG file by:

```python
labelme_draw_label_png apc2016_obj3_json/label.png
```

<img src=".readme/draw_label_png.jpg" width="35%" />