Home

Awesome

Fashion-MNIST

GitHub stars Gitter Readme-CN Readme-JA License: MIT Year-In-Review

<details><summary>Table of Contents</summary><p> </p></details><p></p>

Fashion-MNIST is a dataset of Zalando's article images—consisting of a training set of 60,000 examples and a test set of 10,000 examples. Each example is a 28x28 grayscale image, associated with a label from 10 classes. We intend Fashion-MNIST to serve as a direct drop-in replacement for the original MNIST dataset for benchmarking machine learning algorithms. It shares the same image size and structure of training and testing splits.

Here's an example of how the data looks (each class takes three-rows):

<img src="doc/img/embedding.gif" width="100%">

Why we made Fashion-MNIST

The original MNIST dataset contains a lot of handwritten digits. Members of the AI/ML/Data Science community love this dataset and use it as a benchmark to validate their algorithms. In fact, MNIST is often the first dataset researchers try. "If it doesn't work on MNIST, it won't work at all", they said. "Well, if it does work on MNIST, it may still fail on others."

To Serious Machine Learning Researchers

Seriously, we are talking about replacing MNIST. Here are some good reasons:

Get the Data

Many ML libraries already include Fashion-MNIST data/API, give it a try!

You can use direct links to download the dataset. The data is stored in the same format as the original MNIST data.

NameContentExamplesSizeLinkMD5 Checksum
train-images-idx3-ubyte.gztraining set images60,00026 MBytesDownload8d4fb7e6c68d591d4c3dfef9ec88bf0d
train-labels-idx1-ubyte.gztraining set labels60,00029 KBytesDownload25c81989df183df01b3e8a0aad5dffbe
t10k-images-idx3-ubyte.gztest set images10,0004.3 MBytesDownloadbef4ecab320f06d8554ea6380940ec79
t10k-labels-idx1-ubyte.gztest set labels10,0005.1 KBytesDownloadbb300cfdad3c16e7a12a480ee83cd310

Alternatively, you can clone this GitHub repository; the dataset appears under data/fashion. This repo also contains some scripts for benchmark and visualization.

git clone git@github.com:zalandoresearch/fashion-mnist.git

Labels

Each training and test example is assigned to one of the following labels:

LabelDescription
0T-shirt/top
1Trouser
2Pullover
3Dress
4Coat
5Sandal
6Shirt
7Sneaker
8Bag
9Ankle boot

Usage

Loading data with Python (requires NumPy)

Use utils/mnist_reader in this repo:

import mnist_reader
X_train, y_train = mnist_reader.load_mnist('data/fashion', kind='train')
X_test, y_test = mnist_reader.load_mnist('data/fashion', kind='t10k')

Loading data with Tensorflow

Make sure you have downloaded the data and placed it in data/fashion. Otherwise, Tensorflow will download and use the original MNIST.

from tensorflow.examples.tutorials.mnist import input_data
data = input_data.read_data_sets('data/fashion')

data.train.next_batch(BATCH_SIZE)

Note, Tensorflow supports passing in a source url to the read_data_sets. You may use:

data = input_data.read_data_sets('data/fashion', source_url='http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/')

Also, an official Tensorflow tutorial of using tf.keras, a high-level API to train Fashion-MNIST can be found here.

Loading data with other machine learning libraries

To date, the following libraries have included Fashion-MNIST as a built-in dataset. Therefore, you don't need to download Fashion-MNIST by yourself. Just follow their API and you are ready to go.

You are welcome to make pull requests to other open-source machine learning packages, improving their support to Fashion-MNIST dataset.

Loading data with other languages

As one of the Machine Learning community's most popular datasets, MNIST has inspired people to implement loaders in many different languages. You can use these loaders with the Fashion-MNIST dataset as well. (Note: may require decompressing first.) To date, we haven't yet tested all of these loaders with Fashion-MNIST.

Benchmark

We built an automatic benchmarking system based on scikit-learn that covers 129 classifiers (but no deep learning) with different parameters. Find the results here.

<img src="doc/img/benchmark.gif" width="100%">

You can reproduce the results by running benchmark/runner.py. We recommend building and deploying this Dockerfile.

You are welcome to submit your benchmark; simply create a new issue and we'll list your results here. Before doing that, please make sure it does not already appear in this list. Visit our contributor guidelines for additional details.

The table below collects the submitted benchmarks. Note that we haven't yet tested these results. You are welcome to validate the results using the code provided by the submitter. Test accuracy may differ due to the number of epoch, batch size, etc. To correct this table, please create a new issue.

