PreP-OCR: A Complete Pipeline for Document Image Restoration and Enhanced OCR Accuracy
Shuhao Guan 1 , Moule Lin 2 , Cheng Xu 1 , Xinyi Liu 1 Jinman Zhao 3 , Jiexin Fan 2 , Qi Xu 4 , Derek Greene 1 1 University College Dublin, 2 Trinity College Dublin 3 University of Toronto, 4 Shanghai University [email protected] , [email protected] · 2025
Read PreP-OCR: A Complete Pipeline for Document Image Restoration and Enhanced OCR Accuracy by Shuhao Guan 1 , Moule Lin 2 , Cheng Xu 1 , Xinyi Liu 1 Jinman Zhao 3 , Jiexin Fan 2 , Qi Xu 4 , Derek Greene 1 1 University College Dublin, 2 Trinity College Dublin 3 University of Toronto, 4 Shanghai University [email protected] , [email protected] (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2505-20429.txt.
Introduction
Shuhao Guan and seven co-authors built in 2025 PreP-OCR, a two-stage pipeline that cleans scanned pages before reading them, then fixes the text that remains wrong. Archives hold millions of degraded historical pages in many tongues. Stage one restores the image, trained on synthetic pages aged by random damage recipes. Stage two runs a byte-level language model tuned to correct typical reading errors.
On nearly fourteen thousand real pages in English, French and Spanish, the pipeline cut character errors by roughly two thirds versus reading the raw scans. Patch-based handling let it process very large pages without losing detail. The authors argue image repair and language repair belong in one chain. Each stage covers errors the other cannot reach. The work targets libraries digitizing fragile collections at scale.
Catalog record
| CREATOR | Shuhao Guan 1 , Moule Lin 2 , Cheng Xu 1 , Xinyi Liu 1 Jinman Zhao 3 , Jiexin Fan 2 , Qi Xu 4 , Derek Greene 1 1 University College Dublin, 2 Trinity College Dublin 3 University of Toronto, 4 Shanghai University [email protected] , [email protected] |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 38 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2505-20429
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
PreP-OCR: A Complete Pipeline for Document Image Restoration and Enhanced OCR Accuracy Shuhao Guan 1 , Moule Lin 2 , Cheng Xu 1 , Xinyi Liu 1 Jinman Zhao 3 , Jiexin Fan 2 , Qi Xu 4 , Derek Greene 1 1 University College Dublin, 2 Trinity College Dublin 3 University of Toronto, 4 Shanghai University [email protected] , [email protected] Abstract This paper introduces PreP-OCR, a two-stage pipeline that combines document image restoration with semantic-aware post-OCR correction to enhance both visual clarity and textual consistency, thereby improving text extraction from degraded historical documents. First, we synthesize document-image pairs from plaintext, rendering them with diverse fonts and layouts and then applying a randomly ordered set of degradation operations. An image restoration model is trained on this synthetic data, using multi-directional patch extraction and fusion to process large images. Second, a ByT5 post-OCR model, fine-tuned on synthetic historical text pairs, addresses remaining OCR errors. Detailed experiments on 13,831 pages of real historical documents in English, French, and Spanish show that the PreP-OCR pipeline reduces character error rates by 63.9-70.3% compared to OCR on raw images. Our pipeline demonstrates the potential of integrating image restoration with linguistic error correction for digitizing historical archives. https://github.com/NikoGuan/PreP-OCR 1 Introduction In the era of massive document digitization, ensuring accurate text extraction from degraded images has become increasingly important Shen et al. 2021 . Many historical documents, scanned books, and archival materials suffer from various forms of degradation – such as blur, noise, ink bleeding, and other artifacts – due to aging and suboptimal scanning conditions Pardo et al. 2024 . These degradations not only affect the visual quality of the images, but can also severely impact the resulting performance of Optical Character Recognition (OCR) systems, leading to high error rates in extracted text Hegghammer 2022 . To address these challenges, this paper introduces PreP-OCR, a novel synthetic-data-driven two-stage pipeline that first restores degraded images for OCR-based text extraction and then enhances the extracted text through post-processing. To effectively train the image restoration model, we employ a comprehensive synthetic data generation method that simulates realistic document degradation. First, we render clean text images with diverse typography, then we apply degradation operations in a randomized order with stochastic parameters (see Section 4.2 ), yielding a richly varied dataset, allowing models to learn a robust mapping between the original degraded inputs and their clean counterparts. Additionally, we propose a multi-directional patch extraction and fusion strategy to efficiently process larger images and further enhance overall image quality (see Section 4.3 ). Figure 6 shows examples of the process. Following image restoration, in the next step of our proposed pipeline the restored images are fed into an OCR system. Although restoration significantly reduces structural ambiguities, it may not fully eliminate OCR errors. To correct any residual recognition mistakes, we incorporate a ByT5 post-OCR correction module that semantically recovers errors, even in cases where images are severely degraded and challenging to fully restore (see Section 4.4 ). Consequently, the restoration stage primarily resolves ambiguities in character shapes, yielding more legible images that are easier for OCR systems to recognize, while the post-correction stage mitigates systematic OCR errors through sequence-to-sequence translation. In Sections 4.1 and 5.1 , we describe the collection of numerous degraded historical book images. These images were scanned using various OCR systems, and we then constructed evaluation datasets with their corresponding ground truth texts. In Sections 5.2 – 5.3 , we use the data to assess text reconstruction quality in different patch regions and evaluate the effectiveness of our fusion strategy. Finally, in Sections 5.4 – 5.5 , we test the PreP-OCR pipeline on English, French, and Spanish datasets. 2 Related Work Extensive research has demonstrated that image pre-processing can significantly improve the performance of deep learning models Vidal and Amigo 2012 ; Salvi et al. 2021 . However, pre-processing within the context of OCR remains relatively underexplored, with existing methods primarily focusing on contrast enhancement and color adjustment Gupta et al. 2007 ; Harraj and Raissouni 2015 ; Bui et al. 2017 . Recent studies in image deblurring have introduced more advanced restoration techniques that could also benefit OCR. Early image restoration methods were primarily based on CNNs Dong et al. 2015a ; Dong et al. 2015b ; Zhang et al. 2017 ; Cho et al. 2021 . Subsequent research introduced more elaborate architectures, such as residual blocks Kim et al. 2016 ; Zhang et al. 2021 , generative adversarial networks (GANs) Pathak et al. 2016 ; Gulrajani et al. 2017 ; Wang et al. 2018 ; Kupyn et al. 2019 , and attention mechanisms Zhang et al. 2018 ; Yu et al. 2018 . Transformers Vaswani 2017 , which model long-range dependencies, have advanced NLP and computer vision and are now widely used in image restoration Chen et al. 2021 ; Liang et al. 2021 ; Zamir et al. 2022 . Diffusion models have emerged as a powerful alternative for generative image tasks, optimizing a parameterized Markov chain to approximate the target distribution more accurately than many other generative frameworks. Examples in restoration include DiffIR Xia et al. 2023 and ResShift Yue et al. 2024 , both of which are diffusion-based approaches. Several studies have also used diffusion models together with textual information to recover the appearance of ancient stele inscriptions Zhu et al. 2024 ; Yang et al. 2025 . In our work, we harness image-restoration models to pre-process degraded images prior to applying OCR. The post-OCR task aims to correct errors in OCR outputs, with early methods relying on dictionary lookups or spelling checkers Furrer and Volk 2011 ; Bassil and Alwani 2012 ; Estrella and Paliza 2014 ; Kettunen 2016 . More recent approaches treat post-OCR correction as a sequence-to-sequence task, leveraging neural machine translation (NMT) models, such as BERT Devlin et al. 2019 , BART Lewis 2019 and T5 Raffel et al. 2020 Amrhein and Clematide 2018 ; Nguyen et al. 2020 ; Soper et al. 2021 ; Maheshwari et al. 2022 . Several comparative studies have shown that byte-level models, such as ByT5 Xue et al. 2022 , often achieve the best performance for post-OCR tasks Maheshwari et al. 2022 ; Löfgren and Dannélls 2024 ; Guan et al. 2024 ; Guan and Greene 2024b . Both image restoration and post-OCR correction require paired training data, and the availability of abundant, high-quality data is critical for success Rijhwani et al. 2020 ; Mazumder et al. 2024 ; Bi et al. 2025a . Consequently, researchers have explored a variety of strategies for generating synthetic data as a form of data augmentation Hamdi et al. 2023 ; Shorten and Khoshgoftaar 2019 . For image deblurring and text-recognition, common techniques involve injecting noise into clean images to mimic real-world degradation Yuan et al. 2007 ; Krishna et al. 2018 ; Rim et al. 2022 ; Li et al. 2023 ; Hamdi et al. 2023 , or using methods such as StableDiffusion Rombach et al. 2022 to create paired image edits Brooks et al. 2023 . In the post-OCR domain, synthetic training pairs are often produced by inserting controlled errors into clean text D’hondt et al. 2017 ; Grundkiewicz et al. 2019 ; Ignat et al. 2022 ;