sparkfish / shabby-pages

ShabbyPages is a state-of-the-art corpus of born-digital document images with both ground truth and distorted versions appropriate for use in training models to reverse distortions and recover to original denoised documents.
MIT License
48 stars 6 forks source link
binarization born-digital computer-vision corpus data-science dataset denoising layout-detection

ShabbyPages 2023

Document denoising and binarization are fundamental problems in the document processing space, but current datasets are often too small and lack sufficient complexity to effectively train and benchmark modern data-driven machine learning models. To fill this gap, we introduce ShabbyPages, a new document image dataset designed for training and benchmarking document denoisers and binarizers.

ShabbyPages contains over 6,000 clean "born digital" images with synthetically-noised counterparts ("shabby pages") that were augmented using the Augraphy document augmentation tool to appear as if they have been printed and faxed, photocopied, or otherwise altered through physical processes.

In our paper, we discuss the creation process of ShabbyPages and demonstrate the utility of ShabbyPages by training convolutional denoisers which remove real noise features with a high degree of human-perceptible fidelity, establishing baseline performance for a new ShabbyPages benchmark.

What is ShabbyPages

To see the ShabbyPages in action, check out this notebook Open In Colab that uses the pipeline built with Augraphy.

ShabbyPages is a corpus of born-digital document images with both ground truth and distorted versions appropriate for supervised learning use in training models to reverse distortions and recover the original clean documents. This state-of-the-art dataset with synthetically-generated real-world representations can be used to improve document layout detection, text extraction and OCR processes that depend on denoising and binarization preprocessing models.

Often, training data is not accompanied by clean ground truth sources, which leads to inaccurate training and severely-limited volumes of available training data. This dataset was created using the latest version of Augraphy (8.1.0) to produce a synthetic yet realistic dataset based on ground truth documents.

ShabbyPages Logo

This repository contains the following scripts for producing the dataset:

  1. letterfit.py, which defines a class that can fit images to a 8.5"x11" Letter page, similar to a document scanner.
  2. shabbypipeline.py, which contains a parametrized default Shabby Pages pipeline.
  3. generate_kaggle_set.py, which produces the full dataset for the Kaggle competition.
  4. remove_blank_pages.py, which removes images with >99% white pixels from the competition set.
  5. make_submission.py, which produces the submission file for the Kaggle competition.
  6. daily_build.py, which produces a small test set every day.
  7. tweet.py, which tweets an example image from the daily build.
  8. azure_file_service.py, which manages connections to Azure Files.
  9. example_shabby_pipeline_generation.ipynb, which is an example to generate shabby image from Augraphy and shabby pipeline using single input image.

Distortion Pipeline

An Augraphy pipeline was applied to ground truth documents to generate printed, scanned, copied and faxed versions of documents encountered in the real world. In order to preserve a pixel-level mapping between ground truth and distorted versions of documents, geometric transformations that skew or warp document images were avoided.

ShabbyPage-of-the-Day

Follow @AugraphyProject to check out the each day's randomly generated shabby page. The ShabbyPages pipeline is used with the latest version of Augraphy each day to generate a ShabbyPage-of-the-Day image posted on Twitter like the following:

Credits / Prior Art

Below are related datasets that offer either real-world scanned documents or a combination of ground-truth and distorted versions.

Real-World Datasets

Synthetic Datasets

The Augraphy Project

The synthetic distortions in this dataset were generated by The Augraphy Project using a custom Augraphy pipeline to create realistic old and noisy documents from "born digital" sources. This simulation of realistic paper-oriented process distortions creates large amounts of training data for AI/ML processes to learn how to remove those distortions.

Augraphy is a Python library that creates multiple copies of original documents though an augmentation pipeline that randomly distorts each copy -- degrading the clean version into dirty and realistic copies rendered through synthetic paper printing, faxing, scanning and copy machine processes.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Citations

If you used ShabbyPages in your research, please cite the project's dataset.

BibTeX:

@data{ShabbyPages2023,
  author = {The Augraphy Project},
  title = {ShabbyPages: A Reproducible Document Denoising and Binarization Dataset},
  year = {2023},
  url = {https://github.com/sparkfish/shabby-pages},
  version = {2023}
}

License

Copyright 2023 Sparkfish LLC

ShabbyPages is a free and open-source dataset and software recipe distributed under the terms of the MIT license.