Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Newbee OCR CLI

A command-line OCR tool built on rust-paddle-ocr / ocr-rs 2.3.1. The default binary embeds PP-OCRv6 tiny, so basic OCR works without a separate model download. PP-OCRv6 small, medium, and legacy/script-specific models are downloaded from GitHub on demand when local files are missing.

Build

cd newbee_ocr_cli
cargo build --release

The binary is written to target/release/nbocr.

Quick Use

Default embedded PP-OCRv6 tiny:

nbocr r image.png

Use another v6 tier. Missing files are downloaded into --models-dir or ./models:

nbocr r document.jpg -d v6-small -l ja
nbocr r document.jpg -d v6-medium -l fr -f json

Batch:

nbocr b ./images --recursive -f jsonl -o results.jsonl

PP-OCRv6 Support

Use -d v6-tiny, -d v6-small, or -d v6-medium. The CLI automatically pairs detection with the matching v6 recognition model.

PP-OCRv6 is not one model per language. Each v6 tier uses one multilingual recognition model plus its tier-specific charset:

Tier Detection Recognition Charset Language scope
v6-tiny PP-OCRv6_tiny_det.mnn PP-OCRv6_tiny_rec.mnn ppocr_keys_v6_tiny.txt Chinese, English, and the official Latin-script set; Japanese excluded
v6-small PP-OCRv6_small_det.mnn PP-OCRv6_small_rec.mnn ppocr_keys_v6_small.txt Official 50 v6 recognition languages
v6-medium PP-OCRv6_medium_det.mnn PP-OCRv6_medium_rec.mnn ppocr_keys_v6_medium.txt Official 50 v6 recognition languages

-l, --language validates the requested language and keeps output/config explicit; for v6 it does not select a separate language-specific recognition file.

Korean, Cyrillic, Arabic, Devanagari, Thai, Greek, Tamil, and Telugu should use PP-OCRv5 script-specific recognition models.

Model Files

The default v6 tiny files are embedded by default. Other missing files are downloaded from:

https://raw.githubusercontent.com/zibo-chen/rust-paddle-ocr/v2.3.1/models/

Download target:

  • --models-dir <DIR> when provided.
  • ./models otherwise.

Already-downloaded files are reused.

To install converted Paddle models manually:

python ../rust-paddle-ocr/script/convert_paddle_to_mnn.py \
  --ocr-dir /path/to/paddle/inference/models \
  --install-dir ./models

Commands

Inspect models:

nbocr list
nbocr list --detailed
nbocr info v6-small

Important options:

Option Description
-m, --models-dir <DIR> Model directory and auto-download target
-d, --det-model <MODEL> v4, v5, v5-fp16, v6-tiny, v6-small, v6-medium
-l, --language <LANG> Language/model alias, for example zh, en, ja, fr, arabic
-f, --format <FMT> text, json, or jsonl
--gpu <BACKEND> metal, opencl, vulkan, or cuda
--timing Print timing information

Embedded Models

The default feature set embeds PP-OCRv6 tiny. Optional features can embed additional models into the binary.

cargo build --release --features "embed-det-v6-small,embed-rec-v6-small"

Available v6 embed features:

embed-det-v6-tiny
embed-det-v6-small
embed-det-v6-medium
embed-rec-v6-tiny
embed-rec-v6-small
embed-rec-v6-medium

License

Apache-2.0

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages