Skip to content

Commit

Permalink
single_image -> tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Apr 4, 2018
1 parent 2a1b0dd commit 37c8d48
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 16 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ wget https://raw.githubusercontent.com/wkentaro/labelme/master/scripts/labelme_o
chmod u+x labelme_on_docker

# Maybe you need http://sourabhbajaj.com/blog/2017/02/07/gui-applications-docker-mac/ on macOS
labelme_on_docker examples/single_image/apc2016_obj3.jpg -O examples/single_image/apc2016_obj3.json
labelme_on_docker examples/tutorial/apc2016_obj3.jpg -O examples/tutorial/apc2016_obj3.json
labelme_on_docker examples/semantic_segmentation/data_annotated
```

Expand Down Expand Up @@ -92,8 +92,8 @@ The annotations are saved as a [JSON](http://www.json.org/) file.
```bash
labelme # just open gui

# single image example
cd examples/single_image
# tutorial (single image example)
cd examples/tutorial
labelme apc2016_obj3.jpg # specify image file
labelme apc2016_obj3.jpg -O apc2016_obj3.json # close window after the save
labelme apc2016_obj3.jpg --nodata # not include image data but relative image path in JSON file
Expand All @@ -108,7 +108,7 @@ labelme data_annotated/ --labels labels.txt # specify label list with a file

For more advanced usage, please refer to the examples:

* [Single Image Example](examples/single_image)
* [Tutorial (Single Image Example)](examples/tutorial)
* [Semantic Segmentation Example](examples/semantic_segmentation)
* [Instance Segmentation Example](examples/instance_segmentation)

Expand Down
File renamed without changes
File renamed without changes
19 changes: 9 additions & 10 deletions examples/single_image/README.md → examples/tutorial/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Single Image Example
# Tutorial (Single Image Example)

## Annotation

Expand All @@ -14,7 +14,7 @@ labelme apc2016_obj3.jpg -O apc2016_obj3.json
To view the json file quickly, you can use utility script:

```bash
labelme_draw_json examples/single_image/apc2016_obj3.json
labelme_draw_json apc2016_obj3.json
```

<img src=".readme/draw_json.jpg" width="70%" />
Expand All @@ -26,26 +26,26 @@ To convert the json to set of image and label, you can run following:


```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.

- [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
(`scipy.misc.imread`, `skimage.io.imread` may not work correctly),
and please use `PIL.Image.open` to avoid unexpected behavior:

```python
# see examples/single_image/load_label_png.py also.
# see load_label_png.py also.
>>> import numpy as np
>>> 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))
>>> print(lbl.dtype)
dtype('int32')
Expand All @@ -54,4 +54,3 @@ array([0, 1, 2, 3], dtype=int32)
>>> lbl.shape
(907, 1210)
```

File renamed without changes
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/data/apc2016_obj3.jpg
2 changes: 1 addition & 1 deletion tests/data/apc2016_obj3.json

0 comments on commit 37c8d48

Please sign in to comment.