Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 45 additions & 28 deletions examples/project_configuration/queue_management.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@
"metadata": {},
"source": [
"# API Key and Client\n",
"Provide a valid api key below in order to properly connect to the Labelbox Client."
"See the developer guide for [creating an API key](https://docs.labelbox.com/reference/create-api-key)."
],
"cell_type": "markdown"
},
{
"metadata": {},
"source": [
"# Add your api key\n",
"# Add your API key\n",
"API_KEY = \"\"\n",
"client = lb.Client(api_key=API_KEY)"
],
Expand All @@ -98,9 +98,7 @@
{
"metadata": {},
"source": [
"## Create two Labelbox projects\n",
"# Project defaults to batch mode with benchmark quality settings if queue mode argument is not provided\n",
"# Note that queue mode will be deprecated once dataset mode is deprecated \n",
"# Create Labelbox project\n",
"\n",
"project = client.create_project(name=\"batch-test-project\",\n",
" description=\"a description\",\n",
Expand Down Expand Up @@ -139,7 +137,7 @@
"data_rows = dataset.create_data_rows(uploads)\n",
"data_rows.wait_till_done()\n",
"print(\"Errors\" , data_rows.errors)\n",
"print(\"Dataset status: \", data_rows.status)"
"print(\"Dataset status: \", data_rows.status)\n"
],
"cell_type": "code",
"outputs": [],
Expand Down Expand Up @@ -196,33 +194,48 @@
"source": [
"## Queue Order\n",
"- Add priority for each data row\n",
"- Remove all the batch priority in your project"
"- Update priority for each data row"
],
"cell_type": "markdown"
},
{
"metadata": {},
"source": [
"## See current LPOs\n",
"print(project.labeling_parameter_overrides().get_many(4))\n",
"# Select data rows from batches \n",
"data_rows = []\n",
"for batch in list(project.batches()):\n",
" for data_row in batch.export_data_rows(): \n",
" data_rows.append(data_row)\n",
"\n",
"# Get label parameter overrides (LPOs)\n",
"project_lpos = list(project.labeling_parameter_overrides())\n",
"\n",
"## Select data rows from batches \n",
"data_rows = []\n",
"for b in list(project.batches()):\n",
" for dr in b.export_data_rows(): \n",
" data_rows.append(dr)\n",
" \n",
"## Add LPOs\n",
"lpos1 = []\n",
"p=1;\n",
"for dr in data_rows: \n",
" lpos1.append((dr, p, 1))\n",
" p+=1\n",
"for lpo in project_lpos:\n",
" print(lpo)\n",
" print(\"Data row:\", lpo.data_row().uid)"
],
"cell_type": "code",
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"source": [
"# Add LPOs\n",
"lpos = []\n",
"priority=1\n",
"for data_row in data_rows: \n",
" lpos.append((data_row, priority, 1))\n",
" priority+=1\n",
"\n",
"\n",
"project.set_labeling_parameter_overrides(lpos1)\n",
"# Get the project's LPOs"
"project.set_labeling_parameter_overrides(lpos)\n",
"\n",
"# Check results\n",
"project_lpos = list(project.labeling_parameter_overrides())\n",
"\n",
"for lpo in project_lpos:\n",
" print(lpo)"
],
"cell_type": "code",
"outputs": [],
Expand All @@ -231,14 +244,18 @@
{
"metadata": {},
"source": [
"## Verify LPOs\n",
"# Update LPOs\n",
"global_keys = []\n",
"for data_row in data_rows:\n",
" global_keys.append(data_row.global_key)\n",
"\n",
"project.update_data_row_labeling_priority(data_rows=lb.GlobalKeys(global_keys), priority=1)\n",
"\n",
"# Check results\n",
"project_lpos = list(project.labeling_parameter_overrides())\n",
"## Remove LPOs\n",
"# project.unset_labeling_parameter_overrides(dataset.export_data_rows())\n",
"\n",
"for lpo in project_lpos:\n",
" print(lpo)\n",
" print(\"Data row:\", lpo.data_row().uid)"
" print(lpo)"
],
"cell_type": "code",
"outputs": [],
Expand Down