OAR (ONNXRuntime And Rust) OCR
A comprehensive OCR and document understanding library built in Rust with ONNX Runtime.
Quick Start
Installation
With GPU support:
Basic Usage
use *;
use Path;
Document Structure Analysis
use OARStructureBuilder;
let structure = new
.with_table_classification
.with_table_structure_recognition
.table_structure_dict_path
.with_ocr
.build?;
Documentation
- Usage Guide - Detailed API usage, builder patterns, GPU configuration
- Pre-trained Models - Model download links and recommended configurations
Examples
See examples/ directory for complete CLI examples.
PaddleOCR-VL
PaddleOCR-VL is a Vision-Language model for advanced document understanding. It supports element-level OCR and layout-first document parsing. Our implementation uses Candle for inference. Download the model first:
# Element-level OCR
# Table recognition (outputs HTML)
# Formula recognition (outputs LaTeX)
# Chart recognition
UniRec
UniRec is a lightweight unified recognition model that handles text, formulas, and tables in a single model. It's faster and smaller than PaddleOCR-VL while maintaining good accuracy.
# Download UniRec model
# Run recognition
DocParser
DocParser provides a unified API for two-stage document parsing (layout detection + recognition) supporting both UniRec and PaddleOCR-VL backends:
# Using UniRec
# Using PaddleOCR-VL
Acknowledgments
This project builds upon the excellent work of several open-source projects:
-
ort: Rust bindings for ONNX Runtime by pykeio. This crate provides the Rust interface to ONNX Runtime that powers the efficient inference engine in this OCR library.
-
PaddleOCR: Baidu's awesome multilingual OCR toolkits based on PaddlePaddle. This project utilizes PaddleOCR's pre-trained models, which provide excellent accuracy and performance for text detection and recognition across multiple languages.
-
Candle: A minimalist ML framework for Rust by Hugging Face. We use Candle to implement Vision-Language model inference.