Skip to content

Commit 750eda2

Browse files
authored
Merge pull request #456 from Labelbox/develop
SDK Update 13.5
2 parents 3a2d5e8 + ac1a037 commit 750eda2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+7437
-2170
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
# Changelog
2+
# Version 3.15.0 (2022-02-28)
3+
## Added
4+
* Extras folder which contains useful applications using the sdk
5+
* Addition of ResourceTag at the Organization and Project level
6+
* Updates to the example notebooks
7+
8+
## Fix
9+
* EPSGTransformer now properly transforms Polygon to Polygon
10+
* VideoData string representation now properly shows VideoData
11+
12+
213
# Version 3.14.0 (2022-02-10)
314
## Added
415
* Updated metrics for classifications to be per-answer
516

17+
618
# Version 3.13.0 (2022-02-07)
719
## Added
820
* Added `from_shapely` method to create annotation types from Shapely objects

examples/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,9 @@ Learn more about annotation types in the [docs](https://docs.labelbox.com/docs/a
8282
| Model Diagnostics Demo | [Github](model_diagnostics/model_diagnostics_demo.ipynb) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/model_diagnostics/model_diagnostics_demo.ipynb) |
8383
| Custom Metrics Basics | [Github](model_diagnostics/custom_metrics_basics.ipynb) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/model_diagnostics/custom_metrics_basics.ipynb) | [Docs](https://docs.labelbox.com/docs/model-diagnostics) |
8484
| Custom Metrics Demo | [Github](model_diagnostics/custom_metrics_demo.ipynb) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/model_diagnostics/custom_metrics_demo.ipynb) |
85+
86+
87+
## [Extras](extras)
88+
| Notebook | Github | Google Colab | Learn more |
89+
|---------------------------------|------------------------------------------------| ------------ | ---------- |
90+
| Classification Confusion Matrix | [Github](extras/classification-confusion-matrix.ipynb) | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/extras/classification-confusion-matrix.ipynb) | |

examples/annotation_types/basics.ipynb

Lines changed: 438 additions & 86 deletions
Large diffs are not rendered by default.

examples/annotation_types/converters.ipynb

Lines changed: 114 additions & 54 deletions
Large diffs are not rendered by default.

examples/annotation_types/label_containers.ipynb

Lines changed: 287 additions & 47 deletions
Large diffs are not rendered by default.

examples/annotation_types/mal_using_annotation_types.ipynb

Lines changed: 142 additions & 27 deletions
Large diffs are not rendered by default.

examples/annotation_types/tiled_imagery_basics.ipynb

Lines changed: 454 additions & 379 deletions
Large diffs are not rendered by default.

examples/basics/basics.ipynb

