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 

Machine Learning Datasets

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

Docy

Machine Learning Datasets

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

MNIST

Estimated reading: 6 minutes

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 MMNIST 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 so as 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, 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 MNIST dataset fast with one line of code using the open-source package Deep Lake in Python. See detailed instructions on how to load MNIST dataset training subset or MNIST dataset testing subset in Python.

How can I use MNIST dataset in PyTorch or TensorFlow?

You can stream 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 MNIST dataset with PyTorch in Python or train a model on 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 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, 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 on, with minimal effort required on 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, MNIST dataset is one of the most used datasets for deep learning. As of July 2022, MNIST only falls behind CIFAR-10, ImageNet, COCO datasets in the amount of papers that cite them (or have used it as a benchmark dataset).

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.

Machine Learning Datasets - Previous Datasets Next - Datasets Image Hotspots Widget
Next - Datasets Image Hotspots Widget
Leaf Illustration

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