ClassifierPreprocessingFashion test accuracyMNIST test accuracySubmitterCode
2 Conv+poolingNone0.876-Kashif Rasul:link:
2 Conv+poolingNone0.916-Tensorflow's doc:link:
2 Conv+pooling+ELU activation (PyTorch)None0.903-@AbhirajHinge:link:
2 ConvNormalization, random horizontal flip, random vertical flip, random translation, random rotation.0.9190.971Kyriakos Efthymiadis:link:
2 Conv <100K parametersNone0.9250.992@hardmaru:link:
2 Conv ~113K parametersNormalization0.9220.993Abel G.:link:
2 Conv+3 FC ~1.8M parametersNormalization0.9320.994@Xfan1025:link:
2 Conv+3 FC ~500K parametersAugmentation, batch normalization0.9340.994@cmasch:link:
2 Conv+pooling+BNNone0.934-@khanguyen1207:link:
2 Conv+2 FCRandom Horizontal Flips0.939-@ashmeet13:link:
3 Conv+2 FCNone0.907-@Cenk Bircanoğlu:link:
3 Conv+pooling+BNNone0.9030.994@meghanabhange:link:
3 Conv+pooling+2 FC+dropoutNone0.926-@Umberto Griffo:link:
3 Conv+BN+poolingNone0.9210.992@gchhablani:link:
5 Conv+BN+poolingNone0.931-@Noumanmufc1:link:
CNN with optional shortcuts, dense-like connectivitystandardization+augmentation+random erasing0.947-@kennivich:link:
GRU+SVMNone0.8880.965@AFAgarap:link:
GRU+SVM with dropoutNone0.8970.988@AFAgarap:link:
WRN40-4 8.9M paramsstandard preprocessing (mean/std subtraction/division) and augmentation (random crops/horizontal flips)0.967-@ajbrock:link: :link:
DenseNet-BC 768K paramsstandard preprocessing (mean/std subtraction/division) and augmentation (random crops/horizontal flips)0.954-@ajbrock:link: :link:
MobileNetaugmentation (horizontal flips)0.950-@苏剑林:link:
ResNet18Normalization, random horizontal flip, random vertical flip, random translation, random rotation.0.9490.979Kyriakos Efthymiadis:link:
GoogleNet with cross-entropy lossNone0.937-@Cenk Bircanoğlu:link:
AlexNet with Triplet lossNone0.899-@Cenk Bircanoğlu:link:
SqueezeNet with cyclical learning rate 200 epochsNone0.900-@snakers4:link:
Dual path network with wide resnet 28-10standard preprocessing (mean/std subtraction/division) and augmentation (random crops/horizontal flips)0.957-@Queequeg:link:
MLP 256-128-100None0.8833-@heitorrapela:link:
VGG16 26M parametersNone0.935-@QuantumLiu:link: :link:
WRN-28-10standard preprocessing (mean/std subtraction/division) and augmentation (random crops/horizontal flips)0.959-@zhunzhong07:link:
WRN-28-10 + Random Erasingstandard preprocessing (mean/std subtraction/division) and augmentation (random crops/horizontal flips)0.963-@zhunzhong07:link:
Human PerformanceCrowd-sourced evaluation of human (with no fashion expertise) performance. 1000 randomly sampled test images, 3 labels per image, majority labelling.0.835-Leo-
Capsule Network 8M parametersNormalization and shift at most 2 pixel and horizontal flip0.936-@XifengGuo:link:
HOG+SVMHOG0.926-@subalde:link:
XgBoostscaling the pixel values to mean=0.0 and var=1.00.8980.958@anktplwl91:link:
DENSER-0.9530.997@fillassuncao:link: :link:
Dyra-NetRescale to unit interval0.906-@Dirk Schäfer:link: :link:
Google AutoML24 compute hours (higher quality)0.939-@Sebastian Heinz:link:
FastaiResnet50+Fine-tuning+Softmax on last layer's activations0.9312-@Sayak:link:

Other Explorations of Fashion-MNIST

Fashion-MNIST: Year in Review

Fashion-MNIST on Google Scholar

Generative adversarial networks (GANs)

Clustering

Video Tutorial

Machine Learning Meets Fashion by Yufeng G @ Google Cloud

Machine Learning Meets Fashion

Introduction to Kaggle Kernels by Yufeng G @ Google Cloud

Introduction to Kaggle Kernels

动手学深度学习 by Mu Li @ Amazon AI

MXNet/Gluon中文频道

Apache MXNet으로 배워보는 딥러닝(Deep Learning) - 김무현 (AWS 솔루션즈아키텍트)

Apache MXNet으로 배워보는 딥러닝(Deep Learning)

Visualization

t-SNE on Fashion-MNIST (left) and original MNIST (right)

<img src="doc/img/34d72c08.png" width="50%"><img src="doc/img/01e0c4be.png" width="50%">

PCA on Fashion-MNIST (left) and original MNIST (right)

<img src="doc/img/f04ba662.png" width="50%"><img src="doc/img/4433f0e1.png" width="50%">

UMAP on Fashion-MNIST (left) and original MNIST (right)

<img src="doc/img/umap_example_fashion_mnist1.png" width="50%"><img src="doc/img/umap_example_mnist1.png" width="50%">

PyMDE on Fashion-MNIST (left) and original MNIST (right)

<img src="doc/img/pymde_example_fashion_mnist.png" width="50%"><img src="doc/img/pymde_example_mnist.png" width="50%">

Contributing

Thanks for your interest in contributing! There are many ways to get involved; start with our contributor guidelines and then check these open issues for specific tasks.

Contact

To discuss the dataset, please use Gitter.

Citing Fashion-MNIST

If you use Fashion-MNIST in a scientific publication, we would appreciate references to the following paper:

Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning Algorithms. Han Xiao, Kashif Rasul, Roland Vollgraf. arXiv:1708.07747

Biblatex entry:

@online{xiao2017/online,
  author       = {Han Xiao and Kashif Rasul and Roland Vollgraf},
  title        = {Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning Algorithms},
  date         = {2017-08-28},
  year         = {2017},
  eprintclass  = {cs.LG},
  eprinttype   = {arXiv},
  eprint       = {cs.LG/1708.07747},
}

Who is citing Fashion-MNIST?

License

The MIT License (MIT) Copyright © [2017] Zalando SE, https://tech.zalando.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.