Skip to content

Commit 97bf194

Browse files
authored
Update documentation (#27)
* Update README.md * Update API doc
1 parent d19fbc7 commit 97bf194

9 files changed

+147
-52
lines changed

README.md

+36-35
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
![CI-Badge](https://github.com/palaimon/ipyannotator/workflows/CI/badge.svg)
44

5-
Ipyannotator is a flexible annotation system. The library contains some pre-defined annotators that can be used out of the box, but it also can be extend and customized according to the users needs.
5+
Ipyannotator is a flexible annotation system. Developed to allow users to hack its features by extending and customizing it.
6+
7+
The large variety of annotation tasks, data formats and data visualizations is a challenging when dealing with multiple domains of supervised machine learning (ML). The existent tooling is often not flexible enough which imposes limitations to the user. By providing a framework where users can use, customize and create their own annotation tooling this projects aims to solve this problem.
8+
9+
The library contains some pre-defined annotators that can be used out of the box, but it also can be extend and customized according to the users needs. Check our [tutorials](https://palaimon.github.io/ipyannotator/docs/tutorials.html) for a quickly understanding of it's usage and check our [API](https://palaimon.github.io/ipyannotator/nbs/21_api_doc.html) for quick reference.
10+
11+
This library has been written in the [literate programming style](https://en.wikipedia.org/wiki/Literate_programming) popularized for jupyter notebooks by [nbdev](https://www.fast.ai/2019/12/02/nbdev/). In addition to our [online documentation](palaimon.github.io/ipyannotator) the jupyter notebooks located at `nbs/` allow an interactive exploration of the inner workings of Ipyannotator.
612

713
We hope this repository helps you to explore how annotation UI's can be quickly built using only python code and leveraging many awesome libraries ([ipywidgets](https://github.com/jupyter-widgets/ipywidgets), [voila](https://github.com/voila-dashboards/voila), [ipycanvas](https://github.com/martinRenou/ipycanvas), etc.) from the [jupyter Eco-system](https://jupyter.org/).
814

@@ -14,59 +20,52 @@ Please let us know if you find this repository useful. Your feedback will help u
1420

1521
## Install
1622

23+
Ipyannotator is available on Pypi and can be installed using:
24+
1725
`pip install ipyannotator`
1826

19-
**dependencies (should be handled by pip)**
27+
## Running ipyannotator
2028

21-
```
22-
python = "^3.7"
23-
traitlets = '=4.3.3'
24-
ipycanvas = "^0.5.1"
25-
ipyevents = "^0.8.0"
26-
ipywidgets = "^7.5.1"
27-
```
29+
Ipyannotator provides a [simple API](https://palaimon.github.io/ipyannotator/nbs/21_api_doc.html) that provides the ability to explore, create and improve annotation datasets by using a pair of input/outputs. All pair of input/output are [listed on Ipyannotator's docs](https://palaimon.github.io/ipyannotator/nbs/22_input_output_doc.html). Check [Ipyannotator tutorials](https://palaimon.github.io/ipyannotator/docs/tutorials.html) for a quickly demonstration of the library.
30+
31+
### Run ipyannotator tests
32+
33+
The tests can be executed using `nbdev_test_nbs` on the terminal.
34+
35+
Ipyannotator notebooks contains the development dependencies: [pytest](https://docs.pytest.org/en/7.1.x/) and [ipytest](https://github.com/chmp/ipytest). Make sure this dependencies are installed to run the tests.
36+
37+
### Run ipyannotator as stand-alone web app using voila
38+
39+
Ipyannotator can be executed as a web app using the [voila](https://github.com/voila-dashboards/voila) library. The following sections describe how to run using poetry and pip.
2840

29-
## Run ipyannotator as stand-alone web app using voila
41+
#### Using poetry
3042

31-
Using `poetry`:
43+
On your terminal:
3244

33-
install:
3445
```shell
3546
cd {project_root}
3647
poetry install --no-dev
37-
poetry run pip install voila
3848
```
39-
and run simple ipyannotator standalone example:
40-
```shell
49+
50+
Any jupyter notebook with ipyannotator can be executed as an standalone web application. An example of voila usage it's available in the current repository and can be executed as it follow:
51+
52+
```shell
4153
poetry run voila nbs/09_voila_example.ipynb --enable_nbextensions=True
4254
```
43-
44-
Same with `pip`:
55+
56+
#### Using pip
57+
58+
The installation and execution process can also be done using pip.
4559

4660
```shell
4761
cd {project_root}
4862

49-
pip install .
63+
pip install .
5064
pip install voila
5165

5266
voila nbs/09_voila_example.ipynb --enable_nbextensions=True
5367
```
5468

55-
## Documentation
56-
57-
This library has been written in the [literate programming style](https://en.wikipedia.org/wiki/Literate_programming) popularized for
58-
jupyter notebooks by [nbdev](https://www.fast.ai/2019/12/02/nbdev/). Please explore the jupyter notebooks in `nbs/` to learn more about
59-
the inner working of ipyannotator.
60-
61-
The notebooks contains the development dependencies:
62-
[pytest](https://docs.pytest.org/en/7.1.x/) and [ipytest](https://github.com/chmp/ipytest),
63-
if you want to run the notebooks remove the tests or install the libraries mentioned.
64-
65-
Also check out the following notebook for a more high level overview.
66-
67-
- Tutorial demonstrating how ipyannotator can be seamlessly integrated in your data science workflow. `nbs/08_tutorial_road_damage.ipynb`
68-
- [Recoding of jupytercon 2020](https://www.youtube.com/watch?v=jFAp1s1O8Hg) talk explaining the high level concepts / vision of ipyannotator.
69-
7069
## Jupyter lab trouble shooting
7170

7271
For clean (re)install make sure to have all the lab extencions active:
@@ -104,13 +103,15 @@ the [nbdev tutorial](https://nbdev.fast.ai/tutorial.html) and related docs will
104103

105104
- [jupytercon 2020 talk](https://cfp.jupytercon.com/2020/schedule/presentation/237/ipyannotator-the-infinitely-hackable-annotation-framework/).
106105

107-
##Acknowledgements
106+
- [Recording of jupytercon 2020](https://www.youtube.com/watch?v=jFAp1s1O8Hg) talk explaining the high level concepts / vision of ipyannotator.
107+
108+
## Acknowledgements
108109

109110
The authors acknowledge the financial support by the Federal Ministry for Digital and Transport of Germany under the program mFUND (project number 19F2160A).
110111

111112
## Copyright
112113

113-
Copyright 2020 onwards, Palaimon GmbH. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project's files except in compliance with the License. A copy of the License is provided in the LICENSE file in this repository.
114+
Copyright 2022 onwards, Palaimon GmbH. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project's files except in compliance with the License. A copy of the License is provided in the LICENSE file in this repository.
114115

115116

116117

ipyannotator/base.py

+18
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,24 @@ def __init__(self, app_state: AppWidgetState):
9090
# Internal Cell
9191

9292
class Settings(NamedTuple):
93+
"""
94+
Holds Ipyannotator API settings
95+
96+
project_path: parent directory of the project_file and image_dir
97+
project_file: json file with annotations
98+
image_dir: directory that stores all images to be explored
99+
label_dir: directory that hold the image labels (if any)
100+
result_dir: directory to store the annotation results
101+
102+
im_width: size of the images from image_dir
103+
im_height: height of the images from image_dir
104+
label_width: width of the labels from labels_dir
105+
label_height: height of the labels from labels_dir
106+
107+
n_cols: number of columns displayed at the right menu
108+
n_rows: number of rows displayed at the right menu
109+
"""
110+
93111
project_path: Path = Path('user_project')
94112
project_file: Optional[Path] = None
95113
image_dir: str = 'images'

ipyannotator/docs/api.py

+4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
# Internal Cell
66
from ..annotator import Annotator
77
from .utils import show_doc
8+
from ..base import Settings
89

910
# Internal Cell
1011
show_doc(Annotator, title_level=3)
1112

13+
# Internal Cell
14+
show_doc(Settings, title_level=4)
15+
1216
# Internal Cell
1317
show_doc(Annotator.explore)
1418

nbs/00_base.ipynb

+19-1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,24 @@
278278
"#exporti\n",
279279
"\n",
280280
"class Settings(NamedTuple):\n",
281+
" \"\"\"\n",
282+
" Holds Ipyannotator API settings\n",
283+
"\n",
284+
" project_path: parent directory of the project_file and image_dir\n",
285+
" project_file: json file with annotations\n",
286+
" image_dir: directory that stores all images to be explored\n",
287+
" label_dir: directory that hold the image labels (if any)\n",
288+
" result_dir: directory to store the annotation results\n",
289+
"\n",
290+
" im_width: size of the images from image_dir\n",
291+
" im_height: height of the images from image_dir\n",
292+
" label_width: width of the labels from labels_dir\n",
293+
" label_height: height of the labels from labels_dir\n",
294+
"\n",
295+
" n_cols: number of columns displayed at the right menu\n",
296+
" n_rows: number of rows displayed at the right menu\n",
297+
" \"\"\"\n",
298+
"\n",
281299
" project_path: Path = Path('user_project')\n",
282300
" project_file: Optional[Path] = None\n",
283301
" image_dir: str = 'images'\n",
@@ -376,7 +394,7 @@
376394
],
377395
"metadata": {
378396
"kernelspec": {
379-
"display_name": "Python 3",
397+
"display_name": "Python 3 (ipykernel)",
380398
"language": "python",
381399
"name": "python3"
382400
}

nbs/01c_tutorial_bbox.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@
339339
],
340340
"metadata": {
341341
"kernelspec": {
342-
"display_name": "Python 3",
342+
"display_name": "Python 3 (ipykernel)",
343343
"language": "python",
344344
"name": "python3"
345345
}

nbs/01d_tutorial_video_annotator.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@
313313
],
314314
"metadata": {
315315
"kernelspec": {
316-
"display_name": "Python 3",
316+
"display_name": "Python 3 (ipykernel)",
317317
"language": "python",
318318
"name": "python3"
319319
}

nbs/08_tutorial_road_damage.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@
573573
],
574574
"metadata": {
575575
"kernelspec": {
576-
"display_name": "Python 3",
576+
"display_name": "Python 3 (ipykernel)",
577577
"language": "python",
578578
"name": "python3"
579579
}

nbs/20_image_classification_user_story.ipynb

+2-10
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@
255255
"settings = Settings(\n",
256256
" project_path=Path('user_project'),\n",
257257
" image_dir='images',\n",
258-
" result_dir='results'\n",
258+
" result_dir='batata'\n",
259259
")"
260260
]
261261
},
@@ -337,19 +337,11 @@
337337
"source": [
338338
"anni.create()"
339339
]
340-
},
341-
{
342-
"cell_type": "code",
343-
"execution_count": null,
344-
"id": "48a6c31b",
345-
"metadata": {},
346-
"outputs": [],
347-
"source": []
348340
}
349341
],
350342
"metadata": {
351343
"kernelspec": {
352-
"display_name": "Python 3",
344+
"display_name": "Python 3 (ipykernel)",
353345
"language": "python",
354346
"name": "python3"
355347
}

nbs/21_api_doc.ipynb

+65-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"source": [
1818
"# API Reference\n",
1919
"\n",
20-
"Detailed information about Ipyannotator API. To see usage please check Ipyannotator tutorials."
20+
"Detailed information about Ipyannotator API. To see usage please check [Ipyannotator tutorials](https://palaimon.github.io/ipyannotator/nbs/22_input_output_doc.html)."
2121
]
2222
},
2323
{
@@ -29,7 +29,16 @@
2929
"source": [
3030
"#exporti\n",
3131
"from ipyannotator.annotator import Annotator\n",
32-
"from ipyannotator.docs.utils import show_doc"
32+
"from ipyannotator.docs.utils import show_doc\n",
33+
"from ipyannotator.base import Settings"
34+
]
35+
},
36+
{
37+
"cell_type": "markdown",
38+
"id": "ab95f6b1",
39+
"metadata": {},
40+
"source": [
41+
"To use Ipyannotator API it's necessary to import the `Annotator` class by using `from ipyannotator.annotator import Annotator`. "
3342
]
3443
},
3544
{
@@ -43,6 +52,51 @@
4352
"show_doc(Annotator, title_level=3)"
4453
]
4554
},
55+
{
56+
"cell_type": "markdown",
57+
"id": "7c6ab67b",
58+
"metadata": {},
59+
"source": [
60+
"The pairs of input/output available are listed on the [Input/Output Types](https://palaimon.github.io/ipyannotator/nbs/22_input_output_doc.html) section. \n",
61+
"\n",
62+
"When working with the `Annotator` class the input type is always required, but the output type has a `NoOutput` default option that returns an annotator to explore the input images. `NoOutput` usage can be found on the [Bounding Box Annotator Tutorial](https://palaimon.github.io/ipyannotator/nbs/01c_tutorial_bbox.html#explore).\n",
63+
"\n",
64+
"The final piece of the configuration to access the Ipyannotator API is the `Settings` class that can be imported using `from ipyannotator.base import Settings`. Ipyannotator `Settings` class allow users to customize the folder structure to get the images, read annotations and store results, but also provides a default folder structure:\n",
65+
"\n",
66+
"```\n",
67+
"user_project\n",
68+
"│ annotation.json\n",
69+
"\n",
70+
"└───images\n",
71+
"│ │ 00001.png\n",
72+
"│ │ 00002.png\n",
73+
"│ │ ... \n",
74+
"\n",
75+
"└───results\n",
76+
" │ annotations.json\n",
77+
"\n",
78+
"```"
79+
]
80+
},
81+
{
82+
"cell_type": "code",
83+
"execution_count": null,
84+
"id": "747d6bc4",
85+
"metadata": {},
86+
"outputs": [],
87+
"source": [
88+
"#exporti\n",
89+
"show_doc(Settings, title_level=4)"
90+
]
91+
},
92+
{
93+
"cell_type": "markdown",
94+
"id": "6e53ec99",
95+
"metadata": {},
96+
"source": [
97+
"## Actions"
98+
]
99+
},
46100
{
47101
"cell_type": "markdown",
48102
"id": "8d7d2c09",
@@ -95,11 +149,19 @@
95149
"from nbdev.export import notebook2script\n",
96150
"notebook2script()"
97151
]
152+
},
153+
{
154+
"cell_type": "markdown",
155+
"id": "b19da654",
156+
"metadata": {},
157+
"source": [
158+
"## Settings"
159+
]
98160
}
99161
],
100162
"metadata": {
101163
"kernelspec": {
102-
"display_name": "Python 3",
164+
"display_name": "Python 3 (ipykernel)",
103165
"language": "python",
104166
"name": "python3"
105167
}

0 commit comments

Comments
 (0)