Machine Learning Datasets Machine Learning Datasets
  • GitHub
  • Slack
  • Documentation
Get Started
Machine Learning Datasets Machine Learning Datasets
Get Started
Machine Learning Datasets
  • GitHub
  • Slack
  • Documentation

Docy

Machine Learning Datasets

  • Folder icon closed Folder open iconDatasets
    • MNIST
    • ImageNet Dataset
    • COCO Dataset
    • CIFAR 10 Dataset
    • CIFAR 100 Dataset
    • FFHQ Dataset
    • Places205 Dataset
    • GTZAN Genre Dataset
    • GTZAN Music Speech Dataset
    • The Street View House Numbers (SVHN) Dataset
    • Caltech 101 Dataset
    • LibriSpeech Dataset
    • dSprites Dataset
    • PUCPR Dataset
    • RAVDESS Dataset
    • GTSRB Dataset
    • CSSD Dataset
    • ATIS Dataset
    • Free Spoken Digit Dataset (FSDD)
    • not-MNIST Dataset
    • ECSSD Dataset
    • COCO-Text Dataset
    • CoQA Dataset
    • FGNET Dataset
    • ESC-50 Dataset
    • GlaS Dataset
    • UTZappos50k Dataset
    • Pascal VOC 2012 Dataset
    • Pascal VOC 2007 Dataset
    • Omniglot Dataset
    • HMDB51 Dataset
    • Chest X-Ray Image Dataset
    • NIH Chest X-ray Dataset
    • Fashionpedia Dataset
    • DRIVE Dataset
    • Kaggle Cats & Dogs Dataset
    • Lincolnbeet Dataset
    • Sentiment-140 Dataset
    • MURA Dataset
    • LIAR Dataset
    • Stanford Cars Dataset
    • SWAG Dataset
    • HASYv2 Dataset
    • WFLW Dataset
    • Visdrone Dataset
    • 11k Hands Dataset
    • QuAC Dataset
    • LFW Deep Funneled Dataset
    • LFW Funneled Dataset
    • Office-Home Dataset
    • LFW Dataset
    • PlantVillage Dataset
    • Optical Handwritten Digits Dataset
    • UCI Seeds Dataset
    • STN-PLAD Dataset
    • FER2013 Dataset
    • Adience Dataset
    • PPM-100 Dataset
    • CelebA Dataset
    • Fashion MNIST Dataset
    • Google Objectron Dataset
    • CARPK Dataset
    • CACD Dataset
    • Flickr30k Dataset
    • Kuzushiji-Kanji (KKanji) dataset
    • KMNIST
    • EMNIST Dataset
    • USPS Dataset
    • MARS Dataset
    • HICO Classification Dataset
    • NSynth Dataset
    • RESIDE dataset
    • Electricity Dataset
    • DRD Dataset
    • Caltech 256 Dataset
    • AFW Dataset
    • PACS Dataset
    • TIMIT Dataset
    • KTH Actions Dataset
    • WIDER Face Dataset
    • WISDOM Dataset
    • DAISEE Dataset
    • WIDER Dataset
    • LSP Dataset
    • UCF Sports Action Dataset
    • Wiki Art Dataset
    • FIGRIM Dataset
    • ANIMAL (ANIMAL10N) Dataset
    • OPA Dataset
    • DomainNet Dataset
    • HAM10000 Dataset
    • Tiny ImageNet Dataset
    • Speech Commands Dataset
    • 300w Dataset
    • Food 101 Dataset
    • VCTK Dataset
    • LOL Dataset
    • AQUA Dataset
    • LFPW Dataset
    • ARID Video Action dataset
    • NABirds Dataset
    • SQuAD Dataset
    • ICDAR 2013 Dataset
    • Animal Pose Dataset
  • Folder icon closed Folder open iconDeep Lake Docs Home
  • Folder icon closed Folder open iconDataset Visualization
  • API Basics
  • Storage & Credentials
  • Getting Started
  • Tutorials (w Colab)
  • Playbooks
  • Data Layout
  • Folder icon closed Folder open iconShuffling in ds.pytorch()
  • Folder icon closed Folder open iconStorage Synchronization
  • Folder icon closed Folder open iconTensor Relationships
  • Folder icon closed Folder open iconQuickstart
  • Folder icon closed Folder open iconHow to Contribute

