Skip to content

Commit 25ef5f2

Browse files
authored
Merge pull request #716 from Labelbox/mkozik/queue-quality
[QQC-500] Add deprecation warning for missing media type argument
2 parents e74d3bd + 0a6aca6 commit 25ef5f2

30 files changed

+226
-181
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* Use the `queue_mode` attribute in `Project` to get and set the queue mode instead
99
* For more information, visit https://docs.labelbox.com/reference/migrating-to-workflows#upcoming-changes
1010
* Updated `project.export_labels` to support filtering by start/end time formats "YYYY-MM-DD" and "YYYY-MM-DD hh:mm:ss"
11+
* Add deprecation warning for missing `media_type` in `create_project` in `Client`.
12+
1113
### Fixed
1214

1315
# Version 3.27.1 (2022-09-16)

examples/annotation_import/basics.ipynb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
" ClassificationAnnotation, ClassificationAnswer\n",
117117
")\n",
118118
"from labelbox.data.serialization import NDJsonConverter\n",
119+
"from labelbox.schema.media_type import MediaType\n",
119120
"import uuid\n",
120121
"import json"
121122
]
@@ -203,8 +204,14 @@
203204
"])\n",
204205
"\n",
205206
"\n",
206-
"mal_project = client.create_project(name=\"image_mal_project\")\n",
207-
"li_project = client.create_project(name=\"image_label_import_project\")\n",
207+
"mal_project = client.create_project(\n",
208+
" name=\"image_mal_project\",\n",
209+
" media_type=MediaType.Image\n",
210+
")\n",
211+
"li_project = client.create_project(\n",
212+
" name=\"image_label_import_project\",\n",
213+
" media_type=MediaType.Image\n",
214+
")\n",
208215
"\n",
209216
"\n",
210217
"dataset = client.create_dataset(name=\"annotation_import_demo_dataset\")\n",

examples/annotation_import/image.ipynb

