Dataset Viewer
The dataset viewer is not available for this dataset.
Unexpected token '<', "<html> <h"... is not valid JSON

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

NDL Public Domain OCR Dataset — Line-Cropped (WebDataset)

This dataset is a derivative of the Public Domain OCR Training Dataset (FY2021) published by the National Diet Library of Japan (国立国会図書館).

Each sample is a line-level crop of a historical document page, paired with its OCR text transcription.

What was changed from the original

This dataset was not created by the National Diet Library. The following transformations were applied:

  • Each text line (LINE element) was cropped from the original page image using its bounding box coordinates (X, Y, WIDTH, HEIGHT).
  • The cropped image was paired with the line's transcription text (STRING attribute).
  • All samples were packaged into WebDataset .tar shards.

Dataset Details

Total samples 103,882
Shards 4 (ndlocr-000000.tarndlocr-000003.tar, ~1 GB each)
Period covered 1870s – 1960s
Source images 3,997 XML files / 7,919 page images
Sample key format {decade}/{book_id}/{page_name}/{line_index}

Each sample contains:

  • *.jpg — Cropped line image (JPEG, quality 95)
  • *.txt — OCR transcription text

Usage

import webdataset as wds
from PIL import Image
import io

dataset = wds.WebDataset("ndlocr-{000000..000003}.tar")
for sample in dataset:
    image = Image.open(io.BytesIO(sample["jpg"]))
    text = sample["txt"].decode("utf-8")

License and Rights

The original materials are marked with PDM (Public Domain Mark 1.0). Only materials with expired copyright protection periods are included.

This dataset is freely available for secondary use. However, the National Diet Library requests consideration of the following:

  • Indicate modifications: When editing or modifying the data, clearly state that you have done so. Do not present modifications as if they were created by the original authors or the National Diet Library.
  • Preserve the freedom notice: Maintain the marking indicating that the data is freely reusable.
  • Respect the source materials: Avoid uses that damage the reputation of the original works or their authors. Be considerate of the cultures and communities related to the original works.
  • Observe other rights: Be mindful of moral rights, neighboring rights, portrait rights, publicity rights, privacy rights, trademark rights, and other applicable laws beyond copyright.

Source

Downloads last month
15