Skip to content

Commit 9310c9b

Browse files
authored
[X-0] Add predictions to model run example (#1098)
1 parent 6ac4298 commit 9310c9b

File tree

1 file changed

+65
-51
lines changed

1 file changed

+65
-51
lines changed

examples/label_export/images.ipynb

Lines changed: 65 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
2-
"nbformat": 4,
3-
"nbformat_minor": 0,
4-
"metadata": {},
52
"cells": [
63
{
4+
"attachments": {},
5+
"cell_type": "markdown",
76
"metadata": {},
87
"source": [
98
"<td>\n",
109
" <a target=\"_blank\" href=\"https://labelbox.com\" ><img src=\"https://labelbox.com/blog/content/images/2021/02/logo-v4.svg\" width=256/></a>\n",
1110
"</td>"
12-
],
13-
"cell_type": "markdown"
11+
]
1412
},
1513
{
14+
"attachments": {},
15+
"cell_type": "markdown",
1616
"metadata": {},
1717
"source": [
1818
"<td>\n",
@@ -24,73 +24,79 @@
2424
"<a href=\"https://github.com/Labelbox/labelbox-python/tree/master/examples/label_export/images.ipynb\" target=\"_blank\"><img\n",
2525
"src=\"https://img.shields.io/badge/GitHub-100000?logo=github&logoColor=white\" alt=\"GitHub\"></a>\n",
2626
"</td>"
27-
],
28-
"cell_type": "markdown"
27+
]
2928
},
3029
{
30+
"attachments": {},
31+
"cell_type": "markdown",
3132
"metadata": {},
3233
"source": [
3334
"How to export data, with examples for each type of export along with details on optional parameters and filters."
34-
],
35-
"cell_type": "markdown"
35+
]
3636
},
3737
{
38+
"attachments": {},
39+
"cell_type": "markdown",
3840
"metadata": {},
3941
"source": [
4042
"# Image Data Export"
41-
],
42-
"cell_type": "markdown"
43+
]
4344
},
4445
{
46+
"cell_type": "code",
47+
"execution_count": null,
4548
"metadata": {},
49+
"outputs": [],
4650
"source": [
4751
"!pip install \"labelbox[data]\" -q"
48-
],
49-
"cell_type": "code",
50-
"outputs": [],
51-
"execution_count": null
52+
]
5253
},
5354
{
55+
"cell_type": "code",
56+
"execution_count": null,
5457
"metadata": {},
58+
"outputs": [],
5559
"source": [
5660
"import labelbox as lb"
57-
],
58-
"cell_type": "code",
59-
"outputs": [],
60-
"execution_count": null
61+
]
6162
},
6263
{
64+
"attachments": {},
65+
"cell_type": "markdown",
6366
"metadata": {},
6467
"source": [
6568
"# API Key and Client\n",
6669
"Provide a valid api key below in order to properly connect to the Labelbox Client."
67-
],
68-
"cell_type": "markdown"
70+
]
6971
},
7072
{
73+
"cell_type": "code",
74+
"execution_count": null,
7175
"metadata": {},
76+
"outputs": [],
7277
"source": [
7378
"# Add your api key\n",
7479
"API_KEY = \"API KEY here\"\n",
7580
"client = lb.Client(api_key=API_KEY)"
76-
],
77-
"cell_type": "code",
78-
"outputs": [],
79-
"execution_count": null
81+
]
8082
},
8183
{
84+
"attachments": {},
85+
"cell_type": "markdown",
8286
"metadata": {},
8387
"source": [
8488
"# Export data rows from a project\n",
8589
"\n",
8690
"When you export data rows from a project, you can narrow down your data rows by last_activity_at, label_created_at, and data_row_ids. Then, when you export from a project, you may choose to include or exclude certain attributes in your export.\n",
8791
"\n",
8892
"You can view the JSON export formats for each data type here: https://docs.labelbox.com/reference/label-export#export-specifications"
89-
],
90-
"cell_type": "markdown"
93+
]
9194
},
9295
{
96+
"cell_type": "code",
97+
"execution_count": null,
9398
"metadata": {},
99+
"outputs": [],
94100
"source": [
95101
"# Set the export params to include/exclude certain fields. Make sure each of these fields are correctly grabbed \n",
96102
"export_params= {\n",
@@ -121,12 +127,11 @@
121127
"\n",
122128
"export_json = export_task.result\n",
123129
"print(\"results: \", export_json)"
124-
],
125-
"cell_type": "code",
126-
"outputs": [],
127-
"execution_count": null
130+
]
128131
},
129132
{
133+
"attachments": {},
134+
"cell_type": "markdown",
130135
"metadata": {},
131136
"source": [
132137
"# Export from a dataset\n",
@@ -136,11 +141,13 @@
136141
"When exporting from Catalog, you can include information about a data row from all projects and model runs to which it belongs. Specifically, for the selected data rows, you can export the labels from multiple projects and/or the predictions from multiple model runs.\n",
137142
"\n",
138143
"As shown below, the project_ids and model_run_ids parameters accept a list of IDs"
139-
],
140-
"cell_type": "markdown"
144+
]
141145
},
142146
{
147+
"cell_type": "code",
148+
"execution_count": null,
143149
"metadata": {},
150+
"outputs": [],
144151
"source": [
145152
"# Set the export params to include/exclude certain fields. Make sure each of these fields are correctly grabbed \n",
146153
"export_params= {\n",
@@ -169,20 +176,21 @@
169176
" print(export_task.errors)\n",
170177
"export_json = export_task.result\n",
171178
"print(\"results: \", export_json)"
172-
],
173-
"cell_type": "code",
174-
"outputs": [],
175-
"execution_count": null
179+
]
176180
},
177181
{
182+
"attachments": {},
183+
"cell_type": "markdown",
178184
"metadata": {},
179185
"source": [
180186
"# Export from a slice"
181-
],
182-
"cell_type": "markdown"
187+
]
183188
},
184189
{
190+
"cell_type": "code",
191+
"execution_count": null,
185192
"metadata": {},
193+
"outputs": [],
186194
"source": [
187195
"# Set the export params to include/exclude certain fields. Make sure each of these fields are correctly grabbed \n",
188196
"export_params= {\n",
@@ -204,26 +212,28 @@
204212
" print(export_task.errors)\n",
205213
"export_json = export_task.result\n",
206214
"print(\"results: \", export_json)"
207-
],
208-
"cell_type": "code",
209-
"outputs": [],
210-
"execution_count": null
215+
]
211216
},
212217
{
218+
"attachments": {},
219+
"cell_type": "markdown",
213220
"metadata": {},
214221
"source": [
215222
"# Export data rows from a model run"
216-
],
217-
"cell_type": "markdown"
223+
]
218224
},
219225
{
226+
"cell_type": "code",
227+
"execution_count": null,
220228
"metadata": {},
229+
"outputs": [],
221230
"source": [
222231
"# Set the export params to include/exclude certain fields. Make sure each of these fields are correctly grabbed \n",
223232
"export_params= {\n",
224233
" \"attachments\": True,\n",
225234
" \"metadata_fields\": True,\n",
226235
" \"data_row_details\": True,\n",
236+
" \"predictions\": True,\n",
227237
"}\n",
228238
"\n",
229239
"model_run = client.get_model_run(\"Enter Model run ID\")\n",
@@ -232,10 +242,14 @@
232242
"print(export_task.errors)\n",
233243
"export_json = export_task.result\n",
234244
"print(\"results: \", export_json)"
235-
],
236-
"cell_type": "code",
237-
"outputs": [],
238-
"execution_count": null
245+
]
246+
}
247+
],
248+
"metadata": {
249+
"language_info": {
250+
"name": "python"
239251
}
240-
]
241-
}
252+
},
253+
"nbformat": 4,
254+
"nbformat_minor": 0
255+
}

0 commit comments

Comments
 (0)