Skip to content

Commit 5672a4c

Browse files
authored
Merge pull request #225 from Labelbox/ms/3.0-notebook-updates
notebooks
2 parents 4e882ba + b7310a7 commit 5672a4c

File tree

19 files changed

+1556
-1232
lines changed

19 files changed

+1556
-1232
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22

3-
# Version 3.0.0-rc0
3+
# Version 3.0.0-rc1 (2021-08-05)
4+
## Added
5+
* Model diagnostics notebooks
6+
* Minor annotation type improvements
7+
8+
# Version 3.0.0-rc0 (2021-08-04)
49
## Added
510
* Annotation types
611
- A set of python objects for working with labelbox data

examples/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,10 @@
5757
| Annotation Type Basics | [Github](annotation_types/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/annotation_types/basics.ipynb) |
5858
| Converters | [Github](annotation_types/converters.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/annotation_types/converters.ipynb) |
5959
| Label Containers | [Github](annotation_types/label_containers.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/annotation_types/label_containers.ipynb) |
60-
| MAL With Annotation Types | [Github](annotation_types/mal_with_annotation_types.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/annotation_types/mal_with_annotation_types.ipynb) |
60+
61+
62+
## [Model Diagnostics](model_diagnostics)
63+
| Notebook | Github | Google Colab |
64+
| --------------------------- | --------------------------------- | ------------ |
65+
| Model Diagnostics Guide | [Github](model_diagnostics/model_diagnostics_guide.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_guide.ipynb) |
66+
| 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) |

examples/annotation_types/basics.ipynb

Lines changed: 132 additions & 322 deletions
Large diffs are not rendered by default.

examples/annotation_types/converters.ipynb

Lines changed: 243 additions & 55 deletions
Large diffs are not rendered by default.