Lines changed: 87 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,20 @@
6666
"id": "indie-bracket",
6767
"metadata": {},
6868
"outputs": [],
69-
"source": "!pip install labelbox"
69+
"source": [
70+
"!pip install labelbox"
71+
]
7072
},
7173
{
7274
"cell_type": "code",
7375
"execution_count": 2,
7476
"id": "everyday-street",
7577
"metadata": {},
7678
"outputs": [],
77-
"source": "from labelbox import Project, Dataset, Client\nfrom getpass import getpass\nimport os"
78-
},
79-
{
80-
"cell_type": "code",
81-
"execution_count": 3,
82-
"id": "crude-receiver",
83-
"metadata": {},
84-
"outputs": [],
85-
"source": "# If you don't want to give google access to drive you can skip this cell\n# and manually set `API_KEY` below.\n\nCOLAB = \"google.colab\" in str(get_ipython())\nif COLAB:\n !pip install colab-env -qU\n from colab_env import envvar_handler\n envvar_handler.envload()\n\nAPI_KEY = os.environ.get(\"LABELBOX_API_KEY\")\nif not os.environ.get(\"LABELBOX_API_KEY\"):\n API_KEY = getpass(\"Please enter your labelbox api key\")\n if COLAB:\n envvar_handler.add_env(\"LABELBOX_API_KEY\", API_KEY)"
79+
"source": [
80+
"from labelbox import Project, Dataset, Client\n",
81+
"import os"
82+
]
8683
},
8784
{
8885
"cell_type": "markdown",
@@ -109,7 +106,14 @@
109106
"id": "instructional-reply",
110107
"metadata": {},
111108
"outputs": [],
112-
"source": "PROJECT_ID = \"ckk4q1viuc0w20704eh69u28h\"\nDATASET_ID = \"ckk4q1vjznyhu087203wlghfr\"\nPROJECT_NAME = \"Sample Project\"\nDATASET_NAME = \"Example Jellyfish Dataset\"\n# Only update this if you have an on-prem deployment\nENDPOINT = \"https://api.labelbox.com/graphql\""
109+
"source": [
110+
"PROJECT_ID = \"ckk4q1viuc0w20704eh69u28h\"\n",
111+
"DATASET_ID = \"ckk4q1vjznyhu087203wlghfr\"\n",
112+
"PROJECT_NAME = \"Sample Project\"\n",
113+
"DATASET_NAME = \"Example Jellyfish Dataset\"\n",
114+
"# Only update this if you have an on-prem deployment\n",
115+
"ENDPOINT = \"https://api.labelbox.com/graphql\""
116+
]
113117
},
114118
{
115119
"cell_type": "markdown",
@@ -120,21 +124,38 @@
120124
"* Starting point for all db interactions"
121125
]
122126
},
127+
{
128+
"cell_type": "markdown",
129+
"id": "485451ad",
130+
"metadata": {},
131+
"source": [
132+
"# API Key and Client\n",
133+
"Provide a valid api key below in order to properly connect to the Labelbox Client."
134+
]
135+
},
123136
{
124137
"cell_type": "code",
125138
"execution_count": 5,
126139
"id": "thick-gasoline",
127140
"metadata": {},
128141
"outputs": [],
129-
"source": "client = Client(api_key=API_KEY, endpoint=ENDPOINT)"
142+
"source": [
143+
"# Add your api key\n",
144+
"API_KEY = None\n",
145+
"client = Client(api_key=API_KEY)"
146+
]
130147
},
131148
{
132149
"cell_type": "code",
133150
"execution_count": 6,
134151
"id": "victorian-consumer",
135152
"metadata": {},
136153
"outputs": [],
137-
"source": "#Client can be used to fetch by id:\nproject = client.get_project(PROJECT_ID)\ndataset = client.get_dataset(DATASET_ID)"
154+
"source": [
155+
"#Client can be used to fetch by id:\n",
156+
"project = client.get_project(PROJECT_ID)\n",
157+
"dataset = client.get_dataset(DATASET_ID)"
158+
]
138159
},
139160
{
140161
"cell_type": "code",
@@ -153,7 +174,9 @@
153174
"output_type": "execute_result"
154175
}
155176
],
156-
"source": "project"
177+
"source": [
178+
"project"
179+
]
157180
},
158181
{
159182
"cell_type": "markdown",
@@ -181,7 +204,11 @@
181204
]
182205
}
183206
],
184-
"source": "print(project.name)\nprint(project.description)\nprint(dataset.name)"
207+
"source": [
208+
"print(project.name)\n",
209+
"print(project.description)\n",
210+
"print(dataset.name)"
211+
]
185212
},
186213
{
187214
"cell_type": "markdown",
@@ -197,7 +224,10 @@
197224
"id": "according-subdivision",
198225
"metadata": {},
199226
"outputs": [],
200-
"source": "project.update(description=\"new description field\")\nprint(project.description)"
227+
"source": [
228+
"project.update(description=\"new description field\")\n",
229+
"print(project.description)"
230+
]
201231
},
202232
{
203233
"cell_type": "markdown",
@@ -226,15 +256,23 @@
226256
"output_type": "execute_result"
227257
}
228258
],
229-
"source": "labels_paginated_collection = project.labels()\nlabels_paginated_collection"
259+
"source": [
260+
"labels_paginated_collection = project.labels()\n",
261+
"labels_paginated_collection"
262+
]
230263
},
231264
{
232265
"cell_type": "code",
233266
"execution_count": 11,
234267
"id": "convinced-force",
235268
"metadata": {},
236269
"outputs": [],
237-
"source": "# Note that if you selected a `project_id` without any labels this will raise `StopIteration`\n# Iterate over them to get the items out.\nnext(labels_paginated_collection)\n# list(paginated...) should be avoided for queries that could return more than a dozen results"
270+
"source": [
271+
"# Note that if you selected a `project_id` without any labels this will raise `StopIteration`\n",
272+
"# Iterate over them to get the items out.\n",
273+
"next(labels_paginated_collection)\n",
274+
"# list(paginated...) should be avoided for queries that could return more than a dozen results"
275+
]
238276
},
239277
{
240278
"cell_type": "markdown",
@@ -263,7 +301,21 @@
263301
]
264302
}
265303
],
266-
"source": "datasets = client.get_datasets(where=Dataset.name == DATASET_NAME)\n\nprojects = client.get_projects(\n where=((Project.name == PROJECT_NAME) &\n (Project.description == \"new description field\")))\n\n# The above two queries return PaginatedCollections because the filter parameters aren't guaranteed to be unique.\n# So even if there is one element returned it is in a paginatedCollection.\nprint(projects)\nprint(next(projects, None))\nprint(next(projects, None))\nprint(next(projects, None))\n# We can see there is only one."
304+
"source": [
305+
"datasets = client.get_datasets(where=Dataset.name == DATASET_NAME)\n",
306+
"\n",
307+
"projects = client.get_projects(\n",
308+
" where=((Project.name == PROJECT_NAME) &\n",
309+
" (Project.description == \"new description field\")))\n",
310+
"\n",
311+
"# The above two queries return PaginatedCollections because the filter parameters aren't guaranteed to be unique.\n",
312+
"# So even if there is one element returned it is in a paginatedCollection.\n",
313+
"print(projects)\n",
314+
"print(next(projects, None))\n",
315+
"print(next(projects, None))\n",
316+
"print(next(projects, None))\n",
317+
"# We can see there is only one."
318+
]
267319
},
268320
{
269321
"cell_type": "markdown",
@@ -305,7 +357,11 @@
305357
"output_type": "execute_result"
306358
}
307359
],
308-
"source": "# Dataset has a Relationship to a Project so we can use the following\nlist(dataset.projects())\n# This will return all projects that are attached to this dataset"
360+
"source": [
361+
"# Dataset has a Relationship to a Project so we can use the following\n",
362+
"list(dataset.projects())\n",
363+
"# This will return all projects that are attached to this dataset"
364+
]
309365
},
310366
{
311367
"cell_type": "code",
@@ -324,7 +380,10 @@
324380
"output_type": "execute_result"
325381
}
326382
],
327-
"source": "sample_project_datasets = project.datasets()\nlist(sample_project_datasets)"
383+
"source": [
384+
"sample_project_datasets = project.datasets()\n",
385+
"list(sample_project_datasets)"
386+
]
328387
},
329388
{
330389
"cell_type": "markdown",
@@ -341,7 +400,12 @@
341400
"id": "persistent-briefs",
342401
"metadata": {},
343402
"outputs": [],
344-
"source": "#Eg.\n##### project.delete()\n##### dataset.delete()\n##### data_row.delete()"
403+
"source": [
404+
"#Eg.\n",
405+
"##### project.delete()\n",
406+
"##### dataset.delete()\n",
407+
"##### data_row.delete()"
408+
]
345409
},
346410
{
347411
"cell_type": "markdown",
@@ -351,14 +415,6 @@
351415
"* We reccomend using bulk operations where possible.\n",
352416
"* You can find specific deletion instructions in tutorials on each object."
353417
]
354-
},
355-
{
356-
"cell_type": "code",
357-
"execution_count": 16,
358-
"id": "thirty-interval",
359-
"metadata": {},
360-
"outputs": [],
361-
"source": ""
362418
}
363419
],
364420
"metadata": {
@@ -382,4 +438,4 @@
382438
},
383439
"nbformat": 4,
384440
"nbformat_minor": 5
385-
}
441+
}

0 commit comments

Comments
 (0)