File size: 1,009 Bytes
0cc67aa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a4e7623
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
dataset_info:
  features:
  - name: image
    dtype: image
  - name: label
    dtype: int64
  splits:
  - name: train
    num_bytes: 723660480.0
    num_examples: 2048
  download_size: 723705789
  dataset_size: 723660480.0
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
---
# Dataset Card for "imagenet-1k-train-sampled2048"

```python
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')
```