
Visualization of the KMNIST Test Dataset in the Deep Lake UI
The KMNIST (Kuzushiji-MNIST) dataset is a drop-in replacement for the MNIST dataset and is comprised of a training set of 60,000 examples and a testing set of 10,000 examples of handwritten Kuzushiji (cursive Japanese) Hiragana characters. The handwritten characters have been processed to fit into 28×28 pixel resolution grayscale images. The KMNIST dataset is suggested for data scientists who want to try machine learning techniques and computer vision techniques on real-world data while spending minimal effort on preprocessing and formatting.
Instead of downloading the KMNIST dataset in Python, you can effortlessly load it in Python via our Deep Lake open-source with just one line of code.
import deeplake
ds = deeplake.load("hub://activeloop/kmnist-train")
import deeplake
ds = deeplake.load("hub://activeloop/kmnist-test")
KMNIST Data Fields
- images: tensor containing the 28×28 images.
- labels: one of ten possible classes, each representing one row of Hiragana.
KMNIST Data Splits
- The KMNIST dataset training set is composed of 60,000 images, perfectly balanced between the ten classes.
- The KMNIST dataset test set is composed of 10,000 images, perfectly balanced between the ten classes.
Train a model on the KMNIST dataset with PyTorch
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 the KMNIST dataset with TensorFlow
dataloader = ds.tensorflow()
Data Collection and Normalization Information
Sourcebooks (35 classical Japanese books from the 18th century) were scanned, and a bounding box was created for each character. The bounding box images were then processed to conform to the 28×28 pixel resolution in grayscale.
- Homepage: http://codh.rois.ac.jp/kmnist/index.html.en
- Repository: https://github.com/rois-codh/kmnist
- Paper: T. Clanuwat, M. Bober-Irizar, A. Kitamoto, A. Lamb, K. Yamamoto, and D. Ha: Deep Learning for Classical Japanese Literature, arXiv:1812.01718, December 2018
- Point of Contact: https://github.com/rois-codh/kmnist/issues
KMNIST Dataset Curators
ROIS-DS Center for Open Data in the Humanities (CODH), adapted from "Kuzushiji Dataset" (created by the National Institute of Japanese Literature and others).
KMNIST Dataset Licensing Information
KMNIST Dataset Citation Information
@online{clanuwat2018deep,
author = {Tarin Clanuwat and Mikel Bober-Irizar and Asanobu Kitamoto and Alex Lamb and Kazuaki Yamamoto and David Ha},
title = {Deep Learning for Classical Japanese Literature},
date = {2018-12-03},
year = {2018},
eprintclass = {cs.CV},
eprinttype = {arXiv},
eprint = {cs.CV/1812.01718},
}
What is the KMNIST dataset for Python?
The KMNIST dataset (Kuzushiji-MNIST) is a drop-in replacement for the MNIST (Modified National Institute of Standards and Technology) dataset, which is one of the most well-known datasets in machine learning. KMNIST is a dataset of 70,000 (60,000 training examples and 10,000 testing examples) 28×28 images of handwritten single Kuzushiji (cursive Japanese) Hiragana characters from classical Japanese literature, spanning ten classes representing the corresponding rows in modern Hiragana. Similar to MNIST, the images are in grayscale format. The classes are as follows:
What is the KMNIST dataset used for?
KMNIST is considered a more difficult training task than MNIST due to the many-to-one mapping between labels and characters. This is the case as one class in KMNIST may have many characters mapped to it. KMNIST can be used as a more challenging machine-learning task after working with the MNIST dataset
How to download the KMNIST dataset in Python?
You can load the KMNIST dataset fast with one line of Python code using the open-source package Activeloop Deep Lake. See detailed instructions on how to load the KMNIST dataset training subset or how to load the KMNIST dataset testing subset.
How can I use the KMNIST dataset in PyTorch or TensorFlow?
You can stream the KMNIST dataset while training a model in PyTorch or TensorFlow with one line of code using the open-source package Activeloop Deep Lake in Python. See detailed instructions on how to train a model on the MNIST dataset with PyTorch or train a model on the MNIST dataset with TensorFlow.
Should I work with KMNIST dataset in CSV?
No. CSV is not optimized for working with image data, especially for machine learning workflows. Instead of downloading the KMNIST dataset in CSV format, you easily load, version-control, query, and manipulate KMNIST for machine-learning purposes using Activeloop Deep Lake.
How to create an Image Dataset like the KMNIST dataset?
With Activeloop Deep Lake, creating image datasets like the MNIST dataset is easy. Simple datasets like KMNIST 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.
KMNIST vs Fashion-MNIST. What is the difference between KMNIST and Fashion-MNIST?
KMNIST and Fashion-MNIST datasets are two separate datasets. Both datasets are inspired by, and meant to be alternatives to the original MNIST dataset, and are thus of the same size (60,000 28×28 grayscale examples in the training set, and 10,000 28×28 grayscale examples in the testing set) and have the same number of classes.
Fashion-MNIST comprises pictures of clothing items and was published in 2017 by Zalando, a German online retailer. KMNIST comprises handwritten Hiragana characters from classical Japanese books and was published in 2018. It was curated by the ROIS-DS Center for Open Data in the Humanities (CODH).
What is the size of each image in the KMNIST dataset?
Each image in the KMNIST dataset is a 28×28 grayscale image.

Deep Lake community member Alex Wang has contributed to this documentation. You rock, Alex! 🙂