Skip to content

Commit 155e241

Browse files
authored
Merge pull request #240 from Labelbox/develop
rc3
2 parents 97bdd85 + 63c5cbf commit 155e241

39 files changed

+1184
-836
lines changed

CHANGELOG.md

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

3+
# Version 3.0.0-rc3 (2021-08-11)
4+
## Updates
5+
* Geometry.raster now has a consistent interface and improved functionality
6+
* renamed schema_id to feature_schema_id in the `FeatureSchema` class
7+
* `Mask` objects now use `MaskData` to represent segmentation masks instead of `ImageData`
8+
39
# Version 3.0.0-rc2 (2021-08-09)
410
## Updates
511
* Rename `data` property of TextData, ImageData, and VideoData types to `value`.

examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
| --------------------------- | --------------------------------- | ------------ |
1313
| Fundamentals | [Github](basics/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/basics/basics.ipynb) |
1414
| Data Rows | [Github](basics/data_rows.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/basics/data_rows.ipynb) |
15+
| Data Row Metadata | [Github](basics/data_row_metadata.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/basics/data_row_metadata.ipynb) |
1516
| Datasets | [Github](basics/datasets.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/basics/datasets.ipynb) |
1617
| Labels | [Github](basics/labels.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/basics/labels.ipynb) |
1718
| Ontologies | [Github](basics/ontologies.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/basics/ontologies.ipynb) |

examples/annotation_types/basics.ipynb

