Constructing Image-Text Pair Dataset from Books

Yamato Okamoto, Haruto Toyonaga, Yoshihisa Ijiri, Hirokatsu KataokaarXiv 2023 · DOI

Abstract

This research introduces an automated pipeline for transforming digitized historical books into high-quality image-text datasets. By leveraging OCR, object detection, and layout analysis, the authors extracted over 9,500 image-caption pairs from Japanese photo books (1868–1945). Fine-tuning multimodal models like CLIP on this dataset significantly improved performance in specialized historical domains, demonstrating the value of curated digital archives over noisy web-scraped data.

Introduction

Current large-scale image-text datasets, such as LAION or COCO, rely heavily on web scraping. While expansive, these datasets often suffer from noise and lack the deep, fact-checked historical knowledge found in library archives. Digital archives represent a "goldmine" of high-quality information, yet their complex layouts—where captions, body text, and illustrations are often intermingled—make them difficult to use for machine learning. This paper addresses the challenge of autonomously extracting and pairing illustrations with their correct captions from historical digitized pages.

Methodology

The proposed multi-stage pipeline automates the construction of datasets from messy, digitized layouts:

  1. Detection & OCR: Mask-RCNN identifies illustration areas, while an OCR engine extracts all text on a page.
  2. Layout Analysis: To distinguish captions from page numbers and body text, a SegFormer model classifies the layout, allowing the system to isolate relevant descriptive text.
  3. Matching: Captions are linked to their nearest-neighbor illustration. The system intelligently merges strings if a caption is split across multiple lines.
  4. Post-Processing: To ensure data quality, areas with high OCR text density (likely graphs or tables) are excluded.
  5. Metadata Integration: Existing book metadata (author, year, region) is automatically attached to each pair as supervised labels.
The automated pipeline identifies illustration areas and matches them with corresponding captions extracted via OCR and layout analysis.

Dataset Construction

The researchers utilized two primary data sources:

  • NDL-DocL: A dataset from the National Diet Library of Japan used to fine-tune the layout and detection models, containing over 10,000 manually annotated images.
  • Historical Photo Book Dataset: The pipeline was applied to 175 historical photo books (1868–1945), resulting in 9,516 high-quality image-text pairs labeled by Japanese prefecture.
Examples of extracted image-text pairs, including ancient Egyptian casting work and a flower-patterned mirror from Korea.

Results and Insights

Fine-tuning a CLIP (ViT-B/32) model on the new dataset yielded substantial improvements:

  • Retrieval Performance: Image-to-text retrieval Recall@100 increased from 0.20 to 0.51.
  • Domain Expertise: The model successfully identified specific landmarks, such as the "Kameido Tenmangu" shrine, which the base CLIP model could not recognize.
  • Visual Dialects: Analysis via Grad-CAM revealed that the model learned to identify Japanese regions by regional architectural features, such as roof structures influenced by local climates.

Conclusion and Future Work

While the pipeline excels with photo book layouts, it faces challenges with more complex magazine formats where text and images overlap. Future efforts will focus on scaling the pipeline across larger digital archives and adapting it to diverse languages and genres. This work underscores the potential of historical books as a "ground truth" source for training accurate and reliable multimodal models.

Summary updated

BibTeX
@misc{okamoto2023constructing,
  author = {Yamato Okamoto and Haruto Toyonaga and Yoshihisa Ijiri and Hirokatsu Kataoka},
  title = {{Constructing Image-Text Pair Dataset from Books}},
  year = {2023},
  eprint = {2310.01936},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.01936},
}
Figure