2
2
"cells" : [
3
3
{
4
4
"cell_type" : " markdown" ,
5
- "id" : " db768cda" ,
6
- "metadata" : {},
7
5
"source" : [
8
6
" <td>\n " ,
9
7
" <a target=\" _blank\" href=\" https://labelbox.com\" ><img src=\" https://labelbox.com/blog/content/images/2021/02/logo-v4.svg\" width=256/></a>\n " ,
10
8
" </td>"
11
- ]
9
+ ],
10
+ "metadata" : {}
12
11
},
13
12
{
14
13
"cell_type" : " markdown" ,
15
- "id" : " cb5611d0" ,
16
- "metadata" : {},
17
14
"source" : [
18
15
" <td>\n " ,
19
16
" <a href=\" https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/basics/datasets.ipynb\" target=\" _blank\" ><img\n " ,
24
21
" <a href=\" https://github.com/Labelbox/labelbox-python/tree/develop/examples/basics/datasets.ipynb\" target=\" _blank\" ><img\n " ,
25
22
" src=\" https://img.shields.io/badge/GitHub-100000?logo=github&logoColor=white\" alt=\" GitHub\" ></a>\n " ,
26
23
" </td>"
27
- ]
24
+ ],
25
+ "metadata" : {}
28
26
},
29
27
{
30
28
"cell_type" : " markdown" ,
31
- "id" : " settled-lodging" ,
32
- "metadata" : {},
33
29
"source" : [
34
30
" # Datasets"
35
- ]
31
+ ],
32
+ "metadata" : {}
36
33
},
37
34
{
38
35
"cell_type" : " markdown" ,
39
- "id" : " demanding-charge" ,
40
- "metadata" : {},
41
36
"source" : [
42
37
" * Datasets are collections of data rows (image, video, or text to be labeled)\n " ,
43
38
" * Datasets are used to define units of work.\n " ,
44
39
" * Attaching a dataset to a project will add all data rows in the dataset to the project (and add them to the queue)\n " ,
45
40
" * Datasets are not required to be fixed in size (you can add data rows at any time). \n " ,
46
41
" * However, if you add data rows to a dataset, all projects associated with this dataset will add the new data rows to its queue"
47
- ]
42
+ ],
43
+ "metadata" : {}
48
44
},
49
45
{
50
46
"cell_type" : " code" ,
51
47
"execution_count" : 1 ,
52
- "id" : " attached-ticket" ,
53
- "metadata" : {},
54
- "outputs" : [],
55
48
"source" : [
56
49
" !pip install labelbox"
57
- ]
50
+ ],
51
+ "outputs" : [],
52
+ "metadata" : {}
58
53
},
59
54
{
60
55
"cell_type" : " code" ,
61
56
"execution_count" : 2 ,
62
- "id" : " educational-locking" ,
63
- "metadata" : {},
64
- "outputs" : [],
65
57
"source" : [
66
58
" from labelbox import Client\n " ,
67
59
" import uuid\n " ,
68
60
" import os"
69
- ]
61
+ ],
62
+ "outputs" : [],
63
+ "metadata" : {}
70
64
},
71
65
{
72
66
"cell_type" : " markdown" ,
73
- "id" : " geological-clear" ,
74
- "metadata" : {},
75
67
"source" : [
76
68
" * Set the following cell with your data to run this notebook"
77
- ]
69
+ ],
70
+ "metadata" : {}
78
71
},
79
72
{
80
73
"cell_type" : " code" ,
81
74
"execution_count" : 4 ,
82
- "id" : " looking-airport" ,
83
- "metadata" : {},
84
- "outputs" : [],
85
75
"source" : [
86
76
" # Pick a dataset that has attached data_rows\n " ,
87
77
" DATASET_ID = \" ckm4xyfua04cf0z7a3wz58kgj\" "
88
- ]
78
+ ],
79
+ "outputs" : [],
80
+ "metadata" : {}
89
81
},
90
82
{
91
83
"cell_type" : " markdown" ,
92
- "id" : " 1a0b4115" ,
93
- "metadata" : {},
94
84
"source" : [
95
85
" # API Key and Client\n " ,
96
86
" Provide a valid api key below in order to properly connect to the Labelbox Client."
97
- ]
87
+ ],
88
+ "metadata" : {}
98
89
},
99
90
{
100
91
"cell_type" : " code" ,
101
92
"execution_count" : 5 ,
102
- "id" : " retained-illustration" ,
103
- "metadata" : {},
104
- "outputs" : [],
105
93
"source" : [
106
94
" # Add your api key\n " ,
107
95
" API_KEY = None\n " ,
108
96
" client = Client(api_key=API_KEY)"
109
- ]
97
+ ],
98
+ "outputs" : [],
99
+ "metadata" : {}
110
100
},
111
101
{
112
102
"cell_type" : " markdown" ,
113
- "id" : " explicit-thunder" ,
114
- "metadata" : {},
115
103
"source" : [
116
104
" ### Read"
117
- ]
105
+ ],
106
+ "metadata" : {}
118
107
},
119
108
{
120
109
"cell_type" : " code" ,
121
110
"execution_count" : 6 ,
122
- "id" : " inclusive-herald" ,
123
- "metadata" : {},
124
- "outputs" : [],
125
111
"source" : [
126
112
" # Can be fetched by name (using a query - see basics), or using an id directly\n " ,
127
113
" dataset = client.get_dataset(DATASET_ID)"
128
- ]
114
+ ],
115
+ "outputs" : [],
116
+ "metadata" : {}
129
117
},
130
118
{
131
119
"cell_type" : " code" ,
132
- "execution_count" : 7 ,
133
- "id" : " increased-joshua" ,
134
- "metadata" : {},
135
- "outputs" : [
136
- {
137
- "name" : " stdout" ,
138
- "output_type" : " stream" ,
139
- "text" : [
140
- " <Dataset {'created_at': datetime.datetime(2021, 3, 11, 14, 3, 12, tzinfo=datetime.timezone.utc), 'description': '', 'name': 'animal_demo_ds', 'uid': 'ckm4xyfua04cf0z7a3wz58kgj', 'updated_at': datetime.datetime(2021, 3, 11, 14, 3, 12, tzinfo=datetime.timezone.utc)}>\n "
141
- ]
142
- }
143
- ],
120
+ "execution_count" : null ,
144
121
"source" : [
145
122
" print(dataset)"
146
- ]
123
+ ],
124
+ "outputs" : [],
125
+ "metadata" : {}
147
126
},
148
127
{
149
128
"cell_type" : " code" ,
150
- "execution_count" : 8 ,
151
- "id" : " thermal-making" ,
152
- "metadata" : {},
153
- "outputs" : [
154
- {
155
- "data" : {
156
- "text/plain" : [
157
- " <DataRow ID: ckm4y6s531rnq0rb6bobqa6j7>"
158
- ]
159
- },
160
- "execution_count" : 27 ,
161
- "metadata" : {},
162
- "output_type" : " execute_result"
163
- }
164
- ],
129
+ "execution_count" : null ,
165
130
"source" : [
166
131
" # We can see the data rows associated with a dataset\n " ,
167
132
" data_rows = dataset.data_rows()\n " ,
168
- " next(data_rows) # Print first one"
169
- ]
133
+ " next(data_rows) # Print first data row"
134
+ ],
135
+ "outputs" : [],
136
+ "metadata" : {}
170
137
},
171
138
{
172
139
"cell_type" : " code" ,
173
- "execution_count" : 9 ,
174
- "id" : " cellular-rhythm" ,
175
- "metadata" : {},
176
- "outputs" : [
177
- {
178
- "name" : " stdout" ,
179
- "output_type" : " stream" ,
180
- "text" : [
181
- " Projects with this dataset attached : [<Project ID: ckm4xyfncfgja0760vpfdxoro>]\n " ,
182
- " Dataset name : animal_demo_ds\n "
183
- ]
184
- }
185
- ],
140
+ "execution_count" : null ,
186
141
"source" : [
187
142
" # Attached projects\n " ,
188
143
" print(\" Projects with this dataset attached :\" , list(dataset.projects()))\n " ,
189
144
" print(\" Dataset name :\" , dataset.name)"
190
- ]
191
- },
192
- {
193
- "cell_type" : " code" ,
194
- "execution_count" : 10 ,
195
- "id" : " liquid-stocks" ,
196
- "metadata" : {},
145
+ ],
197
146
"outputs" : [],
198
- "source" : [
199
- " # A dataset is the way to list all data rows\n " ,
200
- " data_row = next(dataset.data_rows())"
201
- ]
147
+ "metadata" : {}
202
148
},
203
149
{
204
150
"cell_type" : " markdown" ,
205
- "id" : " sonic-classic" ,
206
- "metadata" : {},
207
151
"source" : [
208
152
" ### Create"
209
- ]
153
+ ],
154
+ "metadata" : {}
210
155
},
211
156
{
212
157
"cell_type" : " code" ,
213
- "execution_count" : 11 ,
214
- "id" : " valuable-bench" ,
215
- "metadata" : {},
216
- "outputs" : [
217
- {
218
- "name" : " stdout" ,
219
- "output_type" : " stream" ,
220
- "text" : [
221
- " <Dataset {'created_at': datetime.datetime(2021, 3, 17, 11, 11, 7, tzinfo=datetime.timezone.utc), 'description': '', 'name': 'my_new_dataset', 'uid': 'ckmdcg8lf04px0y9ge67bbxa5', 'updated_at': datetime.datetime(2021, 3, 17, 11, 11, 7, tzinfo=datetime.timezone.utc)}>\n "
222
- ]
223
- }
224
- ],
158
+ "execution_count" : null ,
225
159
"source" : [
226
160
" new_dataset = client.create_dataset(name=\" my_new_dataset\" )\n " ,
227
161
" print(new_dataset)"
228
- ]
162
+ ],
163
+ "outputs" : [],
164
+ "metadata" : {}
229
165
},
230
166
{
231
167
"cell_type" : " markdown" ,
232
- "id" : " humanitarian-response" ,
233
- "metadata" : {},
234
168
"source" : [
235
169
" * Add data rows\n " ,
236
- " * See the [data rows](https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/basics/data_rows.ipynb#scrollTo=successful-patch) notebook for more about adding data rows"
237
- ]
170
+ " * See the [data rows](https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/basics/data_rows.ipynb#scrollTo=successful-patch) notebook `Create` section for more about adding data rows."
171
+ ],
172
+ "metadata" : {}
238
173
},
239
174
{
240
175
"cell_type" : " code" ,
241
176
"execution_count" : 12 ,
242
- "id" : " egyptian-qatar" ,
243
- "metadata" : {},
244
- "outputs" : [],
245
177
"source" : [
246
- " dataset.create_data_row(row_data=\" https://picsum.photos/200/300\" )"
247
- ]
178
+ " new_dataset.create_data_row(row_data=\" https://picsum.photos/200/300\" )"
179
+ ],
180
+ "outputs" : [],
181
+ "metadata" : {}
248
182
},
249
183
{
250
184
"cell_type" : " markdown" ,
251
- "id" : " varying-louisville" ,
252
- "metadata" : {},
253
185
"source" : [
254
186
" ### Update"
255
- ]
187
+ ],
188
+ "metadata" : {}
256
189
},
257
190
{
258
191
"cell_type" : " code" ,
259
192
"execution_count" : 13 ,
260
- "id" : " clinical-parks" ,
261
- "metadata" : {},
262
- "outputs" : [],
263
193
"source" : [
264
194
" new_dataset.update(name=\" new_name\" )"
265
- ]
266
- },
267
- {
268
- "cell_type" : " markdown" ,
269
- "id" : " outdoor-projector" ,
270
- "metadata" : {},
271
- "source" : [
272
- " * See the data rows notebook `Create` section on how to add data_rows to a dataset."
273
- ]
195
+ ],
196
+ "outputs" : [],
197
+ "metadata" : {}
274
198
},
275
199
{
276
200
"cell_type" : " markdown" ,
277
- "id" : " caroline-therapist" ,
278
- "metadata" : {},
279
201
"source" : [
280
202
" ### Delete"
281
- ]
203
+ ],
204
+ "metadata" : {}
282
205
},
283
206
{
284
207
"cell_type" : " code" ,
285
208
"execution_count" : 14 ,
286
- "id" : " increased-grenada" ,
287
- "metadata" : {},
288
- "outputs" : [],
289
209
"source" : [
290
210
" new_dataset.delete()"
291
- ]
211
+ ],
212
+ "outputs" : [],
213
+ "metadata" : {}
292
214
}
293
215
],
294
216
"metadata" : {
312
234
},
313
235
"nbformat" : 4 ,
314
236
"nbformat_minor" : 5
315
- }
237
+ }
0 commit comments