diff --git a/examples/basics/getting_started.ipynb b/examples/basics/getting_started.ipynb index a48f0506e..51925d066 100644 --- a/examples/basics/getting_started.ipynb +++ b/examples/basics/getting_started.ipynb @@ -243,7 +243,7 @@ "metadata": {}, "source": [ "queued_data_rows = project.export_queued_data_rows()\n", - "ground_truth_list = lb_types.LabelList()\n", + "ground_truth_list = list()\n", "\n", "for datarow in queued_data_rows:\n", " annotations_list = []\n", diff --git a/examples/integrations/detectron2/coco_object.ipynb b/examples/integrations/detectron2/coco_object.ipynb index f8678fa71..20295c922 100644 --- a/examples/integrations/detectron2/coco_object.ipynb +++ b/examples/integrations/detectron2/coco_object.ipynb @@ -415,7 +415,7 @@ { "metadata": {}, "source": [ - "labels_mea = lb_types.LabelList()\n", + "labels_mea = list()\n", "\n", "with ThreadPoolExecutor(4) as executor:\n", " futures = [executor.submit(get_label, label.data) for label in val_labels]\n", @@ -527,7 +527,7 @@ "# This is still a bit slow due to the amount of processing for each data row.\n", "# For larger datasets this has to leverage multiprocessing.\n", "\n", - "labels_mal = lb_types.LabelList()\n", + "labels_mal = list()\n", "with ThreadPoolExecutor(4) as executor:\n", " data_rows = dataset.data_rows()\n", " images = [lb_types.ImageData(url = data_row.row_data, uid = data_row.uid, external_id = data_row.external_id) for data_row in data_rows]\n", @@ -581,4 +581,4 @@ "execution_count": null } ] -} \ No newline at end of file +} diff --git a/examples/integrations/detectron2/coco_panoptic.ipynb b/examples/integrations/detectron2/coco_panoptic.ipynb index a36f916eb..3e96f770c 100644 --- a/examples/integrations/detectron2/coco_panoptic.ipynb +++ b/examples/integrations/detectron2/coco_panoptic.ipynb @@ -194,7 +194,7 @@ "model_name = \"detectron_panoptic_model\"\n", "\n", "proj = client.get_project(project_id)\n", - "labels = proj.label_generator().as_list()\n" + "labels = list(proj.label_generator())\n" ], "cell_type": "code", "outputs": [], @@ -205,8 +205,8 @@ "source": [ "# Set some labels aside for the val set.\n", "raw_data = labels._data\n", - "labels = lb_types.LabelList(raw_data[100:])\n", - "val_labels = lb_types.LabelList(raw_data[:100]) " + "labels = list(raw_data[100:])\n", + "val_labels = list(raw_data[:100]) " ], "cell_type": "code", "outputs": [], @@ -1008,12 +1008,13 @@ { "metadata": {}, "source": [ - "labels_mea = lb_types.LabelList()\n", + "labels = list()\n", "with ThreadPoolExecutor(4) as executor:\n", " futures = [executor.submit(get_label,label.data) for label in val_labels]\n", " for future in tqdm(as_completed(futures)):\n", - " labels_mea.append(future.result())\n", + " labels.append(future.result())\n", "\n", + "labels_mea = LabelGenerator(labels)\n", "labels_mea.add_url_to_masks(signer) \\\n", " .add_url_to_data(signer) " ], @@ -1287,7 +1288,7 @@ "# For larger datasets this has to leverage multiprocessing.\n", "\n", "\n", - "labels_mal = lb_types.LabelList()\n", + "labels_mal = list()\n", "with ThreadPoolExecutor(4) as executor:\n", " data_rows = dataset.data_rows()\n", " images = [lb_types.ImageData(url = data_row.row_data, uid = data_row.uid, external_id = data_row.external_id) for data_row in data_rows]\n", @@ -1365,4 +1366,4 @@ "execution_count": null } ] -} \ No newline at end of file +} diff --git a/examples/label_export/images.ipynb b/examples/label_export/images.ipynb index e36d905fd..e6ed52fed 100644 --- a/examples/label_export/images.ipynb +++ b/examples/label_export/images.ipynb @@ -1,18 +1,16 @@ { - "nbformat": 4, - "nbformat_minor": 5, - "metadata": {}, "cells": [ { + "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", "" - ], - "cell_type": "markdown" + ] }, { + "cell_type": "markdown", "metadata": {}, "source": [ "\n", @@ -24,28 +22,30 @@ "\n", "" - ], - "cell_type": "markdown" + ] }, { + "cell_type": "markdown", "metadata": {}, "source": [ "# Image Data Export\n", "* Export labels from image annotation projects" - ], - "cell_type": "markdown" + ] }, { + "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "!pip install \"labelbox[data]\"" - ], - "cell_type": "code", - "outputs": [], - "execution_count": null + ] }, { + "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "import labelbox as lb\n", "import labelbox.types as lb_types\n", @@ -53,41 +53,41 @@ "from PIL import Image\n", "import numpy as np\n", "import os" - ], - "cell_type": "code", - "outputs": [], - "execution_count": null + ] }, { + "cell_type": "markdown", "metadata": {}, "source": [ "# API Key and Client\n", "Provide a valid api key below in order to properly connect to the Labelbox Client." - ], - "cell_type": "markdown" + ] }, { + "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "# Add your api key and project\n", "API_KEY = None\n", "client = lb.Client(api_key=API_KEY)\n", "project = client.get_project(PROJECT_ID)" - ], - "cell_type": "code", - "outputs": [], - "execution_count": null + ] }, { + "cell_type": "markdown", "metadata": {}, "source": [ "### Export the labels\n", "* Data can be exported to annotation objects or raw_json (old export format)" - ], - "cell_type": "markdown" + ] }, { + "cell_type": "code", + "execution_count": null, "metadata": {}, + "outputs": [], "source": [ "labels = project.label_generator()\n", "\n", @@ -104,7 +104,7 @@ { "metadata": {}, "source": [ - "* Optionally convert to a `LabelList` for small to medium sized datasets\n", + "* Optionally convert to a `list` for small to medium sized datasets\n", "* This is more convenient than the `LabelGenerator` but less memory efficient\n", "* Read more about the differences [here](https://colab.research.google.com/github/Labelbox/labelbox-python/blob/master/examples/annotation_types/label_containers.ipynb)" ], @@ -113,7 +113,7 @@ { "metadata": {}, "source": [ - "labels = labels.as_list()" + "labels = list(labels)" ], "cell_type": "code", "outputs": [], @@ -169,4 +169,4 @@ "execution_count": null } ] -} \ No newline at end of file +} diff --git a/examples/label_export/text.ipynb b/examples/label_export/text.ipynb index db7b4cc4b..41ab0f4bd 100644 --- a/examples/label_export/text.ipynb +++ b/examples/label_export/text.ipynb @@ -110,7 +110,7 @@ { "metadata": {}, "source": [ - "Optionally, convert to a `LabelList` for small to medium-sized datasets.\n", + "Optionally, convert to a `list` for small to medium-sized datasets.\n", "\n", "This is more convenient than the LabelGenerator, but less memory efficient. Read more about the differences [here](https://colab.research.google.com/github/Labelbox/labelbox-python/blob/master/examples/annotation_types/label_containers.ipynb)." ], @@ -119,7 +119,7 @@ { "metadata": {}, "source": [ - "labels = labels.as_list()" + "labels = list(labels)" ], "cell_type": "code", "outputs": [], diff --git a/examples/model_diagnostics/custom_metrics_demo.ipynb b/examples/model_diagnostics/custom_metrics_demo.ipynb index e2b20516a..87d7df119 100644 --- a/examples/model_diagnostics/custom_metrics_demo.ipynb +++ b/examples/model_diagnostics/custom_metrics_demo.ipynb @@ -262,7 +262,7 @@ { "metadata": {}, "source": [ - "predictions = lb_types.LabelList()\n", + "predictions = list()\n", "for (image_url, external_id) in notebook.tqdm(image_data):\n", " image = lb_types.ImageData(url=image_url, external_id=external_id)\n", " height, width = image.value.shape[:2]\n", @@ -580,4 +580,4 @@ "execution_count": null } ] -} \ No newline at end of file +} diff --git a/examples/model_diagnostics/model_diagnostics_demo.ipynb b/examples/model_diagnostics/model_diagnostics_demo.ipynb index c87e187ae..190198b13 100644 --- a/examples/model_diagnostics/model_diagnostics_demo.ipynb +++ b/examples/model_diagnostics/model_diagnostics_demo.ipynb @@ -269,7 +269,7 @@ { "metadata": {}, "source": [ - "predictions = lb_types.LabelList()\n", + "predictions = list()\n", "for (image_url, external_id) in notebook.tqdm(image_data[:10]):\n", " image = lb_types.ImageData(url=image_url, external_id=external_id)\n", " height, width = image.value.shape[:2]\n", @@ -549,4 +549,4 @@ "execution_count": null } ] -} \ No newline at end of file +} diff --git a/examples/model_diagnostics/model_diagnostics_guide.ipynb b/examples/model_diagnostics/model_diagnostics_guide.ipynb index 7690e0a8e..9c355fcb1 100644 --- a/examples/model_diagnostics/model_diagnostics_guide.ipynb +++ b/examples/model_diagnostics/model_diagnostics_guide.ipynb @@ -207,7 +207,7 @@ { "metadata": {}, "source": [ - "predictions = lb_types.LabelList()\n", + "predictions = list()\n", "for label in notebook.tqdm(labels):\n", " annotations = []\n", " image = label.data\n", @@ -352,4 +352,4 @@ "execution_count": null } ] -} \ No newline at end of file +} diff --git a/labelbox/data/annotation_types/collection.py b/labelbox/data/annotation_types/collection.py index 32d323946..096e72817 100644 --- a/labelbox/data/annotation_types/collection.py +++ b/labelbox/data/annotation_types/collection.py @@ -22,6 +22,9 @@ class LabelList: Use on smaller datasets. """ + warnings.warn("LabelList is deprecated and will be " + "removed in a future release.") + def __init__(self, data: Optional[Iterable[Label]] = None): if data is None: self._data = [] @@ -187,6 +190,9 @@ def __init__(self, data: Generator[Label, None, None], *args, **kwargs): super().__init__(data, *args, **kwargs) def as_list(self) -> "LabelList": + warnings.warn("This method is deprecated and will be " + "removed in a future release. LabeList" + " class will be deprecated.") return LabelList(data=list(self)) def assign_feature_schema_ids(