Dataset Viewer

The viewer is disabled because this dataset repo requires arbitrary Python code execution. Please consider removing the loading script and relying on automated data support (you can use convert_to_parquet from the datasets library). If this is not possible, please open a discussion for direct help.

πŸ“˜ Portuguese OCR Dataset

This dataset contains scanned image-text pairs in European Portuguese, curated manually for Optical Character Recognition (OCR) tasks. It includes literary sentences and historical excerpts.

πŸ“¦ Dataset Overview

  • Total Samples: 10,000
  • Image Shape: (10000, 100, 1200, 3) β€” color images with height 100 and width 1200 pixels
  • Text Example:
    "E mais avante o Estreito que se arreia"

πŸ“‚ Dataset Structure

The dataset is stored in a single HDF5 file (dataset.h5), which includes:

  • images: a NumPy array of grayscale image data (from PNG files)
  • texts: a list of UTF-8 encoded strings, corresponding to each image

Each sample pairs an image and its corresponding transcription.

πŸ“Š Dataset Statistics

  • Format: HDF5 (dataset.h5)
  • Total samples: ~10,000
  • Average image size: 224x224 pixels (if preprocessed)
  • Language: European Portuguese
  • Source: literary and historic texts

πŸ’Ύ How to Load

To use this dataset with the Hugging Face Datasets library:

from datasets import load_dataset
import h5py

# Load from Hugging Face
dataset_path = "mazafard/portugues_ocr_dataset"
h5_file = load_dataset(dataset_path, data_files="dataset.h5", split="train")

# Alternatively, open the HDF5 file directly
with h5py.File("dataset.h5", "r") as f:
    images = f["images"][:]        # NumPy array of images
    texts = f["texts"][:]          # List of transcriptions

🧠 Use Cases

  • Fine-tuning OCR models like microsoft/trocr-base-printed
  • Document digitization
  • Research in Portuguese language modeling and handwritten/printed recognition

πŸ“œ License

MIT License β€” free for academic and commercial use with attribution.

πŸ“¦ How to Inspect dataset.h5

You can extract metadata from the HDF5 file using h5py:

import h5py

with h5py.File("dataset.h5", "r") as f:
    print("Keys:", list(f.keys()))  # ['images', 'texts']
    print("Number of samples:", len(f["texts"]))
    print("Image shape:", f["images"].shape)
    print("Example text:", f["texts"][0])

⚠️ Note

This dataset uses synthetic text-image pairs for printed OCR. Handwritten or scanned documents are not included.

Downloads last month
81