-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #536 from Labelbox/develop
3.18.0
- Loading branch information
Showing
26 changed files
with
1,821 additions
and
1,627 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
Sphinx==3.4.3 | ||
Sphinx==4.5.0 | ||
sphinxcontrib-napoleon==0.7 | ||
sphinx-rtd-theme==0.5.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,329 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "db768cda", | ||
"metadata": { | ||
"id": "db768cda" | ||
}, | ||
"source": [ | ||
"<td>\n", | ||
" <a target=\"_blank\" href=\"https://labelbox.com\" ><img src=\"https://labelbox.com/blog/content/images/2021/02/logo-v4.svg\" width=256/></a>\n", | ||
"</td>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "cb5611d0", | ||
"metadata": { | ||
"id": "cb5611d0" | ||
}, | ||
"source": [ | ||
"<td>\n", | ||
"<a href=\"https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/basics/data_rows.ipynb\" target=\"_blank\"><img\n", | ||
"src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"></a>\n", | ||
"</td>\n", | ||
"\n", | ||
"<td>\n", | ||
"<a href=\"https://github.com/Labelbox/labelbox-python/tree/develop/examples/basics/data_rows.ipynb\" target=\"_blank\"><img\n", | ||
"src=\"https://img.shields.io/badge/GitHub-100000?logo=github&logoColor=white\" alt=\"GitHub\"></a>\n", | ||
"</td>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"## Batches (*Currently in Public Beta*)" | ||
], | ||
"metadata": { | ||
"id": "Lup2QNWjaxKg" | ||
}, | ||
"id": "Lup2QNWjaxKg" | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"* A Batch is collection of datarows picked out of a Data Set.\n", | ||
"* A Datarow cannot be part of more than one batch in a project.\n", | ||
"* Batches work for all data types, but there should only be one data type per batch.\n", | ||
"* Batches may not be shared between projects.\n", | ||
"* Batches may have Datarows from multiple Datasets.\n", | ||
"* Datarows can only be attached to a Project as part of a single Batch.\n", | ||
"* You can set priority for each Batch." | ||
], | ||
"metadata": { | ||
"id": "KONWmRQkadPf" | ||
}, | ||
"id": "KONWmRQkadPf" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "HoW5ypnyzpqb" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"!pip install labelbox[data]" | ||
], | ||
"id": "HoW5ypnyzpqb" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "6-Us9Gj1zpqc" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from labelbox import DataRow, Client\n", | ||
"import random" | ||
], | ||
"id": "6-Us9Gj1zpqc" | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "qQiozm-dzpqd" | ||
}, | ||
"source": [ | ||
"Set the following cell with your data to run this notebook:" | ||
], | ||
"id": "qQiozm-dzpqd" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "84Zna5c0zpqd" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"PROJECT_NAME = \"Batch Queue Demo\" #text project\n", | ||
"DATASET_NAME = \"Batch Queue Demo Data\"" | ||
], | ||
"id": "84Zna5c0zpqd" | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "b0b09aee", | ||
"metadata": { | ||
"id": "b0b09aee" | ||
}, | ||
"source": [ | ||
"# API Key and Client\n", | ||
"Provide a valid api key below in order to properly connect to the Labelbox Client." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "Ge-dfNh-zpqe" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# Add your api key\n", | ||
"API_KEY = None\n", | ||
"client = Client(api_key=API_KEY)" | ||
], | ||
"id": "Ge-dfNh-zpqe" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"id": "nMVtBYQmzpqe" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"dataset = client.create_dataset(name=DATASET_NAME)\n", | ||
"\n", | ||
"uploads = []\n", | ||
"for i in range(10):\n", | ||
" uploads.append({\n", | ||
" 'external_id': i,\n", | ||
" 'row_data': 'https://picsum.photos/200/300'\n", | ||
" })\n", | ||
"dataset.create_data_rows(uploads)" | ||
], | ||
"id": "nMVtBYQmzpqe" | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"# Ensure project is in batch mode:" | ||
], | ||
"metadata": { | ||
"id": "61CvCD3C7qv6" | ||
}, | ||
"id": "61CvCD3C7qv6" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": [ | ||
"project = client.create_project(name=PROJECT_NAME)\n", | ||
"project.update(queue_mode=project.QueueMode.Batch)" | ||
], | ||
"metadata": { | ||
"id": "tqtT4q31787T" | ||
}, | ||
"id": "tqtT4q31787T", | ||
"execution_count": null, | ||
"outputs": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"# Collect Datarow id's:" | ||
], | ||
"metadata": { | ||
"id": "Xti9AoZWELrq" | ||
}, | ||
"id": "Xti9AoZWELrq" | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"### Select All Data Rows from dataset." | ||
], | ||
"metadata": { | ||
"id": "9JVLsXdevywS" | ||
}, | ||
"id": "9JVLsXdevywS" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": [ | ||
"data_rows = [dr.uid for dr in list(dataset.export_data_rows())]" | ||
], | ||
"metadata": { | ||
"id": "U4C1ZyJ2EgTS" | ||
}, | ||
"id": "U4C1ZyJ2EgTS", | ||
"execution_count": null, | ||
"outputs": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"### Randomly sample\n", | ||
"\n", | ||
"Rather than selecting all of the data we sample 5 data rows at random" | ||
], | ||
"metadata": { | ||
"id": "B0UqO_O1V8ei" | ||
}, | ||
"id": "B0UqO_O1V8ei" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": [ | ||
"sample = random.sample(data_rows, 5)" | ||
], | ||
"metadata": { | ||
"id": "WJAXBf1bV-td" | ||
}, | ||
"id": "WJAXBf1bV-td", | ||
"execution_count": null, | ||
"outputs": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"# Batch Manipulation" | ||
], | ||
"metadata": { | ||
"id": "UPdaTqkgYyvt" | ||
}, | ||
"id": "UPdaTqkgYyvt" | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"### Create a Batch:" | ||
], | ||
"metadata": { | ||
"id": "Al-K1lBBEjtb" | ||
}, | ||
"id": "Al-K1lBBEjtb" | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": [ | ||
"batch = project.create_batch(\n", | ||
" \"first batch\", # Each batch in a project must have a unique name\n", | ||
" sample, # A list of data rows or data row ids\n", | ||
" 5 # priority between 1(Highest) - 5(lowest)\n", | ||
")" | ||
], | ||
"metadata": { | ||
"id": "resH3xqeErVv" | ||
}, | ||
"id": "resH3xqeErVv", | ||
"execution_count": null, | ||
"outputs": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"source": [ | ||
"# number of data rows in the batch\n", | ||
"batch.size" | ||
], | ||
"metadata": { | ||
"id": "gFio7ONOWYdJ" | ||
}, | ||
"id": "gFio7ONOWYdJ", | ||
"execution_count": null, | ||
"outputs": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "8Cj64Isxzpqe" | ||
}, | ||
"source": [ | ||
"### List DataRows in a Batch (Not supported yet)\n", | ||
"Note: You can view your batch through in the Data Row table of the project" | ||
], | ||
"id": "8Cj64Isxzpqe" | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"id": "rU7iddSQzpqg" | ||
}, | ||
"source": [ | ||
"### Remove queued data rows by batch (Not supported yet)\n", | ||
"Note: You can do this through the batch management pane on the data rows tab of the project" | ||
], | ||
"id": "rU7iddSQzpqg" | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.5" | ||
}, | ||
"colab": { | ||
"name": "Batches.ipynb", | ||
"provenance": [], | ||
"collapsed_sections": [] | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.