Skip to content
المشاريع

حول

A native Rust toolkit for OCR, document layout analysis, and vision-language document understanding.

مشاريع أخرى

كيف تُقاس هذه الأرقام

223 نجمة36 التفرعات +2 خلال 24 ساعة

ما يمكنك فعله

  • Detect and recognize text with PP-OCRv6 in three model sizes.
  • Analyze layout and tables with PP-StructureV3 and PP-DocLayoutV4. Add formulas, seals, orientation, or rectification as needed.
  • Parse pages with native Candle models in oar-ocr-vl. The CLI defaults to PaddleOCR-VL-1.8.
  • Export classic structure and vision-language results as Markdown, shared page JSON, or DocLang XML.

النمو المقاس للنجوم

خلال 24 ساعة
+٢
خلال 7 أيام
+١٠
خلال 15 يومًا
+١٣
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

OAR-OCR

Crates.io Version Crates.io Downloads (recent) dependency status GitHub License

A Rust toolkit for text recognition, document layout analysis, and vision-language page parsing.

Highlights

  • Detect and recognize text with PP-OCRv6 in three model sizes.
  • Analyze layout and tables with PP-StructureV3 and PP-DocLayoutV4. Add formulas, seals, orientation, or rectification as needed.
  • Parse pages with native Candle models in oar-ocr-vl. The CLI defaults to PaddleOCR-VL-1.8.
  • Export classic structure and vision-language results as Markdown, shared page JSON, or DocLang XML.
  • Run on CPU or GPU, download models on first use, or load embedded ONNX bytes.
  • Process images and selected PDF pages from the shell with oar.

Quick Start

Command line

Install with cargo install oar-ocr-cli. Models download on first use, and auto selects an available compiled device. See the CLI guide for installation, presets, and output formats.

oar ocr page.png
oar parse page.png
oar indra page.png --device cpu
oar structure report.pdf --pages 1-3 --format json

Rust library

Install with cargo add oar-ocr for ONNX Runtime binaries and SIMD, or cargo add oar-ocr --features cuda,auto-download to also enable CUDA and fetch registered models. Without auto-download, model names resolve as local paths.

use oar_ocr::prelude::*;
let ocr = OAROCRBuilder::pp_ocrv6(PpOcrV6Size::Small).build()?;
let pages = ocr.predict(vec![load_image("page.png")?])?;
println!("{}", pages[0].concatenated_text("\n"));

Choose Tiny for the fastest pair, reduced dictionary, and 0.4 box threshold, or Small or Medium for the larger dictionary and 0.45 threshold. Seal detection and explicit detection settings can override the preset.

use oar_ocr::prelude::*;
let structure = OARStructureBuilder::pp_structurev3().build()?;
println!("{}", structure.predict("page.png")?.to_markdown());

For vision-language parsing, install cargo add oar-ocr-vl --features auto-download. Select a checkpoint by its model ID on CPU, CUDA, or Metal.

use oar_ocr_vl::{AnyPageParser, AnyPageParserModel, PageParser, auto_device};
use oar_ocr_vl::utils::image::load_image;
let parser = AnyPageParser::from_pretrained(
    AnyPageParserModel::PaddleOcrVl1_8, auto_device(), &Default::default(),
)?;
let page = parser.parse_page(&load_image("page.png")?, &Default::default())?;
println!("{}", page.markdown.as_deref().unwrap_or_default());

Both pipelines provide to_json(width, height). Use page.to_doclang() on a VL page or result.to_doclang(width, height) on a classic structure result.

Supported Models

