You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"How to export data for projects, datasets, slices, and models, with examples for each type of v2 export along with details on optional parameters and filters."
35
+
],
36
+
"cell_type": "markdown"
37
+
},
38
+
{
39
+
"metadata": {},
40
+
"source": [
41
+
"!pip install -q \"labelbox[data]\""
42
+
],
43
+
"cell_type": "code",
44
+
"outputs": [],
45
+
"execution_count": null
46
+
},
47
+
{
48
+
"metadata": {},
49
+
"source": [
50
+
"import labelbox as lb"
51
+
],
52
+
"cell_type": "code",
53
+
"outputs": [],
54
+
"execution_count": null
55
+
},
56
+
{
57
+
"metadata": {},
58
+
"source": [
59
+
"# API Key and Client\n",
60
+
"See the developer guide for [creating an API key](https://docs.labelbox.com/reference/create-api-key)."
61
+
],
62
+
"cell_type": "markdown"
63
+
},
64
+
{
65
+
"metadata": {},
66
+
"source": [
67
+
"API_KEY = \"\"\n",
68
+
"client = lb.Client(api_key=API_KEY)"
69
+
],
70
+
"cell_type": "code",
71
+
"outputs": [],
72
+
"execution_count": null
73
+
},
74
+
{
75
+
"metadata": {},
76
+
"source": [
77
+
"## Export data rows from a project\n",
78
+
"For complete details on the supported filters and parameters, including how they are used and what information is included, please see the [Export overview](https://docs.labelbox.com/reference/label-export#optional-parameters-and-filters) developer guide.\n",
79
+
"\n",
80
+
"### Parameters\n",
81
+
"When you export data rows from a project, you may choose to include or exclude certain attributes, including:\n",
82
+
"- `attachments`\n",
83
+
"- `metadata_fields`\n",
84
+
"- `data_row_details`\n",
85
+
"- `project_details`\n",
86
+
"- `label_details`\n",
87
+
"- `performance_details`\n",
88
+
"- `interpolated_frames`\n",
89
+
" - Only applicable for video data rows.\n",
90
+
"\n",
91
+
"### Filters\n",
92
+
"When you export data rows from a project, you can specify the included data rows with the following filters:\n",
93
+
"- `last_activity_at`\n",
94
+
"- `label_created_at`\n",
95
+
"- `data_row_ids`\n",
96
+
"\n",
97
+
"#### Filter details\n",
98
+
"You can set the range for `last_activity_at` and `label_created_at` in the following formats: \n",
99
+
"- `YYYY-MM-DD`\n",
100
+
"- `YYYY-MM-DD hh:mm:ss`\n",
101
+
"- `YYYY-MM-DDThh:mm:ss\u00b1hhmm` (ISO 8601)\n",
102
+
"\n",
103
+
"The ISO 8061 format allows you to specify the timezone, while the other two formats assume timezone from the user's workspace settings.\n",
104
+
"\n",
105
+
"The `last_activity_at` filter captures the creation and modification of labels, metadata, workflow status, comments, and reviews.\n",
106
+
"\n",
107
+
"If you wish to specify data rows to export, uncomment the `data_row_ids` filter and provide a list of applicable IDs. The data rows must be part of a batch attached to the project in question. You can provide up to 2,000 data row IDs."
108
+
],
109
+
"cell_type": "markdown"
110
+
},
111
+
{
112
+
"metadata": {},
113
+
"source": [
114
+
"# Insert the project ID of the project from which you wish to export data rows.\n",
115
+
"PROJECT_ID = \"\"\n",
116
+
"project = client.get_project(PROJECT_ID)"
117
+
],
118
+
"cell_type": "code",
119
+
"outputs": [],
120
+
"execution_count": null
121
+
},
122
+
{
123
+
"metadata": {},
124
+
"source": [
125
+
"# Set the export params to include/exclude certain fields. \n",
126
+
"export_params= {\n",
127
+
"\"attachments\": True,\n",
128
+
"\"metadata_fields\": True,\n",
129
+
"\"data_row_details\": True,\n",
130
+
"\"project_details\": True,\n",
131
+
"\"label_details\": True,\n",
132
+
"\"performance_details\": True,\n",
133
+
"\"interpolated_frames\": True\n",
134
+
"}\n",
135
+
"\n",
136
+
"# Note: Filters follow AND logic, so typically using one filter is sufficient.\n",
"For complete details on the supported filters and parameters, including how they are used and what information is included, please see the [Export overview](https://docs.labelbox.com/reference/label-export#optional-parameters-and-filters) developer guide.\n",
161
+
"\n",
162
+
"### Parameters\n",
163
+
"When you export data rows from a dataset, you may choose to include or exclude certain attributes, including:\n",
164
+
"- `attachments`\n",
165
+
"- `metadata_fields`\n",
166
+
"- `data_row_details`\n",
167
+
"- `project_details`\n",
168
+
"- `label_details`\n",
169
+
"- `performance_details`\n",
170
+
"- `interpolated_frames`\n",
171
+
" - Only applicable for video data rows.\n",
172
+
"- `project_ids`\n",
173
+
" - Accepts a list of project IDs. If provided, the labels created _in these projects_ on the exported data rows will be included. \n",
174
+
"- `model_run_ids`\n",
175
+
" - Accepts a list of model run IDs. If provided, the labels and predicitions created _in these model runs_ will be included. \n",
176
+
"\n",
177
+
"### Filters\n",
178
+
"When you export data rows from a project, you can specify the included data rows with the following filters:\n",
179
+
"- `last_activity_at`\n",
180
+
"- `label_created_at`\n",
181
+
"- `data_row_ids`\n",
182
+
"\n",
183
+
"See the _Export data rows from a project_ section above for additional details on each filter. "
184
+
],
185
+
"cell_type": "markdown"
186
+
},
187
+
{
188
+
"metadata": {},
189
+
"source": [
190
+
"# Insert the dataset ID of the dataset from which you wish to export data rows.\n",
191
+
"DATASET_ID = \"\"\n",
192
+
"dataset = client.get_dataset(DATASET_ID)"
193
+
],
194
+
"cell_type": "code",
195
+
"outputs": [],
196
+
"execution_count": null
197
+
},
198
+
{
199
+
"metadata": {},
200
+
"source": [
201
+
"# Set the export params to include/exclude certain fields.\n",
"For complete details on the supported filters and parameters, including how they are used and what information is included, please see the [Export overview](https://docs.labelbox.com/reference/label-export#optional-parameters-and-filters) developer guide.\n",
237
+
"\n",
238
+
"### Parameters\n",
239
+
"When exporting from a slice, you can apply the same parameters as exporting from a dataset.\n",
240
+
"\n",
241
+
"### Filters\n",
242
+
"No filters are applicable to exports from a slice. All the data rows of the slice must be exported."
243
+
],
244
+
"cell_type": "markdown"
245
+
},
246
+
{
247
+
"metadata": {},
248
+
"source": [
249
+
"# Insert the Catalog slice ID of the slice from which you wish to export data rows.\n",
"For complete details on the supported filters and parameters, including how they are used and what information is included, please see the [Export overview](https://docs.labelbox.com/reference/label-export#optional-parameters-and-filters) developer guide.\n",
291
+
"\n",
292
+
"### Parameters\n",
293
+
"- `attachments`\n",
294
+
"- `metadata_fields`\n",
295
+
"- `data_row_details`\n",
296
+
"- `interpolated_frames`\n",
297
+
" - Only applicable for video data rows.\n",
298
+
"- `predictions`\n",
299
+
" - If true, all predictions made in the model run will be included for each data row in the export.\n",
300
+
"\n",
301
+
"### Filters\n",
302
+
"No filters are applicable to exports from a model run. All the data rows of the model run must be exported.\n"
303
+
],
304
+
"cell_type": "markdown"
305
+
},
306
+
{
307
+
"metadata": {},
308
+
"source": [
309
+
"# Insert the model run ID of the model run from which you wish to export data rows.\n",
310
+
"MODEL_RUN_ID = \"\"\n",
311
+
"model_run = client.get_model_run(MODEL_RUN_ID)"
312
+
],
313
+
"cell_type": "code",
314
+
"outputs": [],
315
+
"execution_count": null
316
+
},
317
+
{
318
+
"metadata": {},
319
+
"source": [
320
+
"# Set the export params to include/exclude certain fields.\n",
0 commit comments