eleldar commited on
Commit
2a39739
1 Parent(s): dcb8627

upload dataset generation notebook

Browse files
Files changed (1) hide show
  1. dataset_generation.ipynb +620 -0
dataset_generation.ipynb ADDED
@@ -0,0 +1,620 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "b4f4da53",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import os\n",
11
+ "import pandas as pd\n",
12
+ "from tqdm import tqdm\n",
13
+ "from PIL import Image as Im\n",
14
+ "from huggingface_hub import notebook_login\n",
15
+ "from datasets import load_dataset, Dataset, Image"
16
+ ]
17
+ },
18
+ {
19
+ "cell_type": "markdown",
20
+ "id": "aa9019fe",
21
+ "metadata": {},
22
+ "source": [
23
+ "### Load a set with coordinates"
24
+ ]
25
+ },
26
+ {
27
+ "cell_type": "code",
28
+ "execution_count": 2,
29
+ "id": "11f31770",
30
+ "metadata": {},
31
+ "outputs": [
32
+ {
33
+ "data": {
34
+ "text/html": [
35
+ "<div>\n",
36
+ "<style scoped>\n",
37
+ " .dataframe tbody tr th:only-of-type {\n",
38
+ " vertical-align: middle;\n",
39
+ " }\n",
40
+ "\n",
41
+ " .dataframe tbody tr th {\n",
42
+ " vertical-align: top;\n",
43
+ " }\n",
44
+ "\n",
45
+ " .dataframe thead th {\n",
46
+ " text-align: right;\n",
47
+ " }\n",
48
+ "</style>\n",
49
+ "<table border=\"1\" class=\"dataframe\">\n",
50
+ " <thead>\n",
51
+ " <tr style=\"text-align: right;\">\n",
52
+ " <th></th>\n",
53
+ " <th>filename</th>\n",
54
+ " <th>x_from</th>\n",
55
+ " <th>y_from</th>\n",
56
+ " <th>width</th>\n",
57
+ " <th>height</th>\n",
58
+ " <th>sign_class</th>\n",
59
+ " <th>sign_id</th>\n",
60
+ " </tr>\n",
61
+ " </thead>\n",
62
+ " <tbody>\n",
63
+ " <tr>\n",
64
+ " <th>0</th>\n",
65
+ " <td>autosave01_02_2012_09_13_33.jpg</td>\n",
66
+ " <td>649</td>\n",
67
+ " <td>376</td>\n",
68
+ " <td>18</td>\n",
69
+ " <td>18</td>\n",
70
+ " <td>2_1</td>\n",
71
+ " <td>0</td>\n",
72
+ " </tr>\n",
73
+ " <tr>\n",
74
+ " <th>1</th>\n",
75
+ " <td>autosave01_02_2012_09_13_34.jpg</td>\n",
76
+ " <td>671</td>\n",
77
+ " <td>356</td>\n",
78
+ " <td>20</td>\n",
79
+ " <td>21</td>\n",
80
+ " <td>2_1</td>\n",
81
+ " <td>0</td>\n",
82
+ " </tr>\n",
83
+ " <tr>\n",
84
+ " <th>2</th>\n",
85
+ " <td>autosave01_02_2012_09_13_35.jpg</td>\n",
86
+ " <td>711</td>\n",
87
+ " <td>332</td>\n",
88
+ " <td>27</td>\n",
89
+ " <td>26</td>\n",
90
+ " <td>2_1</td>\n",
91
+ " <td>0</td>\n",
92
+ " </tr>\n",
93
+ " <tr>\n",
94
+ " <th>3</th>\n",
95
+ " <td>autosave01_02_2012_09_13_36.jpg</td>\n",
96
+ " <td>764</td>\n",
97
+ " <td>290</td>\n",
98
+ " <td>37</td>\n",
99
+ " <td>36</td>\n",
100
+ " <td>2_1</td>\n",
101
+ " <td>0</td>\n",
102
+ " </tr>\n",
103
+ " <tr>\n",
104
+ " <th>4</th>\n",
105
+ " <td>autosave01_02_2012_09_13_36.jpg</td>\n",
106
+ " <td>684</td>\n",
107
+ " <td>384</td>\n",
108
+ " <td>17</td>\n",
109
+ " <td>17</td>\n",
110
+ " <td>1_23</td>\n",
111
+ " <td>1</td>\n",
112
+ " </tr>\n",
113
+ " </tbody>\n",
114
+ "</table>\n",
115
+ "</div>"
116
+ ],
117
+ "text/plain": [
118
+ " filename x_from y_from width height sign_class \\\n",
119
+ "0 autosave01_02_2012_09_13_33.jpg 649 376 18 18 2_1 \n",
120
+ "1 autosave01_02_2012_09_13_34.jpg 671 356 20 21 2_1 \n",
121
+ "2 autosave01_02_2012_09_13_35.jpg 711 332 27 26 2_1 \n",
122
+ "3 autosave01_02_2012_09_13_36.jpg 764 290 37 36 2_1 \n",
123
+ "4 autosave01_02_2012_09_13_36.jpg 684 384 17 17 1_23 \n",
124
+ "\n",
125
+ " sign_id \n",
126
+ "0 0 \n",
127
+ "1 0 \n",
128
+ "2 0 \n",
129
+ "3 0 \n",
130
+ "4 1 "
131
+ ]
132
+ },
133
+ "execution_count": 2,
134
+ "metadata": {},
135
+ "output_type": "execute_result"
136
+ }
137
+ ],
138
+ "source": [
139
+ "data = pd.read_csv('full-gt.csv') # from URL: https://graphics.cs.msu.ru/projects/traffic-sign-recognition.html\n",
140
+ "data.head()"
141
+ ]
142
+ },
143
+ {
144
+ "cell_type": "code",
145
+ "execution_count": 3,
146
+ "id": "1da9267c",
147
+ "metadata": {
148
+ "scrolled": true
149
+ },
150
+ "outputs": [
151
+ {
152
+ "data": {
153
+ "text/plain": [
154
+ "['autosave01_02_2012_09_13_32.jpg',\n",
155
+ " 'autosave01_02_2012_09_13_33.jpg',\n",
156
+ " 'autosave01_02_2012_09_13_34.jpg',\n",
157
+ " 'autosave01_02_2012_09_13_35.jpg',\n",
158
+ " 'autosave01_02_2012_09_13_36.jpg']"
159
+ ]
160
+ },
161
+ "execution_count": 3,
162
+ "metadata": {},
163
+ "output_type": "execute_result"
164
+ }
165
+ ],
166
+ "source": [
167
+ "os.listdir('rtsd-frames')[:5] # from URL: https://www.kaggle.com/datasets/watchman/rtsd-dataset"
168
+ ]
169
+ },
170
+ {
171
+ "cell_type": "markdown",
172
+ "id": "dd0a8dfc",
173
+ "metadata": {},
174
+ "source": [
175
+ "### Saving crop files"
176
+ ]
177
+ },
178
+ {
179
+ "cell_type": "code",
180
+ "execution_count": 4,
181
+ "id": "e2cf6b7e",
182
+ "metadata": {},
183
+ "outputs": [],
184
+ "source": [
185
+ "source_dir = 'rtsd-frames'\n",
186
+ "target_dir = 'dataset'\n",
187
+ "\n",
188
+ "if not os.path.exists(target_dir):\n",
189
+ " os.makedirs(target_dir)\n",
190
+ "\n",
191
+ "def get_sign(\n",
192
+ " filename, x_from, y_from, width, height, sign_class, sign_id, \n",
193
+ " img_path=source_dir, res_path=target_dir\n",
194
+ " ): \n",
195
+ " img = Im.open(f'{img_path}/{filename}')\n",
196
+ " img = img.crop((x_from, y_from, x_from + width, y_from + height))\n",
197
+ " filename = f'{sign_class}___{sign_id}__{filename}'\n",
198
+ " img.save(f'{target_dir}/{filename}')\n",
199
+ " return {'filename': filename, 'sign_class': sign_class, 'sign_id': sign_id}"
200
+ ]
201
+ },
202
+ {
203
+ "cell_type": "code",
204
+ "execution_count": 5,
205
+ "id": "7d81a1cf",
206
+ "metadata": {},
207
+ "outputs": [
208
+ {
209
+ "name": "stderr",
210
+ "output_type": "stream",
211
+ "text": [
212
+ "100%|██████████████████████████████████████████████████████████████████████████| 104358/104358 [18:08<00:00, 95.90it/s]\n"
213
+ ]
214
+ }
215
+ ],
216
+ "source": [
217
+ "result, bad_data = [], []\n",
218
+ "for i in tqdm(range(len(data))):\n",
219
+ " try:\n",
220
+ " result.append(get_sign(**data.iloc[i].to_dict()))\n",
221
+ " except Exception as e:\n",
222
+ " bad_data.append((e, data.iloc[i].to_dict()))\n",
223
+ " print('.', end='')"
224
+ ]
225
+ },
226
+ {
227
+ "cell_type": "code",
228
+ "execution_count": 6,
229
+ "id": "c288b477",
230
+ "metadata": {},
231
+ "outputs": [
232
+ {
233
+ "data": {
234
+ "text/plain": [
235
+ "104358"
236
+ ]
237
+ },
238
+ "execution_count": 6,
239
+ "metadata": {},
240
+ "output_type": "execute_result"
241
+ }
242
+ ],
243
+ "source": [
244
+ "len(os.listdir(target_dir))"
245
+ ]
246
+ },
247
+ {
248
+ "cell_type": "code",
249
+ "execution_count": 7,
250
+ "id": "51aae0a9",
251
+ "metadata": {},
252
+ "outputs": [
253
+ {
254
+ "data": {
255
+ "text/plain": [
256
+ "104358"
257
+ ]
258
+ },
259
+ "execution_count": 7,
260
+ "metadata": {},
261
+ "output_type": "execute_result"
262
+ }
263
+ ],
264
+ "source": [
265
+ "len(result)"
266
+ ]
267
+ },
268
+ {
269
+ "cell_type": "code",
270
+ "execution_count": 8,
271
+ "id": "454cc4f4",
272
+ "metadata": {},
273
+ "outputs": [
274
+ {
275
+ "data": {
276
+ "text/plain": [
277
+ "0"
278
+ ]
279
+ },
280
+ "execution_count": 8,
281
+ "metadata": {},
282
+ "output_type": "execute_result"
283
+ }
284
+ ],
285
+ "source": [
286
+ "len(bad_data)"
287
+ ]
288
+ },
289
+ {
290
+ "cell_type": "markdown",
291
+ "id": "4fadacb7",
292
+ "metadata": {},
293
+ "source": [
294
+ "### Metadata generation"
295
+ ]
296
+ },
297
+ {
298
+ "cell_type": "code",
299
+ "execution_count": 9,
300
+ "id": "f9ee692c",
301
+ "metadata": {},
302
+ "outputs": [],
303
+ "source": [
304
+ "pd.DataFrame(result).to_csv(f'{target_dir}.csv', index=False)"
305
+ ]
306
+ },
307
+ {
308
+ "cell_type": "code",
309
+ "execution_count": 10,
310
+ "id": "07d9969e",
311
+ "metadata": {
312
+ "scrolled": true
313
+ },
314
+ "outputs": [
315
+ {
316
+ "data": {
317
+ "text/html": [
318
+ "<div>\n",
319
+ "<style scoped>\n",
320
+ " .dataframe tbody tr th:only-of-type {\n",
321
+ " vertical-align: middle;\n",
322
+ " }\n",
323
+ "\n",
324
+ " .dataframe tbody tr th {\n",
325
+ " vertical-align: top;\n",
326
+ " }\n",
327
+ "\n",
328
+ " .dataframe thead th {\n",
329
+ " text-align: right;\n",
330
+ " }\n",
331
+ "</style>\n",
332
+ "<table border=\"1\" class=\"dataframe\">\n",
333
+ " <thead>\n",
334
+ " <tr style=\"text-align: right;\">\n",
335
+ " <th></th>\n",
336
+ " <th>file_name</th>\n",
337
+ " <th>additional_feature</th>\n",
338
+ " </tr>\n",
339
+ " </thead>\n",
340
+ " <tbody>\n",
341
+ " <tr>\n",
342
+ " <th>0</th>\n",
343
+ " <td>2_1___0__autosave01_02_2012_09_13_33.jpg</td>\n",
344
+ " <td>2_1</td>\n",
345
+ " </tr>\n",
346
+ " <tr>\n",
347
+ " <th>1</th>\n",
348
+ " <td>2_1___0__autosave01_02_2012_09_13_34.jpg</td>\n",
349
+ " <td>2_1</td>\n",
350
+ " </tr>\n",
351
+ " <tr>\n",
352
+ " <th>2</th>\n",
353
+ " <td>2_1___0__autosave01_02_2012_09_13_35.jpg</td>\n",
354
+ " <td>2_1</td>\n",
355
+ " </tr>\n",
356
+ " <tr>\n",
357
+ " <th>3</th>\n",
358
+ " <td>2_1___0__autosave01_02_2012_09_13_36.jpg</td>\n",
359
+ " <td>2_1</td>\n",
360
+ " </tr>\n",
361
+ " <tr>\n",
362
+ " <th>4</th>\n",
363
+ " <td>1_23___1__autosave01_02_2012_09_13_36.jpg</td>\n",
364
+ " <td>1_23</td>\n",
365
+ " </tr>\n",
366
+ " </tbody>\n",
367
+ "</table>\n",
368
+ "</div>"
369
+ ],
370
+ "text/plain": [
371
+ " file_name additional_feature\n",
372
+ "0 2_1___0__autosave01_02_2012_09_13_33.jpg 2_1\n",
373
+ "1 2_1___0__autosave01_02_2012_09_13_34.jpg 2_1\n",
374
+ "2 2_1___0__autosave01_02_2012_09_13_35.jpg 2_1\n",
375
+ "3 2_1___0__autosave01_02_2012_09_13_36.jpg 2_1\n",
376
+ "4 1_23___1__autosave01_02_2012_09_13_36.jpg 1_23"
377
+ ]
378
+ },
379
+ "execution_count": 10,
380
+ "metadata": {},
381
+ "output_type": "execute_result"
382
+ }
383
+ ],
384
+ "source": [
385
+ "df = pd.DataFrame(result)\n",
386
+ "df.drop(columns=['sign_id'], inplace=True)\n",
387
+ "df.columns = ['file_name', 'additional_feature']\n",
388
+ "df.head()"
389
+ ]
390
+ },
391
+ {
392
+ "cell_type": "code",
393
+ "execution_count": 11,
394
+ "id": "57a8c62a",
395
+ "metadata": {},
396
+ "outputs": [
397
+ {
398
+ "data": {
399
+ "text/html": [
400
+ "<div>\n",
401
+ "<style scoped>\n",
402
+ " .dataframe tbody tr th:only-of-type {\n",
403
+ " vertical-align: middle;\n",
404
+ " }\n",
405
+ "\n",
406
+ " .dataframe tbody tr th {\n",
407
+ " vertical-align: top;\n",
408
+ " }\n",
409
+ "\n",
410
+ " .dataframe thead th {\n",
411
+ " text-align: right;\n",
412
+ " }\n",
413
+ "</style>\n",
414
+ "<table border=\"1\" class=\"dataframe\">\n",
415
+ " <thead>\n",
416
+ " <tr style=\"text-align: right;\">\n",
417
+ " <th></th>\n",
418
+ " <th>file_name</th>\n",
419
+ " <th>additional_feature</th>\n",
420
+ " </tr>\n",
421
+ " </thead>\n",
422
+ " <tbody>\n",
423
+ " <tr>\n",
424
+ " <th>0</th>\n",
425
+ " <td>2_1___0__autosave01_02_2012_09_13_33.jpg</td>\n",
426
+ " <td>2_1</td>\n",
427
+ " </tr>\n",
428
+ " <tr>\n",
429
+ " <th>1</th>\n",
430
+ " <td>2_1___0__autosave01_02_2012_09_13_34.jpg</td>\n",
431
+ " <td>2_1</td>\n",
432
+ " </tr>\n",
433
+ " <tr>\n",
434
+ " <th>2</th>\n",
435
+ " <td>2_1___0__autosave01_02_2012_09_13_35.jpg</td>\n",
436
+ " <td>2_1</td>\n",
437
+ " </tr>\n",
438
+ " <tr>\n",
439
+ " <th>3</th>\n",
440
+ " <td>2_1___0__autosave01_02_2012_09_13_36.jpg</td>\n",
441
+ " <td>2_1</td>\n",
442
+ " </tr>\n",
443
+ " <tr>\n",
444
+ " <th>4</th>\n",
445
+ " <td>1_23___1__autosave01_02_2012_09_13_36.jpg</td>\n",
446
+ " <td>1_23</td>\n",
447
+ " </tr>\n",
448
+ " </tbody>\n",
449
+ "</table>\n",
450
+ "</div>"
451
+ ],
452
+ "text/plain": [
453
+ " file_name additional_feature\n",
454
+ "0 2_1___0__autosave01_02_2012_09_13_33.jpg 2_1\n",
455
+ "1 2_1___0__autosave01_02_2012_09_13_34.jpg 2_1\n",
456
+ "2 2_1___0__autosave01_02_2012_09_13_35.jpg 2_1\n",
457
+ "3 2_1___0__autosave01_02_2012_09_13_36.jpg 2_1\n",
458
+ "4 1_23___1__autosave01_02_2012_09_13_36.jpg 1_23"
459
+ ]
460
+ },
461
+ "execution_count": 11,
462
+ "metadata": {},
463
+ "output_type": "execute_result"
464
+ }
465
+ ],
466
+ "source": [
467
+ "df.to_json(f'{target_dir}/metadata.jsonl', orient='records', lines=True); df.head()"
468
+ ]
469
+ },
470
+ {
471
+ "cell_type": "code",
472
+ "execution_count": 12,
473
+ "id": "7245bea0",
474
+ "metadata": {},
475
+ "outputs": [],
476
+ "source": [
477
+ "metadata = pd.read_csv(f'{target_dir}.csv') # или metadata = df.copy()\n",
478
+ "metadata.columns = ['image', 'sign_class', 'sign_id']\n",
479
+ "metadata['image'] = metadata['image'].apply(lambda x: f'{target_dir}/{x}')\n",
480
+ "metadata = metadata.to_dict(orient='list')"
481
+ ]
482
+ },
483
+ {
484
+ "cell_type": "markdown",
485
+ "id": "591c55b5",
486
+ "metadata": {},
487
+ "source": [
488
+ "### Creating a formatted dataset"
489
+ ]
490
+ },
491
+ {
492
+ "cell_type": "code",
493
+ "execution_count": 13,
494
+ "id": "6d5fb041",
495
+ "metadata": {},
496
+ "outputs": [],
497
+ "source": [
498
+ "dataset = Dataset.from_dict(metadata).cast_column(\"image\", Image())"
499
+ ]
500
+ },
501
+ {
502
+ "cell_type": "code",
503
+ "execution_count": 14,
504
+ "id": "acd56ad2",
505
+ "metadata": {},
506
+ "outputs": [
507
+ {
508
+ "data": {
509
+ "text/plain": [
510
+ "Dataset({\n",
511
+ " features: ['image', 'sign_class', 'sign_id'],\n",
512
+ " num_rows: 104358\n",
513
+ "})"
514
+ ]
515
+ },
516
+ "execution_count": 14,
517
+ "metadata": {},
518
+ "output_type": "execute_result"
519
+ }
520
+ ],
521
+ "source": [
522
+ "dataset"
523
+ ]
524
+ },
525
+ {
526
+ "cell_type": "code",
527
+ "execution_count": 15,
528
+ "id": "98bb6893",
529
+ "metadata": {},
530
+ "outputs": [
531
+ {
532
+ "data": {
533
+ "text/plain": [
534
+ "{'image': <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=27x26 at 0x1EFD1DD5C70>,\n",
535
+ " 'sign_class': '2_1',\n",
536
+ " 'sign_id': 0}"
537
+ ]
538
+ },
539
+ "execution_count": 15,
540
+ "metadata": {},
541
+ "output_type": "execute_result"
542
+ }
543
+ ],
544
+ "source": [
545
+ "dataset[2]"
546
+ ]
547
+ },
548
+ {
549
+ "cell_type": "code",
550
+ "execution_count": 16,
551
+ "id": "3ab455b9",
552
+ "metadata": {},
553
+ "outputs": [
554
+ {
555
+ "data": {
556
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAABsAAAAaCAIAAADJ6rCnAAAFtklEQVR4nC3VSZYbxxEA0BgyawZQGJpky6TJpuyl176RL20/P4mmyJ67ANSUQ0R4ozP8xcf9P/+lqgBgJiGuYVlAMzAS0W63+/Dhw+FwMLN5nmPIjLiMPqUUwpJyQLOqLpqmKks/DINzjr1zzB5AzATRFa5QLykhgjG5pqw2TdtWNRGVzi/LEmMOaKYxpyA5EUNKNk9pnjHGKCLO1DnyaATAiJgBzQkZAlhTlfvdod/u2rpBgNJ5TzzjPOMElk2TaTSEnCgGyTkzs6hTVQdiDpnZA4ClDIqeXeFdv9ue+v2u7URSWFdE9Gi157pAMkfGIVDOWVLKkkWEwAsAqLkcU1F4RjLNkjKKVlWx225Oh77vagc6Xc/D8OqI66b0zIeNl45D68dxvIzXeY6CgoQ5RzZTJZfigiBkycxIU+Gp75rTvjvsNp40TsN4fpyGV3bI2tZ13W92RE5Vx5a9V0Jb5iBm05IFEoN3Jmtc1hyAiDxh21THfXPad11DIVyn61te3hxMZGA5Spy58QVXrirrcuMdlo5fL9O8pJATk0cmhxhijCBalK5um65zu23RdVRyni+vYXpGHZvKGIUtWBplLQWa0m/LumHXIWI2MJtzrgwdELp5enbOIYPj6nTqfr277ZomLufX8znMA+hQuFQWWHoUjTlnk+18HXOcdsf3u+5YlXXVtOcxjFP4+fA8r4sTXcl8V9fvb/pPf3l3PGzQUlpDTmfTCXFhCGhmomCRNM3Xmtgj6HItDNkVu67rXNn5Os4x41g4RC0KPt3s777+9dOn26rk69uUwpzTDLYUnBEzYTTLBAmdxPFaVY1mOg+2Ztgdq2rTVVQ3O1qiIr+5umvfnW6+fL37fPdl29Tn4XkYXsfxApqZ0DtGIDQlEMQMoFBCWVKUPC3DKlh1x6Zn9gWqd0WJ7Ojm5t3Hz5+/3v395ua9ZBveLufzFGNGZCIiIkfoCBAygTCq8wiYRYNoIkbniZmB3GUax2mel9VtNqd9f7Pp9ghujSKCjktXCCRjE7IEhmZoZgYGqqAxBjH1XbPb3xy3fU+O5xiG83ValyTmzChEex2uyxJFcLc9leTC/BZnQxW0BECIzOAAxECdh7Rm5uLw7vjh40fXbF8uy8Pz8vR8Ga9zVnPLHIa3i+di09Sbpu53h+D5bAHSDBotRzBmYMLCVNWgqKqs0flqv98fj8dFisv17cf988vbPIwzs3fTOsX7eB3fbk7HDzcn4Kao3f72ttm34/nlPFBYibElTKIp5cDrLyHlT3d/O7z/xzj7P57Oj/fz48N5XqIvakR0yxJizJYNFEEsp77ftm1dtM2WwJBsHn1YR82LARBhXTWnrr/98Auzfx7Gnz9/3j+9hBDWNZAakXPrIo40B12mdbyu07ik2/ew3/W7tm2LomgKXw+vT5OgkWcHbdd/+nJ3OL67TPHh4eH3b98fXs7AtZmgmqE4EFIjFYgS1+UsUVGLHEyM2roo/LaqsWgsZFaL3vtm2zebfg7y7ceP//28f3l5Gcd101d1XbuiZGYnGdARMxuyiIxzfn65pGzLmvd91+874sqVfdUVAOoLLrvdtKb7x/t//+e3h+fzvAZVFZGmrL13zjmXc0ZEAiQiAgLDeU3ZruM4ny/TcQ6bbetc6eqCmZjR2P1x//Lf3799v38cpxCzGtC6rn8uoOIIQSUnU8eevQPCkGLMach5GKdhmg6H7f7Qd13jiUXw7bL+9v3H/dNLiHmNWUSJC0lhnjHn6At2vrCcU86gIKUrVdHMouSU0rhM4zJGieAZvSuhNJP1erl/fBnnCK5UiGrgGXPWHFdGI2CnFpCBCAFSjBJhNUIEFkm+LMTy0/PzmtZpmdq2RbSn+59Pb5cQgievqmYWY1RV732Ma8rgxAIAmAEAIbAioTKiAGZREwU1w8mKM6cUzCwmS1lzUqUkSUxEiUDkTw3F/wPe2gVRfByOAwAAAABJRU5ErkJggg==\n",
557
+ "text/plain": [
558
+ "<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=27x26 at 0x1EFD2DDBE80>"
559
+ ]
560
+ },
561
+ "execution_count": 16,
562
+ "metadata": {},
563
+ "output_type": "execute_result"
564
+ }
565
+ ],
566
+ "source": [
567
+ "dataset[2]['image']"
568
+ ]
569
+ },
570
+ {
571
+ "cell_type": "markdown",
572
+ "id": "49420851",
573
+ "metadata": {},
574
+ "source": [
575
+ "### Uploading to remote storage"
576
+ ]
577
+ },
578
+ {
579
+ "cell_type": "code",
580
+ "execution_count": 17,
581
+ "id": "1e3a67b4",
582
+ "metadata": {},
583
+ "outputs": [],
584
+ "source": [
585
+ "notebook_login()"
586
+ ]
587
+ },
588
+ {
589
+ "cell_type": "code",
590
+ "execution_count": 18,
591
+ "id": "e59e80c5",
592
+ "metadata": {},
593
+ "outputs": [],
594
+ "source": [
595
+ "dataset.push_to_hub(\"eleldar/rtsd_cleaned\")"
596
+ ]
597
+ }
598
+ ],
599
+ "metadata": {
600
+ "kernelspec": {
601
+ "display_name": "Python 3 (ipykernel)",
602
+ "language": "python",
603
+ "name": "python3"
604
+ },
605
+ "language_info": {
606
+ "codemirror_mode": {
607
+ "name": "ipython",
608
+ "version": 3
609
+ },
610
+ "file_extension": ".py",
611
+ "mimetype": "text/x-python",
612
+ "name": "python",
613
+ "nbconvert_exporter": "python",
614
+ "pygments_lexer": "ipython3",
615
+ "version": "3.9.7"
616
+ }
617
+ },
618
+ "nbformat": 4,
619
+ "nbformat_minor": 5
620
+ }