From 6755fac3bc02e0c63066598292ae949f2da19b07 Mon Sep 17 00:00:00 2001 From: Andrea Ovalle <74880762+ovalle15@users.noreply.github.com> Date: Tue, 7 Feb 2023 14:19:50 -0500 Subject: [PATCH] Update video predictions imports 1. Simplify version of package prediction import 2. Created method to update schema ids --- .../prediction_upload/video_predictions.ipynb | 371 ++++++++++++------ 1 file changed, 251 insertions(+), 120 deletions(-) diff --git a/examples/prediction_upload/video_predictions.ipynb b/examples/prediction_upload/video_predictions.ipynb index 2a50a34ff..7c433c9a5 100644 --- a/examples/prediction_upload/video_predictions.ipynb +++ b/examples/prediction_upload/video_predictions.ipynb @@ -90,46 +90,23 @@ ], "metadata": { "id": "cm8xMaLbGb7v", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "outputId": "5c29838c-4c03-4903-851f-807967cf3e79" - }, - "execution_count": 2, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/185.5 KB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m185.5/185.5 KB\u001b[0m \u001b[31m5.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m7.8/7.8 MB\u001b[0m \u001b[31m104.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25h Building wheel for pygeotile (setup.py) ... \u001b[?25l\u001b[?25hdone\n" - ] + "pycharm": { + "is_executing": true } - ] + }, + "execution_count": null, + "outputs": [] }, { "cell_type": "code", "source": [ - "from labelbox.schema.ontology import OntologyBuilder, Tool, Classification, Option\n", - "from labelbox import Client, MALPredictionImport, LabelImport\n", - "from labelbox.data.serialization import NDJsonConverter\n", - "from labelbox.schema.media_type import MediaType\n", - "from labelbox.data.annotation_types import (\n", - " Label, ImageData, ObjectAnnotation, MaskData,\n", - " Rectangle, Point, Line, Mask,\n", - " Radio, Checklist,\n", - " ClassificationAnnotation, ClassificationAnswer\n", - ")\n", - "import uuid\n", - "import numpy as np\n", - "from labelbox.schema.queue_mode import QueueMode" + "import labelbox as lb\n", + "import uuid" ], "metadata": { "id": "NIq-6M9kHKSs" }, - "execution_count": 3, + "execution_count": null, "outputs": [] }, { @@ -146,12 +123,49 @@ "cell_type": "code", "source": [ "API_KEY = None\n", - "client = Client(API_KEY)" + "client = lb.Client(API_KEY)" ], "metadata": { "id": "z7ZLKLYLHP__" }, - "execution_count": 4, + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "## Helper method - only required to update bbox_with_radio_subclass tool with nested classification\n", + "\n", + "def set_feature_schema_id(features, nested_ndjson):\n", + " \"\"\"\n", + " features: accespts a project's ontology features \n", + " nested_ndjson: nested ndjson annotation object\n", + " name: tool name \n", + "\n", + " \"\"\"\n", + "\n", + " for i in features['tools']:\n", + " print(i)\n", + " if i['name'] == \"bbox_with_radio_subclass\":\n", + " ## Classification feature schema id\n", + " class_feature_schema_id = i['classifications'][0]['featureSchemaId']\n", + " ## Answer feature schema id (select one of the answers)\n", + " class_options_feature_schema_id = i['classifications'][0]['options'][0]['featureSchemaId']\n", + "\n", + " ## Update the original annotation with the schema ids\n", + " for frame in nested_ndjson['segments']:\n", + " for k in frame['keyframes']:\n", + " k['classifications'][0].update(\n", + " {'schemaId': class_feature_schema_id , \n", + " 'answer': {'schemaId': class_options_feature_schema_id}\n", + " }\n", + " )\n", + " return nested_ndjson" + ], + "metadata": { + "id": "_aFUwNVhzloh" + }, + "execution_count": null, "outputs": [] }, { @@ -179,7 +193,7 @@ "metadata": { "id": "FJhCAqeR-cUJ" }, - "execution_count": 86, + "execution_count": null, "outputs": [] }, { @@ -221,7 +235,7 @@ "metadata": { "id": "R--ZQXHkkYFd" }, - "execution_count": 87, + "execution_count": null, "outputs": [] }, { @@ -241,7 +255,7 @@ "metadata": { "id": "TY4ejoZZkeZn" }, - "execution_count": 88, + "execution_count": null, "outputs": [] }, { @@ -307,7 +321,7 @@ "metadata": { "id": "hMRgfWFykvm7" }, - "execution_count": 106, + "execution_count": null, "outputs": [] }, { @@ -333,9 +347,9 @@ " \"width\": 341.0\n", " },\n", " \"classifications\": [{\n", - " \"schemaId\": \"cldae51x50uph08zb3lqg4dgh\",\n", + " \"schemaId\": \"\",\n", " \"answer\": \n", - " {\"schemaId\":\"cldae51x50upi08zb5gzd8fw3\", 'confidence': 0.5} \n", + " {\"schemaId\": \"\", \"confidence\": 0.5} \n", " }] \n", " },\n", " {\n", @@ -347,9 +361,9 @@ " \"width\": 341.0\n", " },\n", " \"classifications\": [{\n", - " \"schemaId\": \"cldae51x50uph08zb3lqg4dgh\",\n", + " \"schemaId\": \"\",\n", " \"answer\": \n", - " {\"schemaId\":\"cldae51x50upi08zb5gzd8fw3\", 'confidence': 0.5}\n", + " {\"schemaId\": \"\", \"confidence\": 0.5}\n", " }] \n", " },\n", " {\n", @@ -361,9 +375,9 @@ " \"width\": 341.0\n", " },\n", " \"classifications\": [{\n", - " \"schemaId\": \"cldae51x50uph08zb3lqg4dgh\",\n", + " \"schemaId\": \"\",\n", " \"answer\": \n", - " {\"schemaId\":\"cldae51x50upi08zb5gzd8fw3\", 'confidence': 0.5}\n", + " {\"schemaId\": \"\", \"confidence\": 0.5}\n", " }]\n", " }\n", " ]\n", @@ -376,7 +390,7 @@ "metadata": { "id": "bmDBu_YHkymO" }, - "execution_count": 120, + "execution_count": null, "outputs": [] }, { @@ -401,7 +415,7 @@ "metadata": { "id": "Xil6CUrqk63g" }, - "execution_count": 91, + "execution_count": null, "outputs": [] }, { @@ -486,7 +500,7 @@ "metadata": { "id": "gu0ITN_flCAq" }, - "execution_count": 92, + "execution_count": null, "outputs": [] }, { @@ -515,24 +529,24 @@ "colab": { "base_uri": "https://localhost:8080/" }, - "outputId": "f05014e9-f61a-4da4-b1e1-20e721a4a890" + "outputId": "cae014f9-3105-4b8d-91b1-7313328f4f7d" }, - "execution_count": 93, + "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\n" ] } @@ -551,49 +565,49 @@ { "cell_type": "code", "source": [ - "ontology_builder = OntologyBuilder(\n", + "ontology_builder = lb.OntologyBuilder(\n", " classifications=[ # List of Classification objects\n", - " Classification( # Radio classification given the name \"text\" with two options: \"first_radio_answer\" and \"second_radio_answer\"\n", - " class_type=Classification.Type.RADIO, \n", + " lb.Classification( # Radio classification given the name \"text\" with two options: \"first_radio_answer\" and \"second_radio_answer\"\n", + " class_type=lb.Classification.Type.RADIO,\n", " instructions=\"radio_question\", \n", " options=[\n", - " Option(value=\"first_radio_answer\"),\n", - " Option(value=\"second_radio_answer\")\n", + " lb.Option(value=\"first_radio_answer\"),\n", + " lb.Option(value=\"second_radio_answer\")\n", " ]\n", " ),\n", - " Classification( # Checklist classification given the name \"text\" with two options: \"first_checklist_answer\" and \"second_checklist_answer\"\n", - " class_type=Classification.Type.CHECKLIST, \n", + " lb.Classification( # Checklist classification given the name \"text\" with two options: \"first_checklist_answer\" and \"second_checklist_answer\"\n", + " class_type=lb.Classification.Type.CHECKLIST,\n", " instructions=\"checklist_question\", \n", " options=[\n", - " Option(value=\"first_checklist_answer\"),\n", - " Option(value=\"second_checklist_answer\") \n", + " lb.Option(value=\"first_checklist_answer\"),\n", + " lb.Option(value=\"second_checklist_answer\")\n", " ]\n", " ), \n", - " Classification(\n", - " class_type=Classification.Type.RADIO, \n", + " lb.Classification(\n", + " class_type=lb.Classification.Type.RADIO,\n", " instructions=\"nested_radio_question\",\n", " options=[\n", - " Option(\"first_radio_answer\",\n", + " lb.Option(\"first_radio_answer\",\n", " options=[\n", - " Classification(\n", - " class_type=Classification.Type.RADIO,\n", + " lb.Classification(\n", + " class_type=lb.Classification.Type.RADIO,\n", " instructions=\"sub_radio_question\",\n", - " options=[Option(\"first_sub_radio_answer\")]\n", + " options=[lb.Option(\"first_sub_radio_answer\")]\n", " )\n", " ]\n", " )\n", " ] \n", " ),\n", - " Classification(\n", - " class_type=Classification.Type.CHECKLIST, \n", + " lb.Classification(\n", + " class_type=lb.Classification.Type.CHECKLIST,\n", " instructions=\"nested_checklist_question\",\n", " options=[\n", - " Option(value=\"first_checklist_answer\",\n", + " lb.Option(value=\"first_checklist_answer\",\n", " options=[\n", - " Classification(\n", - " class_type=Classification.Type.CHECKLIST, \n", + " lb.Classification(\n", + " class_type=lb.Classification.Type.CHECKLIST,\n", " instructions=\"sub_checklist_question\", \n", - " options=[Option(\"first_sub_checklist_answer\")]\n", + " options=[lb.Option(\"first_sub_checklist_answer\")]\n", " )\n", " ]\n", " )\n", @@ -601,36 +615,39 @@ " ) \n", " ],\n", " tools=[ # List of Tool objects\n", - " Tool( # Bounding Box tool given the name \"box\"\n", - " tool=Tool.Type.BBOX, \n", + " lb.Tool( # Bounding Box tool given the name \"box\"\n", + " tool=lb.Tool.Type.BBOX,\n", " name=\"bbox_video\"), \n", - " Tool( # Bounding Box tool given the name \"box\"\n", - " tool=Tool.Type.BBOX, \n", + " lb.Tool( # Bounding Box tool given the name \"box\"\n", + " tool=lb.Tool.Type.BBOX,\n", " name=\"bbox_with_radio_subclass\",\n", " classifications=[\n", - " Classification(\n", - " class_type=Classification.Type.RADIO,\n", + " lb.Classification(\n", + " class_type=lb.Classification.Type.RADIO,\n", " instructions=\"sub_radio_question\",\n", " options=[\n", - " Option(value=\"first_sub_radio_answer\")\n", + " lb.Option(value=\"first_sub_radio_answer\")\n", " ]\n", " ),\n", " ]\n", " ),\n", - " \t Tool( # Point tool given the name \"point\"\n", - " tool=Tool.Type.POINT, \n", + " \t lb.Tool( # Point tool given the name \"point\"\n", + " tool=lb.Tool.Type.POINT,\n", " name=\"point_video\"), \n", - " Tool( # Polyline tool given the name \"line\"\n", - " tool=Tool.Type.LINE, \n", + " lb.Tool( # Polyline tool given the name \"line\"\n", + " tool=lb.Tool.Type.LINE,\n", " name=\"line_video_frame\")]\n", ")\n", "\n", - "ontology = client.create_ontology(\"Video Prediction Import Demo\", ontology_builder.asdict(), media_type=MediaType.Video)" + "ontology = client.create_ontology(\"Video Prediction Import Demo\", ontology_builder.asdict(), media_type=lb.MediaType.Video)\n", + "\n", + "## Required to run set_feature_schema_id helper method \n", + "features_schema = ontology.normalized" ], "metadata": { "id": "Kt4XWWqgIiWk" }, - "execution_count": 6, + "execution_count": null, "outputs": [] }, { @@ -654,7 +671,7 @@ "metadata": { "id": "8n-AvzdiOR6d" }, - "execution_count": 107, + "execution_count": null, "outputs": [] }, { @@ -676,9 +693,9 @@ "colab": { "base_uri": "https://localhost:8080/" }, - "outputId": "1ac4ce7f-9121-4f24-d4e2-cd97628c26d5" + "outputId": "568e8a29-4f6a-45fa-ab57-33705c2dfe0a" }, - "execution_count": 108, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -688,7 +705,7 @@ ] }, "metadata": {}, - "execution_count": 108 + "execution_count": 104 } ] }, @@ -708,6 +725,56 @@ { "cell_type": "code", "source": [ + "## Lets set the schema ids for the nested prediction\n", + "set_feature_schema_id(features_schema, bbox_with_radio_subclass_prediction_ndjson)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "SG6AroR4cYPl", + "outputId": "cb8e4db1-024e-460f-c1b3-b79f422104ed" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "{'schemaNodeId': 'cldue0sfz0xuk070h5m79fxr7', 'featureSchemaId': 'cldue0sfz0xuj070hhe8abich', 'required': False, 'name': 'bbox_video', 'tool': 'rectangle', 'color': '#ff0000', 'archived': 0, 'classifications': []}\n", + "{'schemaNodeId': 'cldue0sg00xuq070hcd11ew6c', 'featureSchemaId': 'cldue0sg00xul070hfmr2ctri', 'required': False, 'name': 'bbox_with_radio_subclass', 'tool': 'rectangle', 'color': '#7fff00', 'archived': 0, 'classifications': [{'schemaNodeId': 'cldue0sg00xup070ha6bm5j6j', 'featureSchemaId': 'cldue0sg00xum070hbja6ekim', 'archived': 0, 'required': False, 'instructions': 'sub_radio_question', 'name': 'sub_radio_question', 'type': 'radio', 'options': [{'schemaNodeId': 'cldue0sg00xuo070ha4qi5dzz', 'featureSchemaId': 'cldue0sg00xun070hgs3h2t3y', 'label': 'first_sub_radio_answer', 'value': 'first_sub_radio_answer'}]}]}\n", + "{'schemaNodeId': 'cldue0sg00xus070hasoyhc7i', 'featureSchemaId': 'cldue0sg00xur070hds6dfn5s', 'required': False, 'name': 'point_video', 'tool': 'point', 'color': '#00ffff', 'archived': 0, 'classifications': []}\n", + "{'schemaNodeId': 'cldue0sg00xuu070hgle477r7', 'featureSchemaId': 'cldue0sg00xut070h5ysf6h4b', 'required': False, 'name': 'line_video_frame', 'tool': 'line', 'color': '#7f00ff', 'archived': 0, 'classifications': []}\n" + ] + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'name': 'bbox_with_radio_subclass',\n", + " 'segments': [{'keyframes': [{'frame': 13,\n", + " 'bbox': {'top': 146.0, 'left': 98.0, 'height': 382.0, 'width': 341.0},\n", + " 'classifications': [{'schemaId': 'cldue0sg00xum070hbja6ekim',\n", + " 'answer': {'schemaId': 'cldue0sg00xun070hgs3h2t3y'}}]},\n", + " {'frame': 14,\n", + " 'bbox': {'top': 146.0, 'left': 98.0, 'height': 382.0, 'width': 341.0},\n", + " 'classifications': [{'schemaId': 'cldue0sg00xum070hbja6ekim',\n", + " 'answer': {'schemaId': 'cldue0sg00xun070hgs3h2t3y'}}]},\n", + " {'frame': 15,\n", + " 'bbox': {'top': 146.0, 'left': 98.0, 'height': 382.0, 'width': 341.0},\n", + " 'classifications': [{'schemaId': 'cldue0sg00xum070hbja6ekim',\n", + " 'answer': {'schemaId': 'cldue0sg00xun070hgs3h2t3y'}}]}]}]}" + ] + }, + "metadata": {}, + "execution_count": 105 + } + ] + }, + { + "cell_type": "code", + "source": [ + "# Create a Label object by identifying the applicable data row in Labelbox and providing a list of annotations\n", "label_ndjson = []\n", "for prediction in [\n", " radio_prediction_ndjson,\n", @@ -728,7 +795,7 @@ "metadata": { "id": "F-Y7sSyAV3tn" }, - "execution_count": 109, + "execution_count": null, "outputs": [] }, { @@ -756,9 +823,9 @@ "colab": { "base_uri": "https://localhost:8080/" }, - "outputId": "043b7f57-4f13-4afa-e5dc-e8bda70211f8" + "outputId": "e9d969ad-4e51-4e7c-ffd5-a72f6374bcf6" }, - "execution_count": 110, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -792,19 +859,30 @@ "cell_type": "code", "source": [ "# Create a Labelbox project\n", - "project = client.create_project(name=\"video_prediction_demo\", \n", - " queue_mode=QueueMode.Batch,\n", + "project = client.create_project(name=\"video_prediction_demo\",\n", " # Quality Settings setup \n", " auto_audit_percentage=1,\n", " auto_audit_number_of_labels=1,\n", - " media_type=MediaType.Video)\n", + " media_type=lb.MediaType.Video)\n", "project.setup_editor(ontology)" ], "metadata": { - "id": "jEtoDiDrPFvI" + "id": "jEtoDiDrPFvI", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "f88329d1-f651-4c89-eedc-8aac2da278a5" }, - "execution_count": 111, - "outputs": [] + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stderr", + "text": [ + "WARNING:labelbox.client:Default createProject behavior will soon be adjusted to prefer batch projects. Pass in `queue_mode` parameter explicitly to opt-out for the time being.\n" + ] + } + ] }, { "cell_type": "markdown", @@ -829,19 +907,22 @@ "colab": { "base_uri": "https://localhost:8080/" }, - "outputId": "17415a52-82d0-487a-824e-e63c59beaef6" + "outputId": "fff72e06-4ef1-4311-9d3e-1cf0383da3f6", + "pycharm": { + "is_executing": true + } }, - "execution_count": 112, + "execution_count": null, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ - "" + "" ] }, "metadata": {}, - "execution_count": 112 + "execution_count": 109 } ] }, @@ -974,9 +1055,9 @@ " \"width\": 341.0\n", " },\n", " \"classifications\": [{\n", - " \"schemaId\": \"cldae51x50uph08zb3lqg4dgh\",\n", + " \"schemaId\": \"\",\n", " \"answer\": \n", - " {\"schemaId\":\"cldae51x50upi08zb5gzd8fw3\"}\n", + " {\"schemaId\":\"\"}\n", " }] \n", " },\n", " {\n", @@ -988,9 +1069,9 @@ " \"width\": 341.0\n", " },\n", " \"classifications\": [{\n", - " \"schemaId\": \"cldae51x50uph08zb3lqg4dgh\",\n", + " \"schemaId\": \"\",\n", " \"answer\": \n", - " {\"schemaId\":\"cldae51x50upi08zb5gzd8fw3\"}\n", + " {\"schemaId\":\"\"}\n", " }] \n", " },\n", " {\n", @@ -1002,9 +1083,9 @@ " \"width\": 341.0\n", " },\n", " \"classifications\": [{\n", - " \"schemaId\": \"cldae51x50uph08zb3lqg4dgh\",\n", + " \"schemaId\": \"\",\n", " \"answer\": \n", - " {\"schemaId\":\"cldae51x50upi08zb5gzd8fw3\"}\n", + " {\"schemaId\":\"\"}\n", " }]\n", " }\n", " ]\n", @@ -1106,7 +1187,7 @@ "metadata": { "id": "A8_HVvu9Uvfl" }, - "execution_count": 117, + "execution_count": null, "outputs": [] }, { @@ -1118,10 +1199,60 @@ "id": "8QwmguFvPltl" } }, + { + "cell_type": "code", + "source": [ + "## Lets set the schema ids for the nested annotation\n", + "set_feature_schema_id(features_schema, bbox_with_radio_subclass_annotation_ndjson)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "uV7PeokXcURb", + "outputId": "829bbb80-f814-45fb-a2cc-8cb68dc4fd6b" + }, + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "{'schemaNodeId': 'cldue0sfz0xuk070h5m79fxr7', 'featureSchemaId': 'cldue0sfz0xuj070hhe8abich', 'required': False, 'name': 'bbox_video', 'tool': 'rectangle', 'color': '#ff0000', 'archived': 0, 'classifications': []}\n", + "{'schemaNodeId': 'cldue0sg00xuq070hcd11ew6c', 'featureSchemaId': 'cldue0sg00xul070hfmr2ctri', 'required': False, 'name': 'bbox_with_radio_subclass', 'tool': 'rectangle', 'color': '#7fff00', 'archived': 0, 'classifications': [{'schemaNodeId': 'cldue0sg00xup070ha6bm5j6j', 'featureSchemaId': 'cldue0sg00xum070hbja6ekim', 'archived': 0, 'required': False, 'instructions': 'sub_radio_question', 'name': 'sub_radio_question', 'type': 'radio', 'options': [{'schemaNodeId': 'cldue0sg00xuo070ha4qi5dzz', 'featureSchemaId': 'cldue0sg00xun070hgs3h2t3y', 'label': 'first_sub_radio_answer', 'value': 'first_sub_radio_answer'}]}]}\n", + "{'schemaNodeId': 'cldue0sg00xus070hasoyhc7i', 'featureSchemaId': 'cldue0sg00xur070hds6dfn5s', 'required': False, 'name': 'point_video', 'tool': 'point', 'color': '#00ffff', 'archived': 0, 'classifications': []}\n", + "{'schemaNodeId': 'cldue0sg00xuu070hgle477r7', 'featureSchemaId': 'cldue0sg00xut070h5ysf6h4b', 'required': False, 'name': 'line_video_frame', 'tool': 'line', 'color': '#7f00ff', 'archived': 0, 'classifications': []}\n" + ] + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "{'name': 'bbox_with_radio_subclass',\n", + " 'segments': [{'keyframes': [{'frame': 13,\n", + " 'bbox': {'top': 146.0, 'left': 98.0, 'height': 382.0, 'width': 341.0},\n", + " 'classifications': [{'schemaId': 'cldue0sg00xum070hbja6ekim',\n", + " 'answer': {'schemaId': 'cldue0sg00xun070hgs3h2t3y'}}]},\n", + " {'frame': 14,\n", + " 'bbox': {'top': 146.0, 'left': 98.0, 'height': 382.0, 'width': 341.0},\n", + " 'classifications': [{'schemaId': 'cldue0sg00xum070hbja6ekim',\n", + " 'answer': {'schemaId': 'cldue0sg00xun070hgs3h2t3y'}}]},\n", + " {'frame': 15,\n", + " 'bbox': {'top': 146.0, 'left': 98.0, 'height': 382.0, 'width': 341.0},\n", + " 'classifications': [{'schemaId': 'cldue0sg00xum070hbja6ekim',\n", + " 'answer': {'schemaId': 'cldue0sg00xun070hgs3h2t3y'}}]}]}]}" + ] + }, + "metadata": {}, + "execution_count": 111 + } + ] + }, { "cell_type": "code", "source": [ "# Create a Label object by identifying the applicable data row in Labelbox and providing a list of annotations\n", + "\n", "ndjson_annotation = []\n", "for annot in [\n", " radio_annotation_ndjson, \n", @@ -1130,7 +1261,8 @@ " point_annotation_ndjson, \n", " polyline_annotation_ndjson,\n", " nested_radio_annotation_ndjson,\n", - " nested_checklist_prediction_ndjson\n", + " nested_checklist_prediction_ndjson,\n", + " bbox_with_radio_subclass_annotation_ndjson\n", "]:\n", " annot.update({\n", " 'uuid': str(uuid.uuid4()),\n", @@ -1141,7 +1273,7 @@ "metadata": { "id": "9gD_alThQA3G" }, - "execution_count": 118, + "execution_count": null, "outputs": [] }, { @@ -1156,7 +1288,7 @@ { "cell_type": "code", "source": [ - "upload_job_annotation = LabelImport.create_from_objects(\n", + "upload_job_annotation = lb.LabelImport.create_from_objects(\n", " client = client,\n", " project_id = project.uid,\n", " name=\"video_annotations_import_\" + str(uuid.uuid4()),\n", @@ -1171,9 +1303,9 @@ "colab": { "base_uri": "https://localhost:8080/" }, - "outputId": "eae9f53c-9dce-4958-bc03-e63d788527a1" + "outputId": "21c3a6e4-6df7-4e01-d719-6df2cdf5753c" }, - "execution_count": 119, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -1215,9 +1347,9 @@ "colab": { "base_uri": "https://localhost:8080/" }, - "outputId": "e82b9c98-a6e3-4696-bc8e-d84dd8f96378" + "outputId": "901b7b6e-a42d-43fd-9c2e-c2e11d0c4510" }, - "execution_count": 116, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -1227,7 +1359,7 @@ ] }, "metadata": {}, - "execution_count": 116 + "execution_count": 114 } ] }, @@ -1243,7 +1375,6 @@ { "cell_type": "code", "source": [ - "#upload_job\n", "# project.delete()\n", "# dataset.delete()" ], @@ -1254,4 +1385,4 @@ "outputs": [] } ] -} \ No newline at end of file +}