|
6 | 6 | "metadata": {},
|
7 | 7 | "source": [
|
8 | 8 | "## Annotation Types\n",
|
9 |
| - "This is a common format for representing human and machine generated annotations. A standard interface allows us to build tools that only need to work with a single interface. For example, if model predictions and labels are all represented by a common format we can write all of our etl, visualization code, training code to work with a single interface. Annotation types can also provide a seamless transition between local modeling and using labelbox. Some of the helper functions include:\n", |
| 9 | + "This is a common format for representing human and machine generated annotations. A standard interface allows us to build one set of tools that is compatible with all of our data. For example, if model predictions and labels are all represented by a common format we can write all of our etl, visualization code, training code to work with a single interface. Annotation types can also provide a seamless transition between local modeling and using labelbox. Some of the helper functions include:\n", |
10 | 10 | "* Build annotations locally with local file paths, numpy arrays, or urls and create data rows with a single line of code\n",
|
11 |
| - "* Easily upload model predictions by converting predictions to \n", |
12 |
| - "* Configure project ontology from model inferences\n", |
13 |
| - "* Easily access video data without having to worry about downloading each frame.\n", |
14 |
| - "* Helper functions for drawing annotations, converting them into shapely obejects, and much more." |
| 11 | + "* Easily upload model predictions for MAL or MEA by converting annotation objects to the import format\n", |
| 12 | + "* Configure project ontologies from a set of model inferences\n", |
| 13 | + "* Easily access video data without having to worry about downloading each frame's annotations.\n", |
| 14 | + "* Helper functions for drawing annotations, converting them into shapely objects, and much more." |
15 | 15 | ]
|
16 | 16 | },
|
17 | 17 | {
|
|
23 | 23 | "## Installation\n",
|
24 | 24 | "* Installing annotation types requires a slightly different pattern\n",
|
25 | 25 | " - `pip install \"labelbox[data]\"`\n",
|
26 |
| - "* `pip install labelbox` is still valid but it won't add the required dependencies. If you only want the client functionality of the SDK then don't add the data extras. However, you will likely get import errors if attempting to use the annotation types" |
| 26 | + "* `pip install labelbox` is still valid but it won't add the required dependencies. If you only want the client functionality of the SDK then don't add the [data] extras. However, you will likely get import errors if attempting to use the annotation types" |
27 | 27 | ]
|
28 | 28 | },
|
29 | 29 | {
|
|
33 | 33 | "metadata": {},
|
34 | 34 | "outputs": [],
|
35 | 35 | "source": [
|
36 |
| - "!pip install \"labelbox[data]\" --pre" |
| 36 | + "!pip install \"labelbox[data]\"" |
37 | 37 | ]
|
38 | 38 | },
|
39 | 39 | {
|
|
152 | 152 | " - `project.label_generator()`\n",
|
153 | 153 | " - `project.video_label_generator()`\n",
|
154 | 154 | "3. Use a converter to load from another format\n",
|
155 |
| - " - Covered in converters.ipynb notebook." |
| 155 | + " - Covered in the converters.ipynb notebook." |
156 | 156 | ]
|
157 | 157 | },
|
158 | 158 | {
|
|
161 | 161 | "metadata": {},
|
162 | 162 | "source": [
|
163 | 163 | "### Basic LabelCollection\n",
|
164 |
| - "* A Label collection is either a labelList or LabelGenerator containing Labels\n", |
| 164 | + "* A Label collection is either a `labelList` or `LabelGenerator` containing `Labels`\n", |
165 | 165 | " * More on this in label_containers.ipynb\n",
|
166 | 166 | "* Each label contains:\n",
|
167 | 167 | " 1. Data\n",
|
|
193 | 193 | "id": "circular-router",
|
194 | 194 | "metadata": {},
|
195 | 195 | "source": [
|
196 |
| - "* All models are pydantic so we can easily convert all of our objects to dictionaries and view the schema." |
| 196 | + "* All models are pydantic models so we can easily convert all of our objects to dictionaries and view the schema." |
197 | 197 | ]
|
198 | 198 | },
|
199 | 199 | {
|
|
354 | 354 | "source": [
|
355 | 355 | "#### Non-public urls\n",
|
356 | 356 | "* If the urls in your data is not publicly accessible you can override the fetching logic\n",
|
357 |
| - "* For TextData and ImageData overwrite the following function and make sure it has the same signature. `data.fetch_remote(self) -> bytes`.\n", |
358 |
| - "* For VideoData, the signature is `VideoData.fetch_remote(self, local_path)`. This function needs to download the video file locally to that local_path to work." |
| 357 | + "* For `TextData` and `ImageData` overwrite the following function and make sure it has the same signature. `data.fetch_remote(self) -> bytes`.\n", |
| 358 | + "* For `VideoData`, the signature is `VideoData.fetch_remote(self, local_path)`. This function needs to download the video file locally to that local_path to work." |
359 | 359 | ]
|
360 | 360 | },
|
361 | 361 | {
|
|
382 | 382 | "metadata": {},
|
383 | 383 | "source": [
|
384 | 384 | "* There are 4 types of annotations\n",
|
385 |
| - " 1. ObjectAnnotation\n", |
| 385 | + " 1. `ObjectAnnotation`\n", |
386 | 386 | " - Objects with location information\n",
|
387 | 387 | " - Annotations that are found in the object field of the labelbox export\n",
|
388 |
| - " - Classes: Point, Polygon, Mask, Line, Rectangle, Named Entity\n", |
389 |
| - " 2. ClassificationAnnotation\n", |
| 388 | + " - Classes: `Point`, `Polygon`, `Mask`, `Line`, `Rectangle`, `TextEntity`\n", |
| 389 | + " 2. `ClassificationAnnotation`\n", |
390 | 390 | " - Classifications that can apply to data or another annotation\n",
|
391 |
| - " - Classes: Checklist, Radio, Text, Dropdown\n", |
392 |
| - " 3. VideoObjectAnnotation\n", |
| 391 | + " - Classes: `Checklist`, `Radio`, `Text`, `Dropdown`\n", |
| 392 | + " 3. `VideoObjectAnnotation`\n", |
393 | 393 | " - Same as object annotation but there are extra fields for video information\n",
|
394 |
| - " 4. VideoClassificationAnnotation\n", |
| 394 | + " 4. `VideoClassificationAnnotation`\n", |
395 | 395 | " - Same as classification annotation but there are extra fields for video information \n",
|
396 | 396 | "-------- \n",
|
397 | 397 | "* Create an annotation by providing the following:\n",
|
398 | 398 | "1. Value\n",
|
399 |
| - " - Must be either a Geometry, TextEntity, or Classification\n", |
| 399 | + " - Must be either a `Geometry`, `TextEntity`, or `Classification`\n", |
400 | 400 | " - This is the same as a top level tool in labelbox\n",
|
401 |
| - "2. name or feature_schema_id\n", |
| 401 | + "2. Name or feature_schema_id\n", |
402 | 402 | " - This is the id that corresponds to a particular class or just simply the class name\n",
|
403 | 403 | " - If uploading to labelbox this must match a field in an ontology.\n",
|
404 | 404 | "3. (Optional) Classifications \n",
|
405 |
| - " - List of ClassificationAnnotations. This self referencing field enables infinite nesting of classifications.\n", |
| 405 | + " - List of `ClassificationAnnotations`. This self referencing field enables infinite nesting of classifications.\n", |
406 | 406 | " - Be careful with how you use the tool. Labelbox does not support nesting classifications\n",
|
407 | 407 | " - E.g. you can have tool.classifications but not tool.classifications[0].classifications\n",
|
408 | 408 | " "
|
|
1027 | 1027 | "outputs": [],
|
1028 | 1028 | "source": [
|
1029 | 1029 | "def signing_function(obj_bytes: bytes) -> str:\n",
|
1030 |
| - " # WARNING: Do not use this signer. You will not be able to resign these images at a later date\n", |
| 1030 | + " # Do not use this signer. You will not be able to resign these images at a later date\n", |
1031 | 1031 | " url = client.upload_data(content=obj_bytes, sign=True)\n",
|
1032 | 1032 | " return url"
|
1033 | 1033 | ]
|
|
1138 | 1138 | "metadata": {},
|
1139 | 1139 | "source": [
|
1140 | 1140 | "### Creating Data Rows\n",
|
1141 |
| - "* Our Labels objects are great for working with locally but we might want to upload to labelbox\n", |
| 1141 | + "* `Labels` objects are great for working with locally but we might want to upload to labelbox\n", |
1142 | 1142 | "* This is required for MAL, MEA, and to add additional labels to the data.\n"
|
1143 | 1143 | ]
|
1144 | 1144 | },
|
|
1253 | 1253 | "source": [
|
1254 | 1254 | "### Next Steps\n",
|
1255 | 1255 | "* Annotation types should be thought of as low level interfaces\n",
|
1256 |
| - "* We are working on a set of tools to make this less verbose. Please provide any feedback!\n", |
| 1256 | + "* We are working on a set of tools to make working with annotation types less verbose. Please provide any feedback!\n", |
1257 | 1257 | "* Checkout other notebooks to see how to use higher level tools that are compatible with these interfaces"
|
1258 | 1258 | ]
|
1259 | 1259 | },
|
|
0 commit comments