Lines changed: 46 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"from labelbox.data.annotation_types import (\n",
5757
" Label,\n",
5858
" ImageData,\n",
59+
" MaskData,\n",
5960
" LabelList,\n",
6061
" TextData,\n",
6162
" VideoData,\n",
@@ -397,7 +398,7 @@
397398
"1. Value\n",
398399
" - Must be either a Geometry, TextEntity, or Classification\n",
399400
" - This is the same as a top level tool in labelbox\n",
400-
"2. name or schema_id\n",
401+
"2. name or feature_schema_id\n",
401402
" - This is the id that corresponds to a particular class or just simply the class name\n",
402403
" - If uploading to labelbox this must match a field in an ontology.\n",
403404
"3. (Optional) Classifications \n",
@@ -437,7 +438,7 @@
437438
"\n",
438439
"point_annotation = ObjectAnnotation(\n",
439440
" value = Point(x = 5, y = 3),\n",
440-
" schema_id = \"ckrgcgl89000108jtggc9e687\"\n",
441+
" feature_schema_id = \"ckrgcgl89000108jtggc9e687\"\n",
441442
")"
442443
]
443444
},
@@ -471,7 +472,7 @@
471472
"\n",
472473
"polygon_annotation = ObjectAnnotation(\n",
473474
" value = Polygon(points = [Point(x = x, y = y) for x,y in xy_poly]),\n",
474-
" schema_id = \"ckrgcel71000008jtd9mn0szu\"\n",
475+
" feature_schema_id = \"ckrgcel71000008jtd9mn0szu\"\n",
475476
")\n",
476477
"\n"
477478
]
@@ -500,7 +501,7 @@
500501
"\n",
501502
"line_annotation = ObjectAnnotation(\n",
502503
" value = Line(points = [Point(x = x, y = y) for x,y in xy_line]),\n",
503-
" schema_id = \"ckrgcel71000008jtd9mn0szu\"\n",
504+
" feature_schema_id = \"ckrgcel71000008jtd9mn0szu\"\n",
504505
")"
505506
]
506507
},
@@ -529,7 +530,7 @@
529530
"\n",
530531
"rectangle_annotation = ObjectAnnotation(\n",
531532
" value = Rectangle(start = start, end = end),\n",
532-
" schema_id = \"ckrgcel71000008jtd9mn0szu\"\n",
533+
" feature_schema_id = \"ckrgcel71000008jtd9mn0szu\"\n",
533534
")"
534535
]
535536
},
@@ -551,13 +552,13 @@
551552
"source": [
552553
"\n",
553554
"mask_annotation = ObjectAnnotation(\n",
554-
" value = Mask(mask = ImageData(arr = np.zeros((32,32,3), dtype = np.uint8)), color = (255,255,255)),\n",
555+
" value = Mask(mask = MaskData(arr = np.zeros((32,32,3), dtype = np.uint8)), color = (255,255,255)),\n",
555556
" name = \"mask class name\"\n",
556557
")\n",
557558
"\n",
558559
"mask_annotation = ObjectAnnotation(\n",
559-
" value = Mask(mask = ImageData(arr = np.zeros((32,32,3), dtype = np.uint8)), color = (255,255,255)),\n",
560-
" schema_id = \"ckrgcel71000008jtd9mn0szu\"\n",
560+
" value = Mask(mask = MaskData(arr = np.zeros((32,32,3), dtype = np.uint8)), color = (255,255,255)),\n",
561+
" feature_schema_id = \"ckrgcel71000008jtd9mn0szu\"\n",
561562
")"
562563
]
563564
},
@@ -577,7 +578,7 @@
577578
"metadata": {},
578579
"outputs": [],
579580
"source": [
580-
"raster_data = ImageData(arr = np.zeros((32,32,3), dtype = np.uint8))\n",
581+
"raster_data = MaskData(arr = np.zeros((32,32,3), dtype = np.uint8))\n",
581582
"mask_annotation = ObjectAnnotation(\n",
582583
" value = Mask(mask = raster_data, color = [255,255,255]),\n",
583584
" name = \"eyes\"\n",
@@ -604,7 +605,7 @@
604605
"metadata": {},
605606
"outputs": [],
606607
"source": [
607-
"raster_data = ImageData(arr = np.zeros((32,32, 3), dtype = np.uint8))\n",
608+
"raster_data = MaskData(arr = np.zeros((32,32, 3), dtype = np.uint8))\n",
608609
"mask_annotation = ObjectAnnotation(\n",
609610
" value = Mask(mask = raster_data, color = (128,255,255)),\n",
610611
" name = \"eye\"\n",
@@ -639,7 +640,7 @@
639640
"\n",
640641
"entity_annotation = ObjectAnnotation(\n",
641642
" value = TextEntity(start = 10, end = 12),\n",
642-
" schema_id = \"ckrgddyli000108mk0c0t9qya\"\n",
643+
" feature_schema_id = \"ckrgddyli000108mk0c0t9qya\"\n",
643644
")"
644645
]
645646
},
@@ -734,7 +735,7 @@
734735
"outputs": [],
735736
"source": [
736737
"mask_annotation = Mask(\n",
737-
" mask = ImageData(arr = np_mask),\n",
738+
" mask = MaskData(arr = np_mask),\n",
738739
" color = color \n",
739740
")\n",
740741
"\n",
@@ -790,7 +791,7 @@
790791
"metadata": {},
791792
"outputs": [],
792793
"source": [
793-
"mask_data = ImageData(arr = np_seg_mask)\n",
794+
"mask_data = MaskData(arr = np_seg_mask)\n",
794795
"eye_mask = Mask(mask = mask_data, color = eye_color)\n",
795796
"nose_mask = Mask(mask = mask_data, color = nose_color)\n"
796797
]
@@ -844,7 +845,7 @@
844845
")\n",
845846
"\n",
846847
"text_annotation = ClassificationAnnotation(\n",
847-
" schema_id = \"my text class\", \n",
848+
" feature_schema_id = \"my text class\", \n",
848849
" value = Text(answer = \"some text answer\") \n",
849850
")"
850851
]
@@ -871,8 +872,8 @@
871872
"\n",
872873
"\n",
873874
"radio_annotation = ClassificationAnnotation(\n",
874-
" schema_id = \"ckresqdg7000001jnb70v4zcc\",\n",
875-
" value = Radio(answer = ClassificationAnswer(schema_id = \"ckrdy06ia000007ky94h04qlj\")) \n",
875+
" feature_schema_id = \"ckresqdg7000001jnb70v4zcc\",\n",
876+
" value = Radio(answer = ClassificationAnswer(feature_schema_id = \"ckrdy06ia000007ky94h04qlj\")) \n",
876877
")"
877878
]
878879
},
@@ -893,8 +894,8 @@
893894
"source": [
894895
"\n",
895896
"checklist_annotation = ClassificationAnnotation(\n",
896-
" schema_id = \"ckrestd5g000101jnhudjf29a\",\n",
897-
" value = Checklist(answer = [ClassificationAnswer(schema_id = \"ckrdy06ia000007ky94h04qlj\")])\n",
897+
" feature_schema_id = \"ckrestd5g000101jnhudjf29a\",\n",
898+
" value = Checklist(answer = [ClassificationAnswer(feature_schema_id = \"ckrdy06ia000007ky94h04qlj\")])\n",
898899
")\n",
899900
" \n",
900901
"checklist_annotation = ClassificationAnnotation(\n",
@@ -954,7 +955,7 @@
954955
" ),\n",
955956
" ObjectAnnotation(\n",
956957
" name = \"deer_eyes\",\n",
957-
" value = Mask(mask = ImageData(arr = np_mask), color = color)\n",
958+
" value = Mask(mask = MaskData(arr = np_mask), color = color)\n",
958959
" )\n",
959960
" ]\n",
960961
")"
@@ -967,7 +968,7 @@
967968
"source": [
968969
"### Interacting with labelbox:\n",
969970
"* For this label to be compatible with labelbox we need the following:\n",
970-
" - all named features must have schema_ids\n",
971+
" - all named features must have feature_schema_ids\n",
971972
" - all data must have urls\n",
972973
" - masks\n",
973974
" - images\n",
@@ -1170,7 +1171,7 @@
11701171
"metadata": {},
11711172
"source": [
11721173
"### Assigning Schema Ids:\n",
1173-
"* All tools, classifications, and options either have names or schema_ids.\n",
1174+
"* All tools, classifications, and options either have names or feature_schema_ids.\n",
11741175
"* Locally it is convenient to provide a name so that we don't need a labelbox project to use these interfaces.\n",
11751176
"* To use MAL and MEA schema ids are required"
11761177
]
@@ -1220,18 +1221,18 @@
12201221
"metadata": {},
12211222
"outputs": [],
12221223
"source": [
1223-
"def show_schema_ids(label):\n",
1224+
"def show_feature_schema_ids(label):\n",
12241225
" for annotation in label.annotations:\n",
1225-
" print(f\"Object : {annotation.name} - {annotation.schema_id}\")\n",
1226+
" print(f\"Object : {annotation.name} - {annotation.feature_schema_id}\")\n",
12261227
" for classification in getattr(annotation, 'classifications', []):\n",
1227-
" print(f\"--- Subclass : {classification.name} - {classification.schema_id}\")\n",
1228+
" print(f\"--- Subclass : {classification.name} - {classification.feature_schema_id}\")\n",
12281229
" option = classification.value\n",
1229-
" print(f\"--- --- Options: {option.answer.name} - {option.answer.schema_id}\")\n",
1230+
" print(f\"--- --- Options: {option.answer.name} - {option.answer.feature_schema_id}\")\n",
12301231
"\n",
12311232
" if isinstance(annotation, ClassificationAnnotation):\n",
12321233
" for option in annotation.value.answer:\n",
1233-
" print(f\"--- Options: {option.name} - {option.schema_id}\")\n",
1234-
"show_schema_ids(label)"
1234+
" print(f\"--- Options: {option.name} - {option.feature_schema_id}\")\n",
1235+
"show_feature_schema_ids(label)"
12351236
]
12361237
},
12371238
{
@@ -1241,8 +1242,8 @@
12411242
"metadata": {},
12421243
"outputs": [],
12431244
"source": [
1244-
"label.assign_schema_ids(ontology)\n",
1245-
"show_schema_ids(label)"
1245+
"label.assign_feature_schema_ids(ontology)\n",
1246+
"show_feature_schema_ids(label)"
12461247
]
12471248
},
12481249
{
@@ -1283,6 +1284,22 @@
12831284
"metadata": {},
12841285
"outputs": [],
12851286
"source": []
1287+
},
1288+
{
1289+
"cell_type": "code",
1290+
"execution_count": null,
1291+
"id": "progressive-courage",
1292+
"metadata": {},
1293+
"outputs": [],
1294+
"source": []
1295+
},
1296+
{
1297+
"cell_type": "code",
1298+
"execution_count": null,
1299+
"id": "asian-album",
1300+
"metadata": {},
1301+
"outputs": [],
1302+
"source": []
12861303
}
12871304
],
12881305
"metadata": {

examples/annotation_types/converters.ipynb

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

0 commit comments

Comments
 (0)