Lines changed: 51 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,16 @@
8181
"execution_count": 1,
8282
"id": "4d63074b-2379-48af-b9d6-2a66190f03c4",
8383
"metadata": {
84-
"id": "4d63074b-2379-48af-b9d6-2a66190f03c4",
8584
"colab": {
8685
"base_uri": "https://localhost:8080/"
8786
},
87+
"id": "4d63074b-2379-48af-b9d6-2a66190f03c4",
8888
"outputId": "2560882d-6542-4dda-c075-d197ef2da5e3"
8989
},
9090
"outputs": [
9191
{
92-
"output_type": "stream",
9392
"name": "stdout",
93+
"output_type": "stream",
9494
"text": [
9595
"\u001b[K |████████████████████████████████| 172 kB 9.3 MB/s \n",
9696
"\u001b[K |████████████████████████████████| 6.3 MB 15.2 MB/s \n",
@@ -130,6 +130,7 @@
130130
" ClassificationAnnotation, ClassificationAnswer\n",
131131
")\n",
132132
"from labelbox.data.serialization import NDJsonConverter\n",
133+
"from labelbox.schema.media_type import MediaType\n",
133134
"import uuid\n",
134135
"import json\n",
135136
"import numpy as np"
@@ -196,15 +197,15 @@
196197
},
197198
{
198199
"cell_type": "markdown",
200+
"id": "49i_juOUr6av",
201+
"metadata": {
202+
"id": "49i_juOUr6av"
203+
},
199204
"source": [
200205
"First, we create an ontology with all the possible tools and classifications supported for images. The official list of supported annotations to import can be found here:\n",
201206
"- [Model-Assisted Labeling](https://docs.labelbox.com/docs/model-assisted-labeling) (annotations/labels are not submitted)\n",
202207
"- [Ground Truth](https://docs.labelbox.com/docs/import-ground-truth) (annotations/labels are submitted)"
203-
],
204-
"metadata": {
205-
"id": "49i_juOUr6av"
206-
},
207-
"id": "49i_juOUr6av"
208+
]
208209
},
209210
{
210211
"cell_type": "code",
@@ -258,13 +259,13 @@
258259
},
259260
{
260261
"cell_type": "markdown",
261-
"source": [
262-
"To show the two different ways to upload annotations, we create two projects - one to showcase MAL (Model-Assisted Labeling) and one to showcase Label Import."
263-
],
262+
"id": "1GdimALBuzRU",
264263
"metadata": {
265264
"id": "1GdimALBuzRU"
266265
},
267-
"id": "1GdimALBuzRU"
266+
"source": [
267+
"To show the two different ways to upload annotations, we create two projects - one to showcase MAL (Model-Assisted Labeling) and one to showcase Label Import."
268+
]
268269
},
269270
{
270271
"cell_type": "code",
@@ -276,8 +277,14 @@
276277
"outputs": [],
277278
"source": [
278279
"# Create two Labelbox projects\n",
279-
"mal_project = client.create_project(name=\"image_mal_project\")\n",
280-
"li_project = client.create_project(name=\"image_label_import_project\")\n",
280+
"mal_project = client.create_project(\n",
281+
" name=\"image_mal_project\",\n",
282+
" media_type=MediaType.Image\n",
283+
")\n",
284+
"li_project = client.create_project(\n",
285+
" name=\"image_label_import_project\",\n",
286+
" media_type=MediaType.Image\n",
287+
")\n",
281288
"\n",
282289
"# Create one Labelbox dataset\n",
283290
"dataset = client.create_dataset(name=\"image_annotation_import_demo_dataset\")\n",
@@ -319,6 +326,12 @@
319326
},
320327
{
321328
"cell_type": "code",
329+
"execution_count": 33,
330+
"id": "qzBqhV4Pv3yp",
331+
"metadata": {
332+
"id": "qzBqhV4Pv3yp"
333+
},
334+
"outputs": [],
322335
"source": [
323336
"point_annotation=ObjectAnnotation(\n",
324337
" value=Point(x=882,y=159), # Coordinates for this point annotation\n",
@@ -363,13 +376,7 @@
363376
" ),\n",
364377
" name=\"mask\" # Name of the tool in your ontology\n",
365378
")"
366-
],
367-
"metadata": {
368-
"id": "qzBqhV4Pv3yp"
369-
},
370-
"id": "qzBqhV4Pv3yp",
371-
"execution_count": 33,
372-
"outputs": []
379+
]
373380
},
374381
{
375382
"cell_type": "markdown",
@@ -383,6 +390,12 @@
383390
},
384391
{
385392
"cell_type": "code",
393+
"execution_count": 34,
394+
"id": "f2RtQQPCymOB",
395+
"metadata": {
396+
"id": "f2RtQQPCymOB"
397+
},
398+
"outputs": [],
386399
"source": [
387400
"text_annotation=ClassificationAnnotation(\n",
388401
" value=Text( # String value for the text annotation\n",
@@ -409,13 +422,7 @@
409422
" ), \n",
410423
" name=\"radio\" # Name of the classification in your ontology\n",
411424
")"
412-
],
413-
"metadata": {
414-
"id": "f2RtQQPCymOB"
415-
},
416-
"id": "f2RtQQPCymOB",
417-
"execution_count": 34,
418-
"outputs": []
425+
]
419426
},
420427
{
421428
"cell_type": "markdown",
@@ -440,15 +447,14 @@
440447
},
441448
"outputs": [
442449
{
443-
"output_type": "stream",
444450
"name": "stderr",
451+
"output_type": "stream",
445452
"text": [
446453
"/usr/local/lib/python3.7/dist-packages/labelbox/data/annotation_types/classification/classification.py:85: UserWarning: Dropdown classification is deprecated and will be removed in a future release\n",
447454
" warnings.warn(\"Dropdown classification is deprecated and will be \"\n"
448455
]
449456
},
450457
{
451-
"output_type": "execute_result",
452458
"data": {
453459
"text/plain": [
454460
"{'annotations': [ObjectAnnotation(name='point', feature_schema_id=None, extra={}, value=Point(extra={}, x=882.0, y=159.0), classifications=[]),\n",
@@ -464,8 +470,9 @@
464470
" 'uid': None}"
465471
]
466472
},
473+
"execution_count": 35,
467474
"metadata": {},
468-
"execution_count": 35
475+
"output_type": "execute_result"
469476
}
470477
],
471478
"source": [
@@ -518,30 +525,29 @@
518525
},
519526
{
520527
"cell_type": "code",
521-
"source": [
522-
"import copy # We import this python package so we can create copies of our hard-coded annotations and upload one copy to each"
523-
],
528+
"execution_count": 16,
529+
"id": "0U_cA2Cw0pH1",
524530
"metadata": {
525531
"id": "0U_cA2Cw0pH1"
526532
},
527-
"id": "0U_cA2Cw0pH1",
528-
"execution_count": 16,
529-
"outputs": []
533+
"outputs": [],
534+
"source": [
535+
"import copy # We import this python package so we can create copies of our hard-coded annotations and upload one copy to each"
536+
]
530537
},
531538
{
532539
"cell_type": "code",
533540
"execution_count": 39,
534541
"id": "53aaf87b-114f-4b56-a417-8c7cddc1f532",
535542
"metadata": {
536-
"id": "53aaf87b-114f-4b56-a417-8c7cddc1f532",
537543
"colab": {
538544
"base_uri": "https://localhost:8080/"
539545
},
546+
"id": "53aaf87b-114f-4b56-a417-8c7cddc1f532",
540547
"outputId": "e525feac-9f8e-49e7-95d0-33932998b0bd"
541548
},
542549
"outputs": [
543550
{
544-
"output_type": "execute_result",
545551
"data": {
546552
"text/plain": [
547553
"[{'classifications': [],\n",
@@ -620,8 +626,9 @@
620626
" 'uuid': '7e92e01b-740d-48b4-935e-560ba0b63fa5'}]"
621627
]
622628
},
629+
"execution_count": 39,
623630
"metadata": {},
624-
"execution_count": 39
631+
"output_type": "execute_result"
625632
}
626633
],
627634
"source": [
@@ -663,8 +670,8 @@
663670
},
664671
"outputs": [
665672
{
666-
"output_type": "stream",
667673
"name": "stdout",
674+
"output_type": "stream",
668675
"text": [
669676
"Errors: []\n"
670677
]
@@ -702,15 +709,14 @@
702709
"execution_count": 36,
703710
"id": "e8d4e99b-ad7e-48b9-8073-afb764d7c5b4",
704711
"metadata": {
705-
"id": "e8d4e99b-ad7e-48b9-8073-afb764d7c5b4",
706712
"colab": {
707713
"base_uri": "https://localhost:8080/"
708714
},
715+
"id": "e8d4e99b-ad7e-48b9-8073-afb764d7c5b4",
709716
"outputId": "704fac54-8f45-46f0-ce2d-3769c5b11f23"
710717
},
711718
"outputs": [
712719
{
713-
"output_type": "execute_result",
714720
"data": {
715721
"text/plain": [
716722
"[{'classifications': [],\n",
@@ -789,8 +795,9 @@
789795
" 'uuid': 'f413b3a2-1e71-473c-b3b0-c952791284df'}]"
790796
]
791797
},
798+
"execution_count": 36,
792799
"metadata": {},
793-
"execution_count": 36
800+
"output_type": "execute_result"
794801
}
795802
],
796803
"source": [
@@ -832,8 +839,8 @@
832839
},
833840
"outputs": [
834841
{
835-
"output_type": "stream",
836842
"name": "stdout",
843+
"output_type": "stream",
837844
"text": [
838845
"Errors: []\n"
839846
]

examples/annotation_import/pdf_mal.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
" ClassificationAnnotation, ClassificationAnswer\n",
8989
")\n",
9090
"from labelbox.data.serialization import NDJsonConverter\n",
91+
"from labelbox.schema.media_type import MediaType\n",
9192
"import uuid\n",
9293
"import json"
9394
]
@@ -208,7 +209,7 @@
208209
"outputs": [],
209210
"source": [
210211
"# Create two Labelbox projects\n",
211-
"mal_project = client.create_project(name=\"pdf_mal_project\")\n",
212+
"mal_project = client.create_project(name=\"pdf_mal_project\", media_type=MediaType.Document)\n",
212213
"\n",
213214
"# Create one Labelbox dataset\n",
214215
"dataset = client.create_dataset(name=\"pdf_annotation_import_demo_dataset\")\n",

examples/annotation_import/text.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
" ClassificationAnnotation, ClassificationAnswer\n",
113113
")\n",
114114
"from labelbox.data.serialization import NDJsonConverter\n",
115+
"from labelbox.schema.media_type import MediaType\n",
115116
"import uuid\n",
116117
"import json\n",
117118
"import numpy as np"
@@ -221,8 +222,8 @@
221222
},
222223
"outputs": [],
223224
"source": [
224-
"mal_project = client.create_project(name=\"text_mal_project\")\n",
225-
"li_project = client.create_project(name=\"text_label_import_project\")\n",
225+
"mal_project = client.create_project(name=\"text_mal_project\", media_type=MediaType.Text)\n",
226+
"li_project = client.create_project(name=\"text_label_import_project\", media_type=MediaType.Text)\n",
226227
"\n",
227228
"\n",
228229
"dataset = client.create_dataset(name=\"text_annotation_import_demo_dataset\")\n",

examples/annotation_import/tiled.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
" Radio, Checklist, Text,\n",
105105
" ClassificationAnnotation, ClassificationAnswer\n",
106106
")\n",
107+
"from labelbox.schema.media_type import MediaType\n",
107108
"from labelbox.schema.ontology import OntologyBuilder, Tool, Classification, Option\n",
108109
"from labelbox import Client, LabelingFrontend, LabelImport, MALPredictionImport"
109110
]
@@ -216,8 +217,8 @@
216217
},
217218
"outputs": [],
218219
"source": [
219-
"mal_project = client.create_project(name=\"tiled_imagery_mal_project\")\n",
220-
"li_project = client.create_project(name=\"tiled_imagery_import_project\")\n",
220+
"mal_project = client.create_project(name=\"tiled_imagery_mal_project\", media_type=MediaType.Geospatial_Tile)\n",
221+
"li_project = client.create_project(name=\"tiled_imagery_import_project\", media_type=MediaType.Geospatial_Tile)\n",
221222
"\n",
222223
"\n",
223224
"dataset = client.create_dataset(name=\"tiled_imagery_annotation_import_demo_dataset\")\n",

examples/annotation_import/video.ipynb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
"from typing import Dict, Any, Tuple\n",
6868
"\n",
6969
"from labelbox import Client, LabelingFrontend\n",
70-
"from labelbox.schema.ontology import OntologyBuilder, Tool, Classification, Option"
70+
"from labelbox.schema.ontology import OntologyBuilder, Tool, Classification, Option\n",
71+
"from labelbox.schema.media_type import MediaType"
7172
]
7273
},
7374
{
@@ -120,8 +121,8 @@
120121
"source": [
121122
"# Lets setup a project to label\n",
122123
"# Note see Ontology, Project, and Project_setup notebooks for more information on this section.\n",
123-
"project = client.create_project(name=\"video_mal_project\")\n",
124-
"dataset = client.create_dataset(name=\"video_mal_dataset\")\n",
124+
"project = client.create_project(name=\"video_mal_project\", media_type=MediaType.Video)\n",
125+
"dataset = client.create_dataset(name=\"video_mal_dataset\", media_type=MediaType.Video)\n",
125126
"dataset.create_data_row(\n",
126127
" row_data=\n",
127128
" \"https://storage.labelbox.com/cjhfn5y6s0pk507024nz1ocys%2Fb8837f3b-b071-98d9-645e-2e2c0302393b-jellyfish2-100-110.mp4\"\n",

examples/annotation_types/basics.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
" Label, ImageData, MaskData, LabelList, TextData, VideoData,\n",
8484
" ObjectAnnotation, ClassificationAnnotation, Polygon, Rectangle, Line, Mask,\n",
8585
" Point, Checklist, Radio, Text, TextEntity, ClassificationAnswer)\n",
86+
"from labelbox.schema.media_type import MediaType\n",
8687
"from labelbox import (LabelingFrontend, Client, OntologyBuilder, Tool,\n",
8788
" Classification, Option)\n",
8889
"from shapely.ops import transform\n",
@@ -1185,7 +1186,7 @@
11851186
"\n",
11861187
"editor = next(\n",
11871188
" client.get_labeling_frontends(where=LabelingFrontend.name == \"Editor\"))\n",
1188-
"project = client.create_project(name=\"test_annotation_types\")\n",
1189+
"project = client.create_project(name=\"test_annotation_types\", media_type=MediaType.Image)\n",
11891190
"project.setup(editor, ontology_builder.asdict())\n",
11901191
"project.datasets.connect(dataset)\n",
11911192
"\n",

0 commit comments

Comments
 (0)