|
@@ -1,4 +1,4 @@
|
|
-# Single Image Example
|
|
|
|
|
|
+# Tutorial (Single Image Example)
|
|
|
|
|
|
## Annotation
|
|
## Annotation
|
|
|
|
|
|
@@ -14,7 +14,7 @@ labelme apc2016_obj3.jpg -O apc2016_obj3.json
|
|
To view the json file quickly, you can use utility script:
|
|
To view the json file quickly, you can use utility script:
|
|
|
|
|
|
```bash
|
|
```bash
|
|
-labelme_draw_json examples/single_image/apc2016_obj3.json
|
|
|
|
|
|
+labelme_draw_json apc2016_obj3.json
|
|
```
|
|
```
|
|
|
|
|
|
<img src=".readme/draw_json.jpg" width="70%" />
|
|
<img src=".readme/draw_json.jpg" width="70%" />
|
|
@@ -26,26 +26,26 @@ To convert the json to set of image and label, you can run following:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
```bash
|
|
-labelme_json_to_dataset examples/single_image/apc2016_obj3.json -o examples/single_image/apc2016_obj3_json
|
|
|
|
|
|
+labelme_json_to_dataset apc2016_obj3.json -o apc2016_obj3_json
|
|
```
|
|
```
|
|
|
|
|
|
It generates standard files from the JSON file.
|
|
It generates standard files from the JSON file.
|
|
|
|
|
|
-- [img.png](examples/single_image/apc2016_obj3_json/img.png): Image file.
|
|
|
|
-- [label.png](examples/single_image/apc2016_obj3_json/label.png): Int32 label file.
|
|
|
|
-- [label_viz.png](examples/single_image/apc2016_obj3_json/label_viz.png): Visualization of `label.png`.
|
|
|
|
-- [label_names.txt](examples/single_image/apc2016_obj3_json/label_names.txt): Label names for values in `label.png`.
|
|
|
|
|
|
+- [img.png](apc2016_obj3_json/img.png): Image file.
|
|
|
|
+- [label.png](apc2016_obj3_json/label.png): Int32 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`.
|
|
|
|
|
|
Note that loading `label.png` is a bit difficult
|
|
Note that loading `label.png` is a bit difficult
|
|
(`scipy.misc.imread`, `skimage.io.imread` may not work correctly),
|
|
(`scipy.misc.imread`, `skimage.io.imread` may not work correctly),
|
|
and please use `PIL.Image.open` to avoid unexpected behavior:
|
|
and please use `PIL.Image.open` to avoid unexpected behavior:
|
|
|
|
|
|
```python
|
|
```python
|
|
-# see examples/single_image/load_label_png.py also.
|
|
|
|
|
|
+# see load_label_png.py also.
|
|
>>> import numpy as np
|
|
>>> import numpy as np
|
|
>>> import PIL.Image
|
|
>>> import PIL.Image
|
|
|
|
|
|
->>> label_png = 'examples/single_image/apc2016_obj3_json/label.png'
|
|
|
|
|
|
+>>> label_png = 'apc2016_obj3_json/label.png'
|
|
>>> lbl = np.asarray(PIL.Image.open(label_png))
|
|
>>> lbl = np.asarray(PIL.Image.open(label_png))
|
|
>>> print(lbl.dtype)
|
|
>>> print(lbl.dtype)
|
|
dtype('int32')
|
|
dtype('int32')
|
|
@@ -54,4 +54,3 @@ array([0, 1, 2, 3], dtype=int32)
|
|
>>> lbl.shape
|
|
>>> lbl.shape
|
|
(907, 1210)
|
|
(907, 1210)
|
|
```
|
|
```
|
|
-
|
|
|