examples/annotation_types/label_containers.ipynb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"metadata": {},
2121
"outputs": [],
2222
"source": [
23-
"!pip install labelbox[data] == 3.0b0"
23+
"!pip install \"labelbox[data]==3.0.0rc1\""
2424
]
2525
},
2626
{
@@ -83,7 +83,6 @@
8383
"source": [
8484
"# Only update this if you have an on-prem deployment\n",
8585
"ENDPOINT = \"https://api.labelbox.com/graphql\"\n",
86-
"\n",
8786
"client = Client(api_key=API_KEY, endpoint=ENDPOINT)"
8887
]
8988
},
@@ -93,7 +92,7 @@
9392
"metadata": {},
9493
"source": [
9594
"#### Helper Functions\n",
96-
"* See annotation_type_basics for details on this"
95+
"* See basics for details on this"
9796
]
9897
},
9998
{
@@ -270,7 +269,12 @@
270269
"outputs": [],
271270
"source": [
272271
"labels = get_labels()\n",
273-
"label_list = LabelList(labels)"
272+
"label_list = LabelList(labels)\n",
273+
"\n",
274+
"# Also build label lists iteratively\n",
275+
"label_list = LabelList()\n",
276+
"for label in labels:\n",
277+
" label_list.append(label)"
274278
]
275279
},
276280
{
@@ -825,7 +829,7 @@
825829
],
826830
"metadata": {
827831
"kernelspec": {
828-
"display_name": "Python 3",
832+
"display_name": "Python 3 (ipykernel)",
829833
"language": "python",
830834
"name": "python3"
831835
},

examples/annotation_types/mal_with_annotation_types.ipynb

Lines changed: 29 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": 1,
15+
"execution_count": null,
1616
"id": "danish-compatibility",
1717
"metadata": {},
1818
"outputs": [],
1919
"source": [
20-
"!pip labelbox[data] == 3.0b0"
20+
"!pip install \"labelbox[data]==3.0.0rc1\""
2121
]
2222
},
2323
{
2424
"cell_type": "code",
25-
"execution_count": 2,
25+
"execution_count": null,
2626
"id": "honey-elevation",
2727
"metadata": {},
2828
"outputs": [],
@@ -39,7 +39,7 @@
3939
},
4040
{
4141
"cell_type": "code",
42-
"execution_count": 3,
42+
"execution_count": null,
4343
"id": "committed-richards",
4444
"metadata": {},
4545
"outputs": [],
@@ -75,7 +75,7 @@
7575
},
7676
{
7777
"cell_type": "code",
78-
"execution_count": 4,
78+
"execution_count": null,
7979
"id": "hydraulic-paradise",
8080
"metadata": {},
8181
"outputs": [],
@@ -96,7 +96,7 @@
9696
},
9797
{
9898
"cell_type": "code",
99-
"execution_count": 5,
99+
"execution_count": null,
100100
"id": "exclusive-elephant",
101101
"metadata": {},
102102
"outputs": [],
@@ -109,7 +109,7 @@
109109
},
110110
{
111111
"cell_type": "code",
112-
"execution_count": 6,
112+
"execution_count": null,
113113
"id": "polyphonic-consensus",
114114
"metadata": {},
115115
"outputs": [],
@@ -119,21 +119,10 @@
119119
},
120120
{
121121
"cell_type": "code",
122-
"execution_count": 7,
122+
"execution_count": null,
123123
"id": "emotional-origin",
124124
"metadata": {},
125-
"outputs": [
126-
{
127-
"name": "stdout",
128-
"output_type": "stream",
129-
"text": [
130-
"WARNING:tensorflow:From ../model_assisted_labeling/image_model.py:17: load (from tensorflow.python.saved_model.loader_impl) is deprecated and will be removed in a future version.\n",
131-
"Instructions for updating:\n",
132-
"This function will only be available through the v1 compatibility library as tf.compat.v1.saved_model.loader.load or tf.compat.v1.saved_model.load. There will be a new function for importing SavedModels in Tensorflow 2.0.\n",
133-
"INFO:tensorflow:Restoring parameters from gs://cloud-tpu-checkpoints/mask-rcnn/1555659850/variables/variables\n"
134-
]
135-
}
136-
],
125+
"outputs": [],
137126
"source": [
138127
"#Downloads weights and loads the model.\n",
139128
"load_model()"
@@ -152,7 +141,7 @@
152141
},
153142
{
154143
"cell_type": "code",
155-
"execution_count": 8,
144+
"execution_count": null,
156145
"id": "interested-joyce",
157146
"metadata": {},
158147
"outputs": [],
@@ -196,16 +185,15 @@
196185
},
197186
{
198187
"cell_type": "code",
199-
"execution_count": 9,
188+
"execution_count": null,
200189
"id": "interstate-louisiana",
201190
"metadata": {},
202191
"outputs": [],
203192
"source": [
204-
"### We can just start creating predictions whether or not we have a \n",
193+
"# We can just start creating predictions whether or not we have a configured project in labelbox\n",
205194
"image_urls = ['https://raw.githubusercontent.com/Labelbox/labelbox-python/develop/examples/assets/2560px-Kitano_Street_Kobe01s5s4110.jpg']\n",
206195
"\n",
207-
"labellist = LabelList([])\n",
208-
"\n",
196+
"labellist = LabelList()\n",
209197
"for image_url in image_urls:\n",
210198
" image_data = RasterData(url = image_url)\n",
211199
" height, width = image_data.data.shape[:2]\n",
@@ -230,21 +218,10 @@
230218
},
231219
{
232220
"cell_type": "code",
233-
"execution_count": 10,
221+
"execution_count": null,
234222
"id": "modern-program",
235223
"metadata": {},
236-
"outputs": [
237-
{
238-
"data": {
239-
"text/plain": [
240-
"True"
241-
]
242-
},
243-
"execution_count": 10,
244-
"metadata": {},
245-
"output_type": "execute_result"
246-
}
247-
],
224+
"outputs": [],
248225
"source": [
249226
"# Lets setup a project to label\n",
250227
"# Note see Ontology, Project, and Project_setup notebooks for more information on this section.\n",
@@ -263,36 +240,19 @@
263240
"id": "mechanical-functionality",
264241
"metadata": {},
265242
"source": [
266-
"## Add ids required for MAL\n",
267-
"* Use helper functions to add urls to images and seg masks, assign schema ids to features, and add all data rows to the dataset."
243+
"## Prepare for upload\n",
244+
"* Our local annotations need the following:\n",
245+
" 1. signed url for segmentation masks\n",
246+
" 2. data rows in labelbox\n",
247+
" 3. feature schema ids"
268248
]
269249
},
270250
{
271251
"cell_type": "code",
272-
"execution_count": 11,
252+
"execution_count": null,
273253
"id": "vietnamese-kingdom",
274254
"metadata": {},
275-
"outputs": [
276-
{
277-
"name": "stderr",
278-
"output_type": "stream",
279-
"text": [
280-
"1it [00:02, 2.06s/it]\n",
281-
"1it [00:00, 11366.68it/s]\n",
282-
"1it [00:00, 9020.01it/s]\n"
283-
]
284-
},
285-
{
286-
"data": {
287-
"text/plain": [
288-
"<labelbox.data.annotation_types.collection.LabelList at 0x18855b040>"
289-
]
290-
},
291-
"execution_count": 11,
292-
"metadata": {},
293-
"output_type": "execute_result"
294-
}
295-
],
255+
"outputs": [],
296256
"source": [
297257
"signer = lambda _bytes: client.upload_data(content=_bytes, sign=True)\n",
298258
"labellist.add_url_to_masks(signer) \\\n",
@@ -313,18 +273,10 @@
313273
},
314274
{
315275
"cell_type": "code",
316-
"execution_count": 12,
276+
"execution_count": null,
317277
"id": "multiple-values",
318278
"metadata": {},
319-
"outputs": [
320-
{
321-
"name": "stdout",
322-
"output_type": "stream",
323-
"text": [
324-
"{'uuid': '2f708795-c8bf-4793-88d6-18ab57193466', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'schemaId': 'ckros4zfh2jjq0z8b6jq8h8u5', 'classifications': [{'schemaId': 'ckros4zg72jjw0z8ba10r0ozr', 'answer': {'schemaId': 'ckros4zgx2jjy0z8bbyuv6z1o'}}], 'bbox': {'top': 1352.3682861328125, 'left': 2275.82861328125, 'height': 350.1317138671875, 'width': 139.7919921875}}\n"
325-
]
326-
}
327-
],
279+
"outputs": [],
328280
"source": [
329281
"ndjsons = list(NDJsonConverter.serialize(labellist))\n",
330282
"print(ndjsons[0])"
@@ -340,7 +292,7 @@
340292
},
341293
{
342294
"cell_type": "code",
343-
"execution_count": 13,
295+
"execution_count": null,
344296
"id": "deluxe-behavior",
345297
"metadata": {},
346298
"outputs": [],
@@ -354,56 +306,13 @@
354306
},
355307
{
356308
"cell_type": "code",
357-
"execution_count": 14,
309+
"execution_count": null,
358310
"id": "clean-friday",
359311
"metadata": {},
360-
"outputs": [
361-
{
362-
"name": "stdout",
363-
"output_type": "stream",
364-
"text": [
365-
"{'uuid': '2f708795-c8bf-4793-88d6-18ab57193466', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
366-
"{'uuid': '383e8da0-ae5d-47d8-8a13-767a03270d40', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
367-
"{'uuid': 'e66676df-eba3-4231-82c7-5870f4e587be', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
368-
"{'uuid': 'ba1e748b-3bcc-41f1-b5d6-f7c420c95b14', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
369-
"{'uuid': '4ce19f3a-7d81-420c-a830-47eda0034fc7', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
370-
"{'uuid': '3491fa2f-39cb-4582-b2e4-c7196a3bb37e', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
371-
"{'uuid': '97d17219-9f3e-4c6e-af7a-0c263445405b', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
372-
"{'uuid': 'b829c83b-8741-4ea4-9f98-0478fdde2bf0', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
373-
"{'uuid': '36747eee-714e-424d-a9ff-65951f32c15c', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
374-
"{'uuid': '68889fc5-2f10-4929-8c7b-8e4301cf17bf', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
375-
"{'uuid': 'b7a6025d-fd8a-46e8-a24d-2340be021d69', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
376-
"{'uuid': 'e8a46ebc-30ac-41bd-b0b9-042b99774dc3', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
377-
"{'uuid': 'ba1d40b9-eb6d-4eae-babc-08e14b76eedc', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
378-
"{'uuid': 'd81bea0a-baf1-4a70-902c-e2f251cb82d2', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
379-
"{'uuid': '9bf9337f-1550-4dc8-b969-f9c294a44355', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
380-
"{'uuid': '0dd0d47e-f512-46c2-a670-62044085b01b', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
381-
"{'uuid': '7196cc1d-b8e5-4ad3-bc28-d33c83dbd8c2', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
382-
"{'uuid': '51e67fba-d5f2-44b1-835a-71d66365411c', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
383-
"{'uuid': '90d8e3e9-5184-4500-8b9c-dc690e20e6e9', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
384-
"{'uuid': 'ed2f9581-5dc7-4748-ab1e-28c85b601ba5', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
385-
"{'uuid': '7ba3b5b6-3ec3-4fe5-ba7a-bc6edf017af7', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
386-
"{'uuid': '72555669-9899-4e5f-a683-f7676aa9ac4a', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
387-
"{'uuid': 'b0cbc556-ce6b-459f-9420-f1146c97a944', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
388-
"{'uuid': '1f17e1c1-9b48-4638-9bdc-3f62a1cba83e', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
389-
"{'uuid': 'a9e2340c-22d2-4469-bffe-1a546816b621', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
390-
"{'uuid': '4772a3df-8072-4e33-a6c9-36e94470a8b2', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
391-
"{'uuid': '40302e2c-d8ae-41b8-8069-86e62dfff3d4', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
392-
"{'uuid': '892aa14a-7b37-4f23-a014-20f37b45c17a', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
393-
"{'uuid': 'bc6a665f-95c2-450c-a2bb-d9578e8f5b5a', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
394-
"{'uuid': 'eb2c61a4-fce8-400e-b981-19f03b5a38ed', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
395-
"{'uuid': '3f22c739-33ff-4673-a7bb-953aed76e2b2', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
396-
"{'uuid': '12eaaf77-d7e3-4375-bdc8-2e1588c718d5', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
397-
"{'uuid': '0713fea3-d2e5-4ed4-b722-a6a65c19afc0', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
398-
"{'uuid': '4a629d43-f576-4a7e-b64e-870d3309a98d', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
399-
"{'uuid': '5010efef-e45f-4cbe-a92e-86a62962d6e9', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n",
400-
"{'uuid': '41ded899-3a7c-47a4-9e37-1362e5a8d486', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n"
401-
]
402-
}
403-
],
312+
"outputs": [],
404313
"source": [
405314
"# Review the upload status\n",
406-
"for status in upload_task.statuses:\n",
315+
"for status in upload_task.statuses[:5]:\n",
407316
" print(status)"
408317
]
409318
},
@@ -418,7 +327,7 @@
418327
],
419328
"metadata": {
420329
"kernelspec": {
421-
"display_name": "Python 3",
330+
"display_name": "Python 3 (ipykernel)",
422331
"language": "python",
423332
"name": "python3"
424333
},

0 commit comments

Comments
 (0)