Fashion-MNIST

Task: Image Classification Classes: 10 Image Size: 28x28

Overview

The Fashion-MNIST dataset is a widely-used image classification benchmark for single-label classification consisting of 70,000 28×28 grayscale images across 10 balanced classes (T-shirt/top, Trouser, Pullover, Dress, Coat, Sandal, Shirt, Sneaker, Bag, and Ankle boot), with 7,000 images per class.

  • Train: 60,000 images (6,000 per class)

  • Test: 10,000 images (1,000 per class)

../../_images/fashion_mnist_teaser.png

Data Structure

When accessing an example using ds[i], you will receive a dictionary with the following keys:

Key

Type

Description

image

PIL.Image.Image

28×28 grayscale image

label

int

Class label (0-9)

Usage Example

Basic Usage

from stable_datasets.images.fashion_mnist import FashionMNIST

# First run will download + prepare cache, then return the split as a HF Dataset
ds = FashionMNIST(split="train")

# If you omit the split (split=None), you get a DatasetDict with all available splits
ds_all = FashionMNIST(split=None)

sample = ds[0]
print(sample.keys())  # {"image", "label"}

# Optional: make it PyTorch-friendly
ds_torch = ds.with_format("torch")

References

Citation

@article{xiao2017fashion,
title={Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning Algorithms},
author={Xiao, Han and Rasul, Kashif and Vollgraf, Roland},
journal={arXiv preprint arXiv:1708.07747},
year={2017}
}