v2.5.0
Datasets ⭐
EXAMPLE CODE
KMNIST
Load the KMNIST dataset in Python fast with one line of code. 70,000 handwritten cursive Hiragana characters. Stream KMNIST dataset while training ML models.
Visualization of the KMNIST Test Dataset on the Activeloop Platform

KMNIST dataset

What is KMNIST Dataset?

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.

Download KMNIST Dataset in Python

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

Load KMNIST Dataset Training Subset in Python

1
import hub
2
ds = hub.load("hub://activeloop/kmnist-train")
Copied!

Load KMNIST Dataset Testing Subset in Python

1
import hub
2
ds = hub.load("hub://activeloop/kmnist-test")
Copied!

KMNIST Dataset Structure

KMNIST Data Fields

  • images: tensor containing the 28x28 images.
  • labels: one of ten possible classes, each representing one row of Hiragana.

KMNIST Data Splits

How to use KMNIST Dataset with PyTorch and TensorFlow in Python

Train a model on the KMNIST dataset with PyTorch

Let's use Hub's built-in PyTorch one-line dataloader to connect the data to the compute:
1
dataloader = ds.pytorch(num_workers=0, batch_size=4, shuffle=False)
Copied!

Train a model on the KMNIST dataset with TensorFlow

1
dataloader = ds.tensorflow()
Copied!

KMNIST Dataset Creation

Data Collection and Normalization Information
Source books (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 28x28 pixel resolution in grayscale.

Additional Information about KMNIST Dataset

KMNIST Dataset Description

KMNIST Dataset Curators

ROIS-DS Center for Open Data in the Humanities (CODH), adapted from "Kuzushiji Dataset" (created by National Institute of Japanese Literature and others).

KMNIST Dataset Licensing Information

KMNIST Dataset Citation Information

1
@online{clanuwat2018deep,
2
author = {Tarin Clanuwat and Mikel Bober-Irizar and Asanobu Kitamoto and Alex Lamb and Kazuaki Yamamoto and David Ha},
3
title = {Deep Learning for Classical Japanese Literature},
4
date = {2018-12-03},
5
year = {2018},
6
eprintclass = {cs.CV},
7
eprinttype = {arXiv},
8
eprint = {cs.CV/1812.01718},
9
}
Copied!

KMNIST Dataset FAQs

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:
Class / Codepoint
Hiragana Character
U+304A
U+304D
U+3059
U+3064
U+306A
U+306F
U+307E
U+3084
U+308C
U+3092

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 Hub. 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 Hub in Python. See detailed instructions on how to train a model on the KMNIST dataset with PyTorch or train a model on the KMNIST 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 Hub.

How to create an Image Dataset like KMNIST dataset?

With Activeloop Hub, creating image datasets like the KMNIST dataset is easy. Simple datasets like KMNIST can be created automatically by allowing Hub to parse the legacy files into Hub 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 28x28 grayscale examples in the training set, and 10,000 28x28 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 of 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.
Hub community member Alex Wang has contributed to this documentation. You rock, Alex! :)