Document Image Cleaning using Budget-Aware Black-Box Approximation

Ganesh Tata, Katyani Singh, Eric Van Oeveren, Nilanjan RayarXiv 2023 · DOI · arXiv

Introduction

Optical Character Recognition (OCR) is a cornerstone of document digitization, yet many state-of-the-art engines operate as "black boxes." These proprietary or complex systems do not allow for gradient-based optimization, making it difficult to train preprocessors (image cleaners) to improve their performance on noisy real-world data. Traditionally, training a neural network to mimic these engines—a "differentiable bypass"—requires an exhaustive number of API queries or local computations, leading to prohibitive financial costs and time bottlenecks. This paper introduces budget-aware sample selection methods that significantly reduce the required number of queries while maintaining high cleaning performance.

Methodology

The authors propose a framework using a UNet as an image preprocessor and a CRNN as an approximator to the black-box OCR. To optimize the training process under a limited query budget, two primary strategies were developed:

  1. Smart Sample Selection: Instead of querying the OCR for every image, the system selects informative samples based on Character Error Rate (CER).
  2. UniformCER: Samples are picked to represent a broad spectrum of difficulty, from low to high CER.
  3. TopKCER: Focuses exclusively on the most difficult samples where the model currently fails.
  4. Dataset Pruning: The researchers found that the easiest 30% of document images (those the OCR handles well without preprocessing) can be discarded entirely without impacting the final quality of the cleaner.

Experimental Setup

The methods were evaluated on two challenging benchmarks:

  • POS Dataset: ~90,000 word patches from real-world receipts (Findit, ICDAR SROIE, CORD) characterized by noise and fading.
  • VGG Dataset: 60,000 synthetic word images for robustness testing.

The system was tested against three major OCR engines: Tesseract, EasyOCR, and the Google Cloud Vision API.

Key Results

The experiments revealed a law of diminishing returns regarding the query budget. A massive jump in accuracy is observed when moving from a 0% to a 2.5%–4% budget, with only marginal gains thereafter.

Comparison of word-level accuracy across different OCR engines and query budgets.

As shown in the figure above, the performance achieved with just a 4% query budget is remarkably close to the 100% budget baseline. For instance, with Tesseract, the accuracy improved from 54.51% (noisy) to 80.73% with a 4% budget, nearly matching the 83.36% achieved at full budget. For the Google Vision API, the authors achieved a 4% accuracy boost using only a tiny fraction of the usual queries, reducing experimental costs from an estimated $9,030 USD to just $280 USD—a 32x reduction.

Discussion and Conclusion

This research demonstrates that "hardness" is a powerful proxy for information. By focusing on samples where the OCR engine struggles, models can learn effective cleaning strategies with minimal supervision. Furthermore, the preprocessors exhibited strong transferability; a cleaner trained for one engine often improved performance for others. Future work will explore more granular selection criteria and the application of these techniques to specialized domains like handwritten or historical document recognition.

Summary updated

Abstract

Recent work has shown that by approximating the behaviour of a non-differentiable black-box function using a neural network, the black-box can be integrated into a differentiable training pipeline for end-to-end training. This methodology is termed "differentiable bypass,'' and a successful application of this method involves training a document preprocessor to improve the performance of a black-box OCR engine. However, a good approximation of an OCR engine requires querying it for all samples throughout the training process, which can be computationally and financially expensive. Several zeroth-order optimization (ZO) algorithms have been proposed in black-box attack literature to find adversarial examples for a black-box model by computing its gradient in a query-efficient manner. However, the query complexity and convergence rate of such algorithms makes them infeasible for our problem. In this work, we propose two sample selection algorithms to train an OCR preprocessor with less than 10% of the original system's OCR engine queries, resulting in more than 60% reduction of the total training time without significant loss of accuracy. We also show an improvement of 4% in the word-level accuracy of a commercial OCR engine with only 2.5% of the total queries and a 32x reduction in monetary cost. Further, we propose a simple ranking technique to prune 30% of the document images from the training dataset without affecting the system's performance.
BibTeX
@misc{tata2023document,
  author = {Ganesh Tata and Katyani Singh and Eric Van Oeveren and Nilanjan Ray},
  title = {{Document Image Cleaning using Budget-Aware Black-Box Approximation}},
  year = {2023},
  eprint = {2306.13236},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.13236},
}
Figure