MNIST

Estimated reading: 6 minutes
MNIST handwritten digits dataset visualized by Activeloop

Visualization of the MNIST Test Dataset in the Deep Lake UI

MNIST dataset

What is MNIST Dataset?

The MNIST (Modified National Institute of Standards and Technology database) dataset contains a training set of 60,000 images and a test set of 10,000 images of handwritten digits. The handwritten digit images have been size-normalized and centered in a fixed size of 28×28 pixels. The MNIST digits dataset is often used by data scientists who want to try machine learning techniques and pattern recognition methods on real-world data while spending minimal effort on preprocessing and formatting.

Download MNIST Dataset in Python

Instead of downloading the MNIST dataset in Python, you can effortlessly load it in Python via our Deep Lake open-source with just one line of code.

Load MNIST Dataset Training Subset in Python

				
					import deeplake
ds = deeplake.load("hub://activeloop/mnist-train")
				
			

Load MNIST Dataset Testing Subset in Python

				
					import deeplake
ds = deeplake.load("hub://activeloop/mnist-test")
				
			

MNIST Dataset Structure

MNIST Data Fields
  • image: tensor containing the 28×28 image.
  • label: an integer between 0 and 9 representing the digit.
MNIST Data Splits
  • The MNIST dataset training set is composed of 30,000 patterns from SD-3 and 30,000 patterns from SD-1.
  • The MNIST dataset test set was composed of 5,000 patterns from SD-3 and 5,000 patterns from SD-1.

How to use MNIST Dataset with PyTorch and TensorFlow in Python

Train a model on MNIST dataset with PyTorch in Python

Let’s use Deep Lake built-in PyTorch one-line dataloader to connect the data to the compute:

				
					dataloader = ds.pytorch(num_workers=0, batch_size=4, shuffle=False)
				
			
Train a model on MNIST dataset with TensorFlow in Python
				
					dataloader = ds.tensorflow()
				
			

MNIST Dataset Creation

Data Collection and Normalization Information

The original images from MNIST were size-normalized to fit a 20×20 pixel box, while the aspect ratio was preserved. As a result, the images contain grey levels (i.e., pixels don’t simply have a value of black and white, but a level of greyness from 0 to 255) due to the anti-aliasing technique used by the normalization algorithm.

Next, the images were centered in a 28×28 pixel image by computing the center of mass of the pixels and translating the image to position this point at the center of the 28×28 field.

Additional Information about MNIST Dataset

MNIST Dataset Description

  1. Homepage: http://yann.lecun.com/exdb/mnist/ 
  2. Repository: N/A
  3. Paper: Y. LeCun, L. Bottou, Y. Bengio and P. Haffner: Gradient-Based Learning Applied to Document Recognition, Proceedings of the IEEE, 86(11):2278-2324, November 1998
  4. Point of Contact: http://yann.lecun.com/
MNIST Dataset Curators

Chris Burges, Corinna Cortes and Yann LeCun

MNIST Dataset Licensing Information

Creative Commons Attribution-Share Alike 3.0 license

