FashionMNIST

A small MNIST-like fashion product image dataset

Originator: Han Xiao and Kashif Rasul and Roland Vollgraf

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. Zalando intends 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.

Examples

Basic Examples

Obtain the FashionMNIST dataset, which contains 60,000 training and 10,000 test images:

In[1]:=
trainingData = ResourceData["FashionMNIST", "TrainingData"];
testData = ResourceData["FashionMNIST", "TestData"];
Length /@ {trainingData, testData}
Out[3]=

Display a few random examples from the training set:

In[4]:=
RandomChoice[trainingData, 5]
Out[4]=

Lookup the full string labels of the samples:

In[5]:=
Labeled @@@ RandomChoice[trainingData, 10] /. ResourceData["FashionMNIST", "ClassLabels"] // Multicolumn
Out[5]=

The 10 classes are balanced in both sets:

In[6]:=
trainingDataset = ResourceData["FashionMNIST", "TrainingDataset"];
KeySort@CountsBy[trainingDataset, #[[2]] &]
Out[7]=

Visualization

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

In[8]:=
ImageAssemble@ArrayReshape[Map[Function[{class},
    Normal@
     trainingDataset[Select[#"Label" == class &], "Image"][;; 90]], Range[0, 9]], {30, 30}]
Out[113]=

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

In[114]:=
FeatureSpacePlot3D@
 RandomSample[ResourceData["FashionMNIST", "TestData"], 1000][[All, 1]]
Out[114]=

The classes of FashionMNIST are harder separate than the original MNIST. This can be seen in the uniform manifold approximation and projection (UMAP) plots of FashionMNIST (left) and the original digits MNIST (right)

In[115]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/e0e0fe23-4540-45b8-891d-324053e13b6f"]

Analysis

LeNet (pretrained on MNIST) performs badly on FashionMNIST

In[116]:=
ClassifierMeasurements[NetModel["LeNet Trained on MNIST Data"], ResourceData["FashionMNIST", "TestData"], "ConfusionMatrixPlot"]
Out[116]=

Training LeNet from scratch quickly improves the results

In[117]:=
lenetModel = NetTrain[NetModel["LeNet"], ResourceData["FashionMNIST", "TrainingData"], ValidationSet -> ResourceData["FashionMNIST", "TestData"]];
ClassifierMeasurements[lenetModel, ResourceData["FashionMNIST", "TestData"], "ConfusionMatrixPlot"]
Out[118]=

Michael Sollami, "FashionMNIST" from the Wolfram Data Repository (2018)  

License Information

The MIT License (MIT) Copyright © [2017] Zalando SE

Data Resource History

Source Metadata

Publisher Information