metadata
dataset_info:
features:
- name: image
dtype: image
- name: label
dtype: int64
splits:
- name: train
num_bytes: 723660480
num_examples: 2048
download_size: 723705789
dataset_size: 723660480
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
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')