|
73 | 73 | "metadata": {}, |
74 | 74 | "source": [ |
75 | 75 | "# API Key and Client\n", |
76 | | - "Provide a valid api key below in order to properly connect to the Labelbox Client." |
| 76 | + "See the developer guide for [creating an API key](https://docs.labelbox.com/reference/create-api-key)." |
77 | 77 | ], |
78 | 78 | "cell_type": "markdown" |
79 | 79 | }, |
80 | 80 | { |
81 | 81 | "metadata": {}, |
82 | 82 | "source": [ |
83 | | - "# Add your api key\n", |
| 83 | + "# Add your API key\n", |
84 | 84 | "API_KEY = \"\"\n", |
85 | 85 | "client = lb.Client(api_key=API_KEY)" |
86 | 86 | ], |
|
98 | 98 | { |
99 | 99 | "metadata": {}, |
100 | 100 | "source": [ |
101 | | - "## Create two Labelbox projects\n", |
102 | | - "# Project defaults to batch mode with benchmark quality settings if queue mode argument is not provided\n", |
103 | | - "# Note that queue mode will be deprecated once dataset mode is deprecated \n", |
| 101 | + "# Create Labelbox project\n", |
104 | 102 | "\n", |
105 | 103 | "project = client.create_project(name=\"batch-test-project\",\n", |
106 | 104 | " description=\"a description\",\n", |
|
139 | 137 | "data_rows = dataset.create_data_rows(uploads)\n", |
140 | 138 | "data_rows.wait_till_done()\n", |
141 | 139 | "print(\"Errors\" , data_rows.errors)\n", |
142 | | - "print(\"Dataset status: \", data_rows.status)" |
| 140 | + "print(\"Dataset status: \", data_rows.status)\n" |
143 | 141 | ], |
144 | 142 | "cell_type": "code", |
145 | 143 | "outputs": [], |
|
196 | 194 | "source": [ |
197 | 195 | "## Queue Order\n", |
198 | 196 | "- Add priority for each data row\n", |
199 | | - "- Remove all the batch priority in your project" |
| 197 | + "- Update priority for each data row" |
200 | 198 | ], |
201 | 199 | "cell_type": "markdown" |
202 | 200 | }, |
203 | 201 | { |
204 | 202 | "metadata": {}, |
205 | 203 | "source": [ |
206 | | - "## See current LPOs\n", |
207 | | - "print(project.labeling_parameter_overrides().get_many(4))\n", |
| 204 | + "# Select data rows from batches \n", |
| 205 | + "data_rows = []\n", |
| 206 | + "for batch in list(project.batches()):\n", |
| 207 | + " for data_row in batch.export_data_rows(): \n", |
| 208 | + " data_rows.append(data_row)\n", |
208 | 209 | "\n", |
| 210 | + "# Get label parameter overrides (LPOs)\n", |
| 211 | + "project_lpos = list(project.labeling_parameter_overrides())\n", |
209 | 212 | "\n", |
210 | | - "## Select data rows from batches \n", |
211 | | - "data_rows = []\n", |
212 | | - "for b in list(project.batches()):\n", |
213 | | - " for dr in b.export_data_rows(): \n", |
214 | | - " data_rows.append(dr)\n", |
215 | | - " \n", |
216 | | - "## Add LPOs\n", |
217 | | - "lpos1 = []\n", |
218 | | - "p=1;\n", |
219 | | - "for dr in data_rows: \n", |
220 | | - " lpos1.append((dr, p, 1))\n", |
221 | | - " p+=1\n", |
| 213 | + "for lpo in project_lpos:\n", |
| 214 | + " print(lpo)\n", |
| 215 | + " print(\"Data row:\", lpo.data_row().uid)" |
| 216 | + ], |
| 217 | + "cell_type": "code", |
| 218 | + "outputs": [], |
| 219 | + "execution_count": null |
| 220 | + }, |
| 221 | + { |
| 222 | + "metadata": {}, |
| 223 | + "source": [ |
| 224 | + "# Add LPOs\n", |
| 225 | + "lpos = []\n", |
| 226 | + "priority=1\n", |
| 227 | + "for data_row in data_rows: \n", |
| 228 | + " lpos.append((data_row, priority, 1))\n", |
| 229 | + " priority+=1\n", |
222 | 230 | "\n", |
223 | 231 | "\n", |
224 | | - "project.set_labeling_parameter_overrides(lpos1)\n", |
225 | | - "# Get the project's LPOs" |
| 232 | + "project.set_labeling_parameter_overrides(lpos)\n", |
| 233 | + "\n", |
| 234 | + "# Check results\n", |
| 235 | + "project_lpos = list(project.labeling_parameter_overrides())\n", |
| 236 | + "\n", |
| 237 | + "for lpo in project_lpos:\n", |
| 238 | + " print(lpo)" |
226 | 239 | ], |
227 | 240 | "cell_type": "code", |
228 | 241 | "outputs": [], |
|
231 | 244 | { |
232 | 245 | "metadata": {}, |
233 | 246 | "source": [ |
234 | | - "## Verify LPOs\n", |
| 247 | + "# Update LPOs\n", |
| 248 | + "global_keys = []\n", |
| 249 | + "for data_row in data_rows:\n", |
| 250 | + " global_keys.append(data_row.global_key)\n", |
| 251 | + "\n", |
| 252 | + "project.update_data_row_labeling_priority(data_rows=lb.GlobalKeys(global_keys), priority=1)\n", |
| 253 | + "\n", |
| 254 | + "# Check results\n", |
235 | 255 | "project_lpos = list(project.labeling_parameter_overrides())\n", |
236 | | - "## Remove LPOs\n", |
237 | | - "# project.unset_labeling_parameter_overrides(dataset.export_data_rows())\n", |
238 | 256 | "\n", |
239 | 257 | "for lpo in project_lpos:\n", |
240 | | - " print(lpo)\n", |
241 | | - " print(\"Data row:\", lpo.data_row().uid)" |
| 258 | + " print(lpo)" |
242 | 259 | ], |
243 | 260 | "cell_type": "code", |
244 | 261 | "outputs": [], |
|
0 commit comments