From 588e7d0098c059ca050aa32558a3fee2df866c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20G=C5=82uszek?= Date: Thu, 16 Feb 2023 12:28:31 +0100 Subject: [PATCH 1/6] add relationship tool --- labelbox/schema/ontology.py | 1 + 1 file changed, 1 insertion(+) diff --git a/labelbox/schema/ontology.py b/labelbox/schema/ontology.py index d40b8d7c5..f487b8b6e 100644 --- a/labelbox/schema/ontology.py +++ b/labelbox/schema/ontology.py @@ -241,6 +241,7 @@ class Type(Enum): BBOX = "rectangle" LINE = "line" NER = "named-entity" + RELATIONSHIP = "edge" tool: Type name: str From 667dc974b39711a36f776aaf6201252afab99f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20G=C5=82uszek?= Date: Mon, 27 Feb 2023 17:07:18 +0100 Subject: [PATCH 2/6] update notebooks --- examples/annotation_import/image.ipynb | 9 ++++++--- examples/annotation_import/pdf.ipynb | 5 ++++- examples/basics/ontologies.ipynb | 3 ++- examples/prediction_upload/video_predictions.ipynb | 11 +++++++---- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/examples/annotation_import/image.ipynb b/examples/annotation_import/image.ipynb index 87cdf093d..b06230205 100644 --- a/examples/annotation_import/image.ipynb +++ b/examples/annotation_import/image.ipynb @@ -568,7 +568,7 @@ "len(test_img_url)" ], "metadata": { - "id": "xJ3DZLv_LGsK", + "id": "xJ3DZLv_LGsK", "colab": { "base_uri": "https://localhost:8080/" }, @@ -705,7 +705,10 @@ " name=\"point\"), \n", " lb.Tool( # Polyline tool given the name \"line\"\n", " tool=lb.Tool.Type.LINE,\n", - " name=\"polyline\")]\n", + " name=\"polyline\"),\n", + " lb.Tool( # Relationship tool given the name \"relationship\"\n", + " tool=lb.Tool.Type.RELATIONSHIP,\n", + " name=\"relationship\")]\n", ")\n", "\n", "ontology = client.create_ontology(\"Image Prediction Import Demo\", ontology_builder.asdict(), media_type=lb.MediaType.Image)" @@ -930,7 +933,7 @@ "print(\" \")" ], "metadata": { - "id": "wPflwCr3_03e", + "id": "wPflwCr3_03e", "colab": { "base_uri": "https://localhost:8080/" }, diff --git a/examples/annotation_import/pdf.ipynb b/examples/annotation_import/pdf.ipynb index 3c91dca33..62176fbb7 100644 --- a/examples/annotation_import/pdf.ipynb +++ b/examples/annotation_import/pdf.ipynb @@ -173,7 +173,10 @@ " tools=[ \n", " Tool( # Entity tool given the name \"NER\"\n", " tool=Tool.Type.NER, \n", - " name= tool_name)]\n", + " name= tool_name),\n", + " Tool( # Relationship tool given the name \"relationship\"\n", + " tool=Tool.Type.NER, \n", + " name=\"relationship\")]\n", " )" ] }, diff --git a/examples/basics/ontologies.ipynb b/examples/basics/ontologies.ipynb index e4e50597c..4f892955b 100644 --- a/examples/basics/ontologies.ipynb +++ b/examples/basics/ontologies.ipynb @@ -335,7 +335,8 @@ "seg_tool = Tool(tool=Tool.Type.SEGMENTATION, name=\"dog_seg\")\n", "point_tool = Tool(tool=Tool.Type.POINT, name=\"dog_center\")\n", "line_tool = Tool(tool=Tool.Type.LINE, name=\"dog_orientation\")\n", - "ner_tool = Tool(tool=Tool.Type.NER, name=\"dog_reference\")" + "ner_tool = Tool(tool=Tool.Type.NER, name=\"dog_reference\")\n", + "relationship_tool = Tool(tool=Tool.Type.RELATIONSHIP, name=\"relationship\")" ], "outputs": [], "metadata": { diff --git a/examples/prediction_upload/video_predictions.ipynb b/examples/prediction_upload/video_predictions.ipynb index d25f6efd1..7c11b0557 100644 --- a/examples/prediction_upload/video_predictions.ipynb +++ b/examples/prediction_upload/video_predictions.ipynb @@ -651,7 +651,10 @@ " name=\"point_video\"), \n", " lb.Tool( # Polyline tool given the name \"line\"\n", " tool=lb.Tool.Type.LINE,\n", - " name=\"line_video_frame\")]\n", + " name=\"line_video_frame\"),\n", + " lb.Tool( # Relationship tool given the name \"relationship\"\n", + " tool=lb.Tool.Type.RELATIONSHIP,\n", + " name=\"relationship_video\")]\n", ")\n", "\n", "ontology = client.create_ontology(\"Video Prediction Import Demo\", ontology_builder.asdict(), media_type=lb.MediaType.Video)\n", @@ -1392,10 +1395,10 @@ "source": [ "# project.delete()\n", "# dataset.delete()" - ], - "metadata": { + ], + "metadata": { "id": "aAhkyvJlWK1p" - }, + }, "execution_count": 26, "outputs": [] } From 934a0e59a8d1d5f4286019cd92df26c3c76eb4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20G=C5=82uszek?= Date: Mon, 27 Feb 2023 17:19:05 +0100 Subject: [PATCH 3/6] notebook formatting --- examples/annotation_import/image.ipynb | 4 ++-- examples/prediction_upload/video_predictions.ipynb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/annotation_import/image.ipynb b/examples/annotation_import/image.ipynb index b06230205..6f2e4d798 100644 --- a/examples/annotation_import/image.ipynb +++ b/examples/annotation_import/image.ipynb @@ -568,7 +568,7 @@ "len(test_img_url)" ], "metadata": { - "id": "xJ3DZLv_LGsK", + "id": "xJ3DZLv_LGsK", "colab": { "base_uri": "https://localhost:8080/" }, @@ -933,7 +933,7 @@ "print(\" \")" ], "metadata": { - "id": "wPflwCr3_03e", + "id": "wPflwCr3_03e", "colab": { "base_uri": "https://localhost:8080/" }, diff --git a/examples/prediction_upload/video_predictions.ipynb b/examples/prediction_upload/video_predictions.ipynb index 7c11b0557..e0da09a92 100644 --- a/examples/prediction_upload/video_predictions.ipynb +++ b/examples/prediction_upload/video_predictions.ipynb @@ -1395,10 +1395,10 @@ "source": [ "# project.delete()\n", "# dataset.delete()" - ], - "metadata": { + ], + "metadata": { "id": "aAhkyvJlWK1p" - }, + }, "execution_count": 26, "outputs": [] } From 67a822847907bb0138a2008db1e29b3bdf0c7cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20G=C5=82uszek?= Date: Tue, 28 Feb 2023 19:45:26 +0100 Subject: [PATCH 4/6] fix typo --- examples/annotation_import/pdf.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/annotation_import/pdf.ipynb b/examples/annotation_import/pdf.ipynb index 62176fbb7..cd234f9dd 100644 --- a/examples/annotation_import/pdf.ipynb +++ b/examples/annotation_import/pdf.ipynb @@ -175,7 +175,7 @@ " tool=Tool.Type.NER, \n", " name= tool_name),\n", " Tool( # Relationship tool given the name \"relationship\"\n", - " tool=Tool.Type.NER, \n", + " tool=Tool.Type.RELATIONSHIP, \n", " name=\"relationship\")]\n", " )" ] From 63184262ef1458cbbba879b02ee91509d16a4daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20G=C5=82uszek?= Date: Tue, 28 Feb 2023 20:10:03 +0100 Subject: [PATCH 5/6] update notebooks --- examples/annotation_import/pdf.ipynb | 6 ++++-- examples/basics/ontologies.ipynb | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/annotation_import/pdf.ipynb b/examples/annotation_import/pdf.ipynb index 8678c8687..f641c47a8 100644 --- a/examples/annotation_import/pdf.ipynb +++ b/examples/annotation_import/pdf.ipynb @@ -120,12 +120,14 @@ { "metadata": {}, "source": [ - "tool_name = \"super\"\n", "ontology_builder = lb.OntologyBuilder(\n", " tools=[ \n", " lb.Tool( # Entity tool given the name \"NER\"\n", " tool=lb.Tool.Type.NER, \n", - " name= tool_name)]\n", + " name= \"NER\"),\n", + " lb.Tool( # Relationship tool given the name \"relationship\"\n", + " tool=lb.Tool.Type.NER, \n", + " name=\"relationship\")]\n", " )" ], "cell_type": "code", diff --git a/examples/basics/ontologies.ipynb b/examples/basics/ontologies.ipynb index baa2b7f82..c1102eddb 100644 --- a/examples/basics/ontologies.ipynb +++ b/examples/basics/ontologies.ipynb @@ -93,7 +93,8 @@ "| Polyline | line |\n", "| Point | point |\n", "| Segmentation mask | superpixel |\n", - "| Entity | named-entity |" + "| Entity | named-entity |\n", + "| Relationship | edge |" ], "cell_type": "markdown" }, @@ -315,7 +316,8 @@ "seg_tool = lb.Tool(tool=lb.Tool.Type.SEGMENTATION, name=\"dog_seg\")\n", "point_tool = lb.Tool(tool=lb.Tool.Type.POINT, name=\"dog_center\")\n", "line_tool = lb.Tool(tool=lb.Tool.Type.LINE, name=\"dog_orientation\")\n", - "ner_tool = lb.Tool(tool=lb.Tool.Type.NER, name=\"dog_reference\")" + "ner_tool = lb.Tool(tool=lb.Tool.Type.NER, name=\"dog_reference\")\n", + "relationship_tool = lb.Tool(tool=lb.Tool.Type.RELATIONSHIP, name=\"relationship\")" ], "cell_type": "code", "outputs": [], From 69373ed1423c9d32c7b2de9332fa4fcd91260d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20G=C5=82uszek?= Date: Wed, 1 Mar 2023 17:35:23 +0100 Subject: [PATCH 6/6] fix typo --- examples/annotation_import/pdf.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/annotation_import/pdf.ipynb b/examples/annotation_import/pdf.ipynb index f641c47a8..0f9f2e037 100644 --- a/examples/annotation_import/pdf.ipynb +++ b/examples/annotation_import/pdf.ipynb @@ -126,7 +126,7 @@ " tool=lb.Tool.Type.NER, \n", " name= \"NER\"),\n", " lb.Tool( # Relationship tool given the name \"relationship\"\n", - " tool=lb.Tool.Type.NER, \n", + " tool=lb.Tool.Type.RELATIONSHIP, \n", " name=\"relationship\")]\n", " )" ],