DOI: 10.5281/zenodo.15188439
title: Rescaled Fashion-MNIST with translations dataset

description: Motivation

The goal of introducing the Rescaled Fashion-MNIST with translations dataset is to provide a dataset that contains scale variations (up to a factor of 4), to evaluate the ability of networks to generalise to scales not present in the training data, and to additionally provide a way to test network object detection and object localisation abilities on image data where the objects are not centred.

The Rescaled Fashion-MNIST with translations dataset was introduced in the paper:

[1] A. Perzanowski and T. Lindeberg (2025) "Scale generalisation properties of extended scale-covariant and scale-invariant Gaussian derivative networks on image datasets with spatial scaling variations”, Journal of Mathematical Imaging and Vision, 67(29), https://doi.org/10.1007/s10851-025-01245-x.

with a pre-print available at arXiv:

[2] Perzanowski and Lindeberg (2024) "Scale generalisation properties of extended scale-covariant and scale-invariant Gaussian derivative networks on image datasets with spatial scaling variations”, arXiv preprint arXiv:2409.11140.

Importantly, the Rescaled Fashion-MNIST with translations dataset is more challenging than the MNIST Large Scale dataset, introduced in:

[3] Y. Jansson and T. Lindeberg (2022) "Scale-invariant scale-channel networks: Deep networks that generalise to previously unseen scales", Journal of Mathematical Imaging and Vision, 64(5): 506-536,  https://doi.org/10.1007/s10851-022-01082-2.

Access and rights

The Rescaled Fashion-MNIST with translations dataset is provided on the condition that you provide proper citation for the original Fashion-MNIST dataset:

[4] Xiao, H., Rasul, K., and Vollgraf, R. (2017) “Fashion-MNIST: A novel image dataset for benchmarking machine learning algorithms”, arXiv preprint arXiv:1708.07747

and also for this new rescaled version, using the reference [1] above. 

The data set is made available on request. If you would be interested in trying out this data set, please make a request in the system below, and we will grant you access as soon as possible.

The dataset

The Rescaled FashionMNIST with translations dataset is generated by rescaling 28×28 gray-scale images of clothes from the original FashionMNIST dataset [4]. The scale variations are up to a factor of 4, and the images are embedded within black images of size 72x72. The objects within the images have also been randomly shifted in the spatial domain, with the object always at least 4 pixels away from the image boundary. The imresize() function in Matlab was used for the rescaling, with default anti-aliasing turned on, and bicubic interpolation overshoot removed by clipping to the [0, 255] range. The details of how the dataset was created can be found in [1].

There are 10 different classes in the dataset: “T-shirt/top”, “trouser”, “pullover”, “dress”, “coat”, “sandal”, “shirt”, “sneaker”, “bag” and “ankle boot”.  In the dataset, these are represented by integer labels in the range [0, 9].

The dataset is split into 50 000 training samples, 10 000 validation samples and 10 000 testing samples. The training dataset is generated using the initial 50 000 samples from the original Fashion-MNIST training set. The validation dataset, on the other hand, is formed from the final 10 000 images of that same training set. For testing, all test datasets are built from the 10 000 images contained in the original Fashion-MNIST test set.

The h5 files containing the dataset

The training dataset file (~2.9 GB) for scale 1, which also contains the corresponding validation and test data for the same scale, is:

    fashionmnist_with_scale_variations_and_translations_tr50000_vl10000_te10000_outsize72-72_scte1p000_scte1p000.h5

Additionally, for the Rescaled FashionMNIST with translations dataset, there are 9 datasets (~415 MB each) for testing scale generalisation at scales not present in the training set. Each of these datasets is rescaled using a different image scaling factor, 2k/4, with k being integers in the range [-4, 4]:

    fashionmnist_with_scale_variations_and_translations_te10000_outsize72-72_scte0p500.h5      fashionmnist_with_scale_variations_and_translations_te10000_outsize72-72_scte0p595.h5      fashionmnist_with_scale_variations_and_translations_te10000_outsize72-72_scte0p707.h5      fashionmnist_with_scale_variations_and_translations_te10000_outsize72-72_scte0p841.h5      fashionmnist_with_scale_variations_and_translations_te10000_outsize72-72_scte1p000.h5      fashionmnist_with_scale_variations_and_translations_te10000_outsize72-72_scte1p189.h5      fashionmnist_with_scale_variations_and_translations_te10000_outsize72-72_scte1p414.h5      fashionmnist_with_scale_variations_and_translations_te10000_outsize72-72_scte1p682.h5      fashionmnist_with_scale_variations_and_translations_te10000_outsize72-72_scte2p000.h5

These dataset files were used for the experiments presented in Figure 8 in [1].

Instructions for loading the data set

The datasets are saved in HDF5 format, with the partitions in the respective h5 files named as('/x_train', '/x_val', '/x_test', '/y_train', '/y_test', '/y_val'); which ones exist depends on which data split is used.

The training dataset can be loaded in Python as:

with h5py.File(`<filename>`, 'r') as f:

    x_train = np.array( f["/x_train"], dtype=np.float32)      x_val = np.array( f["/x_val"], dtype=np.float32)      x_test = np.array( f["/x_test"], dtype=np.float32)      y_train = np.array( f["/y_train"], dtype=np.int32)      y_val = np.array( f["/y_val"], dtype=np.int32)      y_test = np.array( f["/y_test"], dtype=np.int32)  

We also need to permute the data, since Pytorch uses the format [num_samples, channels, width, height], while the data is saved as [num_samples, width, height, channels]:  

    x_train = np.transpose(x_train, (0, 3, 1, 2))      x_val = np.transpose(x_val, (0, 3, 1, 2))      x_test = np.transpose(x_test, (0, 3, 1, 2))  

The test datasets can be loaded in Python as:

with h5py.File(`<filename>`, 'r') as f:   

    x_test = np.array( f["/x_test"], dtype=np.float32)      y_test = np.array( f["/y_test"], dtype=np.int32)  

The test datasets can be loaded in Matlab as:      x_test = h5read(`<filename>`,'/x_test');      y_test = h5read(`<filename>`,'/y_test');  

The images are stored as [num_samples, x_dim, y_dim, channels] in HDF5 files. The pixel intensity values are not normalised, and are in a [0, 255] range.

There is also a closely related Fashion-MNIST dataset, which in addition to scaling variations keeps the objects in the frame centred, meaning no spatial translations are used.