MNIST Dataset Citation Information
				
					@article{lecun2010mnist,
  title={MNIST handwritten digit database},
  author={LeCun, Yann and Cortes, Corinna and Burges, CJ},
  journal={ATT Labs [Online]. Available: http://yann.lecun.com/exdb/mnist},
  volume={2},
  year={2010}
}

				
			

MNIST Dataset FAQs

What is the MNIST dataset for Python?

The MNIST dataset (Modified National Institute of Standards and Technology database) is one of the most popular datasets in machine learning. MNIST is a dataset of 60,000 square 28×28 pixel images of handwritten single digits between 0 and 9. The images are in grayscale format.

What is the MNIST dataset used for?

MNIST is used as a “hello world” example by data scientists worldwide. Typically, the MNIST dataset is used as a benchmark dataset, or as a proof-of-concept for training and testing purposes in the field of machine learning.

How to download the MNIST dataset in Python?

You can load the MNIST dataset fast with one line of code using the open-source package Deep Lake in Python. See detailed instructions on how to load the MNIST dataset training subset or MNIST dataset testing subset in Python.

How can I use MNIST dataset in PyTorch or TensorFlow?

You can stream the MNIST dataset while training a model in PyTorch or TensorFlow with one line of code using the open-source package Deep Lake in Python. See detailed instructions on how to train a model on the MNIST dataset with PyTorch in Python or train a model on the MNIST dataset with TensorFlow in Python.

Should I work with MNIST dataset in CSV?

No. CSV is not optimized for working with image data, especially for machine learning workflows. Instead of downloading MNIST dataset CSV, you easily load, version-control, query, and manipulate MNIST for machine learning purposes using Deep Lake.

How to create an Image Dataset like MNIST dataset?

With Deep Lake, creating image datasets like the MNIST digits dataset is simple. Simple datasets like MNIST can be created automatically by allowing Deep Lake to parse the legacy files into Deep Lake dataset format. More complex datasets can be created manually.

MNIST vs Fashion-MNIST. What is the difference between MNIST and Fashion-MNIST?

MNIST and Fashion-MNIST dataset are two separate datasets. However, the Fashion-MNIST dataset is meant to be an MNIST dataset alternative. Fashion-MNIST comprises pictures of clothing items and was published in 2017 by Zalando, a German online retailer. Both datasets are of the same size: 60 000 photos in the training set, as well as 10 000 pictures of clothing in the validation set of the dataset.

What is the size of each image in the MNIST dataset?

MNIST dataset image size is constant across all images of the dataset. Each MNIST dataset image is a fixed-size 28×28 pixel square image.

Why is MNIST so popular?

Created in 1998, the MNIST dataset containing handwritten digits from 0-9 is small in size, simple in structure, and easy to use. This makes it a good first dataset to try various pattern recognition methods in, with minimal effort required in data preprocessing.

What does MNIST stand for?

MNIST is an acronym for the Modified National Institute of Standards and Technology dataset.

Is MNIST suitable for Deep Learning?

Yes, the MNIST dataset is one of the most used datasets for deep learning. As of July 2022, MNIST only falls behind CIFAR-10, ImageNet, and COCO datasets in the number of papers that cite them (or have used them as benchmark datasets).

What are MNIST dataset alternatives?

The MNIST dataset is a popular benchmark dataset for image classification tasks. However, these six alternatives can be used for similar tasks. Here are a few:

  1. Fashion MNIST: This is a dataset of clothing images published by Zalando, with 10 classes of clothing items such as t-shirts, trousers, as well as shoes.

  2. CIFAR 10 and CIFAR 100: These are datasets of color images with 10 and 100 classes, respectively. The images are 32×32 pixels in size and contain objects such as airplanes, automobiles, or animals.

  3. SVHN: The Street View House Numbers dataset is a dataset of house numbers generated from Google Street View images. It comprises over 600,000 images of house numbers, and helps train models recognizing the digits in the numbers.

  4. EMNIST: EMNIST serves as an extension of the MNIST dataset, including handwritten characters from uppercase and lowercase letters, as well as digits.

  5. Kuzushiji-MNIST (KMNIST) and KKanji (Kuzushiji-Kanji): Both are datasets of handwritten Japanese characters.

  6. Caltech-256: Caltech dataset has 256 classes. The images are larger than those in MNIST or and CIFAR, with the size going up to 300×200 pixels.

 
 
Next - Datasets COCO Dataset
Leaf Illustration

© 2022 All Rights Reserved by Snark AI, inc dba Activeloop