metadata
annotations_creators:
- manual
language:
- pt
- en
license: mit
multilinguality: monolingual
pretty_name: Portuguese OCR Dataset
size_categories:
- 1K<n<10K
source_datasets: []
task_categories:
- image-to-text
tags:
- ocr
- Portuguese
π 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.