Skip to content

Commit 9cf2cb0

Browse files
authored
Release 3.56.0 (#1291)
2 parents 31b79da + dd51c41 commit 9cf2cb0

File tree

29 files changed

+1758
-285
lines changed

29 files changed

+1758
-285
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
# Version 3.56.0 (2023-11-21)
4+
## Added
5+
* Support for importing raster video masks from image bytes as a source
6+
* Add new ExportTask class to handle streaming of exports
7+
## Fixed
8+
* Check for empty fields during webhook creation
9+
## Notebooks
10+
* Updates to use bytes array for masks (video, image), and add examples of multiple notations per frame (video)
11+
312
# Version 3.55.0 (2023-11-06)
413
## Fixed
514
* Fix the instantiation of `failed_data_row_ids` in Batch. This fix will address the issue with the `create_batch` method for more than 1,000 data rows.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
build-image:
3-
docker build -t local/labelbox-python:test .
3+
docker build --quiet -t local/labelbox-python:test .
44

55
test-local: build-image
66

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The Labelbox Python API offers a simple, user-friendly way to interact with the
1818

1919
## Requirements
2020

21-
- Use Python 3.7, 3.8 or 3.9
21+
- Use Python 3.7, 3.8, 3.9 and 3.10
2222
- [Create an account](http://app.labelbox.com/)
2323
- [Generate an API key](https://docs.labelbox.com/docs/create-an-api-key)
2424

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
copyright = '2021, Labelbox'
2222
author = 'Labelbox'
2323

24-
release = '3.55.0'
24+
release = '3.56.0'
2525

2626
# -- General configuration ---------------------------------------------------
2727

docs/source/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,10 @@ QualityMode
222222
.. automodule:: labelbox.schema.quality_mode
223223
:members:
224224
:show-inheritance:
225+
226+
ExportTask
227+
---------------------------
228+
229+
.. automodule:: labelbox.schema.export_task
230+
:members:
231+
:show-inheritance:

examples/annotation_import/image.ipynb

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@
8585
"metadata": {},
8686
"source": [
8787
"import uuid\n",
88+
"import requests\n",
89+
"import base64\n",
8890
"import numpy as np\n",
8991
"import labelbox as lb\n",
9092
"import labelbox.types as lb_types"
@@ -297,7 +299,7 @@
297299
"bbox_annotation = lb_types.ObjectAnnotation(\n",
298300
" name=\"bounding_box\", # must match your ontology feature\"s name\n",
299301
" value=lb_types.Rectangle(\n",
300-
" start=lb_types.Point(x=1690, y=977), # x = left, y = top \n",
302+
" start=lb_types.Point(x=1690, y=977), # x = left, y = top\n",
301303
" end=lb_types.Point(x=1915, y=1307), # x= left + width , y = top + height\n",
302304
" ))\n",
303305
"\n",
@@ -330,7 +332,7 @@
330332
"bbox_with_radio_subclass_annotation = lb_types.ObjectAnnotation(\n",
331333
" name=\"bbox_with_radio_subclass\",\n",
332334
" value=lb_types.Rectangle(\n",
333-
" start=lb_types.Point(x=541, y=933), # x = left, y = top \n",
335+
" start=lb_types.Point(x=541, y=933), # x = left, y = top\n",
334336
" end=lb_types.Point(x=871, y=1124), # x= left + width , y = top + height\n",
335337
" ),\n",
336338
" classifications=[\n",
@@ -373,7 +375,7 @@
373375
"source": [
374376
"# Python annotation\n",
375377
"polygon_annotation = lb_types.ObjectAnnotation(\n",
376-
" name=\"polygon\", # must match your ontology feature\"s name \n",
378+
" name=\"polygon\", # must match your ontology feature\"s name\n",
377379
" value=lb_types.Polygon( # Coordinates for the vertices of your polygon\n",
378380
" points=[\n",
379381
" lb_types.Point(x=1489.581, y=183.934),\n",
@@ -430,23 +432,25 @@
430432
{
431433
"metadata": {},
432434
"source": [
433-
"# Identifying what values in the numpy array correspond to the mask annotation\n",
434-
"color = (255, 255, 255)\n",
435-
"mask_data = lb_types.MaskData(url=\"https://storage.googleapis.com/labelbox-datasets/image_sample_data/raster_seg.png\")\n",
435+
"### Raster Segmentation (Byte string array)\n",
436+
"url = \"https://storage.googleapis.com/labelbox-datasets/image_sample_data/raster_seg.png\"\n",
437+
"response = requests.get(url)\n",
436438
"\n",
437-
"# Python annotation\n",
439+
"mask_data = lb.types.MaskData(im_bytes=response.content) # You can also use \"url\" instead of img_bytes to pass the PNG mask url.\n",
438440
"mask_annotation = lb_types.ObjectAnnotation(\n",
439-
" name = \"mask\", # must match your ontology feature\"s name\n",
440-
" value=lb_types.Mask(mask=mask_data, color=color),\n",
441+
" name=\"mask\",\n",
442+
" value=lb_types.Mask(\n",
443+
" mask=mask_data,\n",
444+
" color=(255, 255, 255))\n",
441445
")\n",
442446
"\n",
443-
"# NDJSON\n",
447+
"# NDJSON using instanceURI, bytes array is not fully supported.\n",
444448
"mask_annotation_ndjson = {\n",
445449
" \"name\": \"mask\",\n",
446450
" \"classifications\": [],\n",
447-
" \"mask\": {\"instanceURI\": \"https://storage.googleapis.com/labelbox-datasets/image_sample_data/raster_seg.png\",\n",
451+
" \"mask\": {\"instanceURI\": url,\n",
448452
" \"colorRGB\": (255, 255, 255)}\n",
449-
"}"
453+
"}\n"
450454
],
451455
"cell_type": "code",
452456
"outputs": [],
@@ -591,7 +595,7 @@
591595
" type=lb_types.Relationship.Type.UNIDIRECTIONAL,\n",
592596
" ))\n",
593597
"\n",
594-
"## Only supported for MAL imports \n",
598+
"## Only supported for MAL imports\n",
595599
"uuid_source = str(uuid.uuid4())\n",
596600
"uuid_target = str(uuid.uuid4())\n",
597601
"\n",
@@ -855,7 +859,7 @@
855859
{
856860
"metadata": {},
857861
"source": [
858-
"ndjson_label = []\n",
862+
"label_ndjson = []\n",
859863
"annotations = [\n",
860864
" radio_annotation_ndjson,\n",
861865
" nested_radio_annotation_ndjson,\n",
@@ -870,15 +874,15 @@
870874
" polyline_annotation_ndjson,\n",
871875
" bbox_source_ndjson,\n",
872876
" bbox_target_ndjson,\n",
873-
" relationship_ndjson, ## Only supported for MAL imports \n",
877+
" relationship_ndjson, ## Only supported for MAL imports\n",
874878
"]\n",
875879
"for annotation in annotations:\n",
876880
" annotation.update({\n",
877881
" \"dataRow\": {\n",
878882
" \"globalKey\": global_key\n",
879-
" },\n",
883+
" }\n",
880884
" })\n",
881-
" ndjson_label.append(annotation)"
885+
" label_ndjson.append(annotation)"
882886
],
883887
"cell_type": "code",
884888
"outputs": [],
@@ -911,7 +915,7 @@
911915
")\n",
912916
"upload_job.wait_until_done()\n",
913917
"\n",
914-
"print(f\"Errors: {upload_job.errors}\", )\n",
918+
"print(f\"Errors: {upload_job.errors}\")\n",
915919
"print(f\"Status of uploads: {upload_job.statuses}\")"
916920
],
917921
"cell_type": "code",
@@ -928,14 +932,14 @@
928932
{
929933
"metadata": {},
930934
"source": [
931-
"# Uncomment if relationships are not being imported. \n",
932-
"# Relationships will be supported for label import in the near future. \n",
935+
"# Relationships are not supported with LabelImport\n",
936+
"# For this demo either run MAL or Ground Truth, not both\n",
933937
"\n",
934938
"# Upload label for this data row in project\n",
935939
"# upload_job = lb.LabelImport.create_from_objects(\n",
936-
"# client = client, \n",
937-
"# project_id = project.uid, \n",
938-
"# name=\"label_import_job\"+str(uuid.uuid4()), \n",
940+
"# client = client,\n",
941+
"# project_id = project.uid,\n",
942+
"# name=\"label_import_job\"+str(uuid.uuid4()),\n",
939943
"# labels=label)\n",
940944
"\n",
941945
"# print(\"Errors:\", upload_job.errors)\n",
@@ -954,6 +958,13 @@
954958
"cell_type": "code",
955959
"outputs": [],
956960
"execution_count": null
961+
},
962+
{
963+
"metadata": {},
964+
"source": [],
965+
"cell_type": "code",
966+
"outputs": [],
967+
"execution_count": null
957968
}
958969
]
959970
}

0 commit comments

Comments
 (0)