Seeing Straight: Document Orientation Detection for Efficient OCR

Suranjan Goswami, Abhinav Ravi, Raja Kolla, Ali Faraz, Shaharukh Khan, Akash, Chandra Khatri, Shubham AgarwalarXiv 2025 · DOI

Abstract

Optical Character Recognition (OCR) systems often struggle with documents that are not perfectly oriented, leading to hallucinations and recognition failures. This paper introduces a lightweight, high-performance rotation classification pipeline that serves as a critical pre-processing step for OCR. By correctly orienting documents before text recognition, we achieve up to a 4x performance boost in open-source OCR engines. Furthermore, we introduce ORB-Indic, the first multilingual benchmark specifically designed to evaluate rotation robustness across 11 Indian languages.

Introduction

Most modern OCR systems and Vision Language Models (VLMs) operate under the assumption that input documents are perfectly upright. However, real-world data captured via mobile devices or scanners is frequently tilted, sideways, or upside down. When an OCR engine encounters such rotated documents, it often fails to produce coherent text, instead generating hallucinations or repetitive loops.

Comparison of OCR performance with and without rotation detection.

While state-of-the-art models like GPT-4o possess high general intelligence, they surprisingly struggle with basic spatial tasks like identifying page orientation. Additionally, existing benchmarks for this problem are heavily biased toward English, leaving a significant gap for low-resource scripts.

Methodology

We propose a standalone rotation classifier built upon the vision encoder of the Phi-3.5-Vision model. The architecture incorporates several key features:

  • Dynamic Image Cropping: Utilizing a strategy inspired by InternVL2, the model scales and pads images into non-overlapping 336x336 crops (up to 16 per image) plus a global thumbnail. This dual-scale approach allows the model to capture both fine-grained text features and overall document layout.
  • Lightweight Classification Head: Instead of a full language model, we append a simple two-layer feedforward neural network (MLP) to the vision encoder. This classifies the image into one of four canonical angles: 0°, 90°, 180°, and 270° (-90°).
  • Efficiency: By using only the vision encoder and a small classification head (~304M parameters), the system maintains a low latency of 0.5s on an NVIDIA H100, making it an ideal "pre-flight" check for any OCR pipeline.

Datasets and Benchmarking

To evaluate our approach, we introduced the OCR-Rotation-Bench (ORB), comprising two distinct components:

  1. ORB-En: Derived from the SROIE (receipts) and SynthDog (synthetic) datasets by applying uniform rotations.
  2. ORB-Indic: A novel, manually verified benchmark spanning 11 Indic languages (e.g., Hindi, Bengali, Tamil). Data was curated from Wikisource to ensure high-quality ground truth for scripts often overlooked in global datasets.
Examples of multilingual images, their classified rotation, and ground truth OCR output.

Results and Discussion

Our specialized model achieved 96.81% accuracy on English documents and 92.68% on the multilingual Indic set. The impact on downstream OCR performance was profound:

  • Tesseract: Accuracy improved from 24.06% to 48.99%.
  • docTR: Accuracy soared from 15.63% to 63.11%.
  • Closed-source models: Even Gemini-2.5 Pro saw a 14% performance uplift when utilizing the rotation module.

We observed a "VLM Paradox" where massive general-purpose models performed significantly worse at rotation detection than our smaller, specialized model. This suggests that spatial reasoning for document layouts is a distinct capability not automatically granted by scale. Furthermore, Indic scripts proved particularly sensitive to orientation due to complex ligatures and horizontal head-lines (like the shirorekha), which break recognition logic when tilted.

Conclusion

Correcting document orientation is a massive performance multiplier for OCR systems. Our lightweight classifier provides a robust, multilingual solution that significantly improves accuracy while maintaining production-level efficiency. Future work will focus on addressing arbitrary skew (deskewing), handwritten text, and developing a fully language-agnostic model that relies solely on visual layout cues.

Summary updated

BibTeX
@misc{goswami2025seeing,
  author = {Suranjan Goswami and Abhinav Ravi and Raja Kolla and Ali Faraz and Shaharukh Khan and Akash and Chandra Khatri and Shubham Agarwal},
  title = {{Seeing Straight: Document Orientation Detection for Efficient OCR}},
  year = {2025},
  eprint = {2511.04161},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.04161},
}
Figure