image
imagewidth (px)
50
3.23k
label
int64
1
998
563
598
218
800
914
397
771
42
201
922
100
531
738
432
521
659
543
777
378
855
698
951
433
504
370
975
162
534
302
855
296
7
491
592
36
738
259
715
12
306
687
527
93
625
142
146
503
160
81
579
979
847
553
932
553
108
42
365
379
619
154
320
503
432
342
636
316
466
501
179
8
794
737
670
602
575
746
7
142
369
10
480
528
432
763
528
298
848
20
182
357
844
59
73
370
448
897
586
415
461

Dataset Card for "imagenet-1k-train-sampled2048"

import numpy as np
from datasets import Dataset
import timm.data


def get_dataset():
    dataset = timm.data.create_dataset(
        root='[LOCAL IMAGENET FOLDER]',
        name='',
        split='train',
        is_training=False,
    )
    sampled_indices = np.random.default_rng(42).choice(len(dataset), size=2048, replace=False)
    images = [dataset[i][0] for i in sampled_indices]
    labels = [dataset[i][1] for i in sampled_indices]
    return images, labels


images, labels = get_dataset()
dataset = Dataset.from_dict({"image": images, "label": labels})
dataset.push_to_hub('yujiepan/imagenet-1k-train-sampled2048')
Downloads last month
498
Edit dataset card