Skip to content

Commit 5f4355e

Browse files
authored
Merge pull request #645 from Labelbox/jtso/al-3087
[AL-3087] Documentation Update
2 parents ab74b56 + e4ef9fa commit 5f4355e

File tree

19 files changed

+623
-1439
lines changed

19 files changed

+623
-1439
lines changed

examples/annotation_import/basics.ipynb

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@
292292
"We will create a Label called mal_label which has the same original structure as the label above\n",
293293
"\n",
294294
"Notes:\n",
295-
"* Each label requires a valid feature schema id. We will assign it using our built in `assign_feature_schema_ids` method\n",
296295
"* the NDJsonConverter takes in a list of labels"
297296
]
298297
},
@@ -304,30 +303,13 @@
304303
"id": "10b19393-920a-45c8-9660-42d8c449b9c2",
305304
"outputId": "a93a39de-c8ed-402c-b834-304b1ba8854a"
306305
},
307-
"outputs": [
308-
{
309-
"data": {
310-
"text/plain": [
311-
"[{'uuid': 'fde1945b-01df-43c2-807a-3f5fa20450f4',\n",
312-
" 'dataRow': {'id': 'ckzocppkf96r10z9q205151c3'},\n",
313-
" 'schemaId': 'ckzocpq4l9bw20z9s9bc70h29',\n",
314-
" 'classifications': [],\n",
315-
" 'bbox': {'top': 30.0, 'left': 30.0, 'height': 170.0, 'width': 170.0}}]"
316-
]
317-
},
318-
"execution_count": 6,
319-
"metadata": {},
320-
"output_type": "execute_result"
321-
}
322-
],
306+
"outputs": [],
323307
"source": [
324308
"mal_label = Label(\n",
325309
" data=image_data,\n",
326310
" annotations = [rectangle_annotation]\n",
327311
")\n",
328312
"\n",
329-
"mal_label.assign_feature_schema_ids(ontology_builder.from_project(mal_project))\n",
330-
"\n",
331313
"ndjson_labels = list(NDJsonConverter.serialize([mal_label]))\n",
332314
"\n",
333315
"ndjson_labels"
@@ -397,10 +379,7 @@
397379
"id": "41d103bc-a5fd-4f0b-95f0-7e9bc59fbd07"
398380
},
399381
"source": [
400-
"Label import is very similar to model-assisted labeling. We will need to re-assign the feature schema before continuing, \n",
401-
"but we can continue to use our NDJSonConverter\n",
402-
"\n",
403-
"We will create a Label called li_label which has the same original structure as the label above"
382+
"Label import is very similar to model-assisted labeling. We will create a Label called li_label which has the same original structure as the label above"
404383
]
405384
},
406385
{
@@ -411,30 +390,13 @@
411390
"id": "c95716d5-a1ee-46fe-8dca-313ce10f104f",
412391
"outputId": "0e83d5d0-1f51-4903-c777-f9c331781656"
413392
},
414-
"outputs": [
415-
{
416-
"data": {
417-
"text/plain": [
418-
"[{'uuid': '7be8bb0b-39a2-44a5-96ab-5def3752811b',\n",
419-
" 'dataRow': {'id': 'ckzocppkf96r10z9q205151c3'},\n",
420-
" 'schemaId': 'ckzocpqv80ukp0z9l67cc6liv',\n",
421-
" 'classifications': [],\n",
422-
" 'bbox': {'top': 30.0, 'left': 30.0, 'height': 170.0, 'width': 170.0}}]"
423-
]
424-
},
425-
"execution_count": 9,
426-
"metadata": {},
427-
"output_type": "execute_result"
428-
}
429-
],
393+
"outputs": [],
430394
"source": [
431395
"li_label = Label(\n",
432396
" data=image_data,\n",
433397
" annotations = [rectangle_annotation]\n",
434398
")\n",
435399
"\n",
436-
"li_label.assign_feature_schema_ids(ontology_builder.from_project(li_project))\n",
437-
"\n",
438400
"ndjson_labels = list(NDJsonConverter.serialize([li_label]))\n",
439401
"\n",
440402
"ndjson_labels"

examples/annotation_import/image.ipynb

Lines changed: 26 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,16 @@
137137
"execution_count": 3,
138138
"id": "86003724-4807-4281-95c1-5284a6f9609f",
139139
"metadata": {
140-
"id": "86003724-4807-4281-95c1-5284a6f9609f",
141140
"colab": {
142141
"base_uri": "https://localhost:8080/"
143142
},
143+
"id": "86003724-4807-4281-95c1-5284a6f9609f",
144144
"outputId": "d6af46bd-128b-4bd2-9aec-ad2188a8df06"
145145
},
146146
"outputs": [
147147
{
148-
"output_type": "stream",
149148
"name": "stderr",
149+
"output_type": "stream",
150150
"text": [
151151
"INFO:labelbox.client:Initializing Labelbox client at 'https://api.labelbox.com/graphql'\n"
152152
]
@@ -343,7 +343,6 @@
343343
},
344344
"outputs": [
345345
{
346-
"output_type": "execute_result",
347346
"data": {
348347
"text/plain": [
349348
"{'annotations': [ObjectAnnotation(name='point', feature_schema_id=None, extra={}, value=Point(extra={}, x=100.0, y=100.0), classifications=[]),\n",
@@ -359,8 +358,9 @@
359358
" 'uid': None}"
360359
]
361360
},
361+
"execution_count": 11,
362362
"metadata": {},
363-
"execution_count": 11
363+
"output_type": "execute_result"
364364
}
365365
],
366366
"source": [
@@ -412,13 +412,12 @@
412412
"We will create a Label called mal_label which has the same original structure as the label above\n",
413413
"\n",
414414
"Notes:\n",
415-
"* Each label requires a valid feature schema id. We will assign it using our built in `assign_feature_schema_ids` method\n",
416415
"* the NDJsonConverter takes in a list of labels"
417416
]
418417
},
419418
{
420419
"cell_type": "code",
421-
"execution_count": 12,
420+
"execution_count": null,
422421
"id": "53aaf87b-114f-4b56-a417-8c7cddc1f532",
423422
"metadata": {
424423
"colab": {
@@ -427,64 +426,7 @@
427426
"id": "53aaf87b-114f-4b56-a417-8c7cddc1f532",
428427
"outputId": "43a3efd9-ee7e-4413-eee3-ef75f049ce96"
429428
},
430-
"outputs": [
431-
{
432-
"output_type": "execute_result",
433-
"data": {
434-
"text/plain": [
435-
"[{'classifications': [],\n",
436-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
437-
" 'point': {'x': 100.0, 'y': 100.0},\n",
438-
" 'schemaId': 'cl084bk7j6wxa0za8807x3e8p',\n",
439-
" 'uuid': '63183c21-04f5-48a4-a8a1-1bf962f2604d'},\n",
440-
" {'bbox': {'height': 170.0, 'left': 30.0, 'top': 30.0, 'width': 170.0},\n",
441-
" 'classifications': [],\n",
442-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
443-
" 'schemaId': 'cl084bk7j6wx60za83y097zdy',\n",
444-
" 'uuid': '7e43abb6-ef3b-4a1d-b560-ed4426ce3ce3'},\n",
445-
" {'classifications': [],\n",
446-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
447-
" 'line': [{'x': 60.0, 'y': 70.0},\n",
448-
" {'x': 65.0, 'y': 100.0},\n",
449-
" {'x': 80.0, 'y': 130.0},\n",
450-
" {'x': 40.0, 'y': 200.0}],\n",
451-
" 'schemaId': 'cl084bk7j6wx80za83ywp8xh7',\n",
452-
" 'uuid': '4a07aa02-1857-4869-9831-a6bb9eb1eb3e'},\n",
453-
" {'classifications': [],\n",
454-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
455-
" 'polygon': [{'x': 100.0, 'y': 100.0},\n",
456-
" {'x': 110.0, 'y': 110.0},\n",
457-
" {'x': 130.0, 'y': 130.0},\n",
458-
" {'x': 170.0, 'y': 170.0},\n",
459-
" {'x': 220.0, 'y': 220.0},\n",
460-
" {'x': 100.0, 'y': 100.0}],\n",
461-
" 'schemaId': 'cl084bk7j6wxc0za8c6e63hfe',\n",
462-
" 'uuid': '06085057-1b91-44ba-86ec-e1aca2e2fa16'},\n",
463-
" {'classifications': [],\n",
464-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
465-
" 'mask': {'colorRGB': (0, 0, 0),\n",
466-
" 'instanceURI': 'https://storage.labelbox.com/cklgtitp0gi500732dgmg0p8l%2F4c5b600e-5b50-cf4a-df2b-28dbf1b1dddf-1?Expires=1646225060595&KeyName=labelbox-assets-key-3&Signature=aIZd6sj8UdiDUsPZBbTEtcNPWf4'},\n",
467-
" 'schemaId': 'cl084bk7k6wxe0za89ovp34m0',\n",
468-
" 'uuid': 'd5511578-283e-42b2-ac19-c25929103370'},\n",
469-
" {'answer': 'the answer to the text question',\n",
470-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
471-
" 'schemaId': 'cl084bk7k6wxg0za87wjndne2',\n",
472-
" 'uuid': 'b8cecf98-a4ee-4424-b706-8eb9a9b4fb70'},\n",
473-
" {'answer': [{'schemaId': 'cl084bk7k6wxj0za8hgxobmch'},\n",
474-
" {'schemaId': 'cl084bk7k6wxl0za8hb07hrro'}],\n",
475-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
476-
" 'schemaId': 'cl084bk7k6wxi0za8eglr5527',\n",
477-
" 'uuid': 'd1651794-11b5-48bf-93d5-ccce6189fc72'},\n",
478-
" {'answer': {'schemaId': 'cl084bk7k6wxr0za8fc5b4pkq'},\n",
479-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
480-
" 'schemaId': 'cl084bk7k6wxo0za8fhdpa72y',\n",
481-
" 'uuid': '6c4a6f53-ef1d-469f-a45f-778b7b4fccdb'}]"
482-
]
483-
},
484-
"metadata": {},
485-
"execution_count": 12
486-
}
487-
],
429+
"outputs": [],
488430
"source": [
489431
"mal_label = Label(\n",
490432
" data=image_data,\n",
@@ -496,8 +438,6 @@
496438
"\n",
497439
"label.add_url_to_masks(signing_function)\n",
498440
"\n",
499-
"mal_label.assign_feature_schema_ids(ontology_builder.from_project(mal_project))\n",
500-
"\n",
501441
"ndjson_labels = list(NDJsonConverter.serialize([mal_label]))\n",
502442
"\n",
503443
"ndjson_labels"
@@ -524,23 +464,23 @@
524464
"execution_count": 14,
525465
"id": "2a8f9e5f-eeeb-4cfa-9b97-a09495a64d41",
526466
"metadata": {
527-
"id": "2a8f9e5f-eeeb-4cfa-9b97-a09495a64d41",
528467
"colab": {
529468
"base_uri": "https://localhost:8080/"
530469
},
470+
"id": "2a8f9e5f-eeeb-4cfa-9b97-a09495a64d41",
531471
"outputId": "6b2c938f-04eb-408a-c78e-a3258f765f4e"
532472
},
533473
"outputs": [
534474
{
535-
"output_type": "stream",
536475
"name": "stderr",
476+
"output_type": "stream",
537477
"text": [
538478
"INFO:labelbox.schema.annotation_import:Sleeping for 10 seconds...\n"
539479
]
540480
},
541481
{
542-
"output_type": "stream",
543482
"name": "stdout",
483+
"output_type": "stream",
544484
"text": [
545485
"Errors: []\n"
546486
]
@@ -570,15 +510,12 @@
570510
"id": "9d4fa318-7d08-4d98-b0ff-e2086814d75d"
571511
},
572512
"source": [
573-
"Label import is very similar to model-assisted labeling. We will need to re-assign the feature schema before continuing, \n",
574-
"but we can continue to use our NDJSonConverter\n",
575-
"\n",
576-
"We will create a Label called li_label which has the same original structure as the label above"
513+
"Label import is very similar to model-assisted labeling. We will create a Label called li_label which has the same original structure as the label above"
577514
]
578515
},
579516
{
580517
"cell_type": "code",
581-
"execution_count": 15,
518+
"execution_count": null,
582519
"id": "e8d4e99b-ad7e-48b9-8073-afb764d7c5b4",
583520
"metadata": {
584521
"colab": {
@@ -587,63 +524,7 @@
587524
"id": "e8d4e99b-ad7e-48b9-8073-afb764d7c5b4",
588525
"outputId": "384aea4d-9352-4192-c395-e39a44d5b6a4"
589526
},
590-
"outputs": [
591-
{
592-
"output_type": "execute_result",
593-
"data": {
594-
"text/plain": [
595-
"[{'classifications': [],\n",
596-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
597-
" 'point': {'x': 100.0, 'y': 100.0},\n",
598-
" 'schemaId': 'cl084bl3447y80z7vgx5bf5i2',\n",
599-
" 'uuid': '4ed2a3bb-2b14-4a7c-826b-1357f2376eef'},\n",
600-
" {'bbox': {'height': 170.0, 'left': 30.0, 'top': 30.0, 'width': 170.0},\n",
601-
" 'classifications': [],\n",
602-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
603-
" 'schemaId': 'cl084bl3347y40z7v1gjv5d1i',\n",
604-
" 'uuid': 'be904bbc-2ee6-4f41-bef9-6e40f8905596'},\n",
605-
" {'classifications': [],\n",
606-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
607-
" 'line': [{'x': 60.0, 'y': 70.0},\n",
608-
" {'x': 65.0, 'y': 100.0},\n",
609-
" {'x': 80.0, 'y': 130.0},\n",
610-
" {'x': 40.0, 'y': 200.0}],\n",
611-
" 'schemaId': 'cl084bl3347y60z7v0pjx0erv',\n",
612-
" 'uuid': '5ced68ba-7c50-46a9-8ef5-26c8bceed485'},\n",
613-
" {'classifications': [],\n",
614-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
615-
" 'polygon': [{'x': 100.0, 'y': 100.0},\n",
616-
" {'x': 110.0, 'y': 110.0},\n",
617-
" {'x': 130.0, 'y': 130.0},\n",
618-
" {'x': 170.0, 'y': 170.0},\n",
619-
" {'x': 220.0, 'y': 220.0},\n",
620-
" {'x': 100.0, 'y': 100.0}],\n",
621-
" 'schemaId': 'cl084bl3447ya0z7v5nzlc9s9',\n",
622-
" 'uuid': '442834a6-b25d-44b4-b550-60392d5f1efe'},\n",
623-
" {'classifications': [],\n",
624-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
625-
" 'mask': {'png': 'iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAAAAADmVT4XAAAAXElEQVR4nO3OMQEAAAzCMJh/0ZPBkxpo2my78R8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAPwt8BAVCFH74AAAAASUVORK5CYII='},\n",
626-
" 'schemaId': 'cl084bl3447yc0z7v9m9r6auw',\n",
627-
" 'uuid': '07b35d80-5f13-43cd-aea5-b9af850f10d1'},\n",
628-
" {'answer': 'the answer to the text question',\n",
629-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
630-
" 'schemaId': 'cl084bl3447ye0z7v8ii38i4z',\n",
631-
" 'uuid': 'd7d8408e-a0b6-427a-a8b8-97c17304c2bb'},\n",
632-
" {'answer': [{'schemaId': 'cl084bl3447yh0z7vhs3e0xyk'},\n",
633-
" {'schemaId': 'cl084bl3447yj0z7vhjxkggz8'}],\n",
634-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
635-
" 'schemaId': 'cl084bl3447yg0z7v2fn4ffqi',\n",
636-
" 'uuid': '6c774a37-3e9d-46d2-ac0c-e1fc4a474adb'},\n",
637-
" {'answer': {'schemaId': 'cl084bl3447yp0z7v371lbygl'},\n",
638-
" 'dataRow': {'id': 'cl084bjrs63kn0z817dhcfbnn'},\n",
639-
" 'schemaId': 'cl084bl3447ym0z7v18ezcbti',\n",
640-
" 'uuid': 'b408102f-5940-4d55-9430-847e4e8b2d3d'}]"
641-
]
642-
},
643-
"metadata": {},
644-
"execution_count": 15
645-
}
646-
],
527+
"outputs": [],
647528
"source": [
648529
"#for the purpose of this notebook, we will need to reset the schema ids of our checklist and radio answers\n",
649530
"image_data = ImageData(uid=data_row.uid)\n",
@@ -659,8 +540,6 @@
659540
" ]\n",
660541
")\n",
661542
"\n",
662-
"li_label.assign_feature_schema_ids(ontology_builder.from_project(li_project))\n",
663-
"\n",
664543
"ndjson_labels = list(NDJsonConverter.serialize([li_label]))\n",
665544
"\n",
666545
"ndjson_labels"
@@ -695,15 +574,15 @@
695574
},
696575
"outputs": [
697576
{
698-
"output_type": "stream",
699577
"name": "stderr",
578+
"output_type": "stream",
700579
"text": [
701580
"INFO:labelbox.schema.annotation_import:Sleeping for 10 seconds...\n"
702581
]
703582
},
704583
{
705-
"output_type": "stream",
706584
"name": "stdout",
585+
"output_type": "stream",
707586
"text": [
708587
"Errors: []\n"
709588
]
@@ -715,8 +594,13 @@
715594
}
716595
],
717596
"metadata": {
597+
"colab": {
598+
"collapsed_sections": [],
599+
"name": "image_mal.ipynb",
600+
"provenance": []
601+
},
718602
"kernelspec": {
719-
"display_name": "Python 3",
603+
"display_name": "Python 3.9.2 64-bit",
720604
"language": "python",
721605
"name": "python3"
722606
},
@@ -730,14 +614,14 @@
730614
"name": "python",
731615
"nbconvert_exporter": "python",
732616
"pygments_lexer": "ipython3",
733-
"version": "3.8.8"
617+
"version": "3.9.2"
734618
},
735-
"colab": {
736-
"name": "image_mal.ipynb",
737-
"provenance": [],
738-
"collapsed_sections": []
619+
"vscode": {
620+
"interpreter": {
621+
"hash": "397704579725e15f5c7cb49fe5f0341eb7531c82d19f2c29d197e8b64ab5776b"
622+
}
739623
}
740624
},
741625
"nbformat": 4,
742626
"nbformat_minor": 5
743-
}
627+
}

0 commit comments

Comments
 (0)