Classic ONNX task Supported model families
Text detection PP-OCRv4, PP-OCRv5, and PP-OCRv6 DB detectors
Text recognition PP-OCRv3, PP-OCRv4, PP-OCRv5, PP-OCRv6, SVTRv2, and RepSVTR CTC recognizers
Document preprocessing PP-LCNet document orientation, PP-LCNet text-line orientation, and UVDoc rectification
Layout detection PicoDet, RT-DETR-H, PP-DocLayout S/M/L, PP-DocLayout Plus-L, PP-DocLayoutV2/V3/V4, and PP-DocBlockLayout
Table analysis PP-LCNet table classification, RT-DETR-L cell detection, and SLANet, SLANet+, and SLANeXt structure recognition
Formula recognition PP-FormulaNet, PP-FormulaNet Plus, and UniMERNet
Seal text detection PP-OCRv4 mobile and server seal detectors

OpenThai Text handles printed Thai and English, OCRia-nano-1 adds multilingual OCR and LayoutNet, and Indra reads 80+ languages with optional inline math. See the usage guide and pre-trained model guide for checkpoints, dictionaries, and licenses.

Choose a full-page parser or pair a layout detector with a region recognizer. See the VL quick start and VL model reference for model options and licenses.

Supported Vision-Language Models (30+)
Model Params Highlights
PaddleOCR-VL v1 / 1.5 / 1.6 / 1.8 0.9B Text, tables, formulas, and charts. Spotting and seals from 1.5.
PP-DocLayoutV2/V3/V4 54M / 33M / 34M Layout and reading order. V4 adds quadrilaterals and deformation.
GLM-OCR 0.9B Layout-guided text, table, and formula recognition.
HunyuanOCR 1.0 / 1.5 1B Prompt-driven parsing and spotting. Optional DFlash in 1.5.
Granite Docling v2 2B Native DocLang XML with locations and picture descriptions.
OvisOCR2 0.8B Page Markdown with LaTeX, HTML tables, and image references.
OvisOCR3 0.8B Markdown, structured blocks, and cross-page table reconstruction.
MiniCPM-OCR 1.0 1.3B Layout-guided text, tables, formulas, charts, and seals.
OXR-1.0 1.4B Region reading order, code, and chemical structures.
Xiaomi-OCR-0 0.8B Page Markdown, crop recognition, and key-information extraction.
OCRia-1 4B Markdown with HTML tables, chart data, and Mermaid diagrams.
LightOnOCR-3 0.8B / 1B / 4B Page transcription or labeled blocks with boxes.
Infinity-Parser2-Flash 2B Layout JSON in reading order or direct Markdown.
Typhoon OCR V2 0.8B / 2B Thai and English layout JSON. Extraction and questions on 2B.
Chandra OCR 2 5B Labeled HTML blocks, forms, charts, and Markdown.
Youtu-Parsing-Omni 5B OmniSchema JSON, layout blocks, and Markdown.
WeVisDoc 2B / 4B Full-page Markdown with LaTeX and HTML tables.
MonkeyOCRv2 S / B 0.6B / 0.7B Dewarping, layout, and recognition, or one-pass parsing.
HPD-Parsing 1B Hierarchical layout and content decoding with P-MTP.
MinerU2.5 / Pro 1.2B Two-step layout detection and crop recognition.
MinerU-Diffusion V1 2.5B Block-diffusion layout and recognition, or single-pass OCR.
TeleOCR (formerly NaviDC-OCR) 1.2B Layout, text, OTSL tables, formulas, and code.
VenusOCR 2.0 1B Layout-guided recognition with optional PTPv2.
jina-ocr-v1 3B (570M active) Page Markdown with optional FastMTP.
Unlimited-OCR-2 3B (570M active) Joint multi-page parsing with text and table continuation.
Nemotron-3.5-Parse 0.63B Page blocks with content-normalized boxes and optional DFlash2.
OpenThai OCR Markdown 2.0 / 2.2 0.63B Printed Thai and English pages with ordered blocks and HTML tables.

Documentation

Acknowledgments

  • ort provides the Rust bindings for ONNX Runtime.
  • PaddleOCR provides pretrained OCR and document analysis models.
  • Candle powers native Rust vision-language inference.

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…