|
Download README.md from ampixa/limbu-ocr: direct link, hf CLI and curl.
- Browser
- Download file 5 kB
-
https://huggingface.co/ampixa/limbu-ocr/resolve/main/README.md
- Command line
-
hf download hf://ampixa/limbu-ocr/README.md
-
curl -L -H "Authorization: Bearer $HF_TOKEN" -o README.md https://huggingface.co/ampixa/limbu-ocr/resolve/main/README.md
5 kB
| license: apache-2.0 | |
| language: | |
| - lif | |
| - ne | |
| library_name: paddleocr | |
| pipeline_tag: image-to-text | |
| tags: | |
| - ocr | |
| - limbu | |
| - sirijonga | |
| - yakthung | |
| - devanagari | |
| - paddleocr | |
| - pp-ocrv5 | |
| extra_gated_heading: "Request access to Limbu OCR" | |
| extra_gated_description: "Access is approved manually by Ampixa." | |
| extra_gated_fields: | |
| Name: text | |
| Organization: text | |
| Intended use: text | |
| # Limbu OCR | |
| Text recognition for **Limbu (Yakthung)** in its own **Sirijonga** script and in **Devanagari**, with full-page | |
| and PDF OCR. Two PaddleOCR PP-OCRv5 mobile line recognizers (about 7.6 MB each) plus PaddleOCR's page | |
| detector. Output is Unicode text (Limbu block U+1900 to U+194F, or Devanagari). | |
| | Recognizer | Folder | Measured on | Character error rate | | |
| |---|---|---|---| | |
| | Sirijonga Limbu | `models/limbu-sirijonga-ft-v2` | frozen 902-line test set | 0.0047 (grapheme 0.0098, exact line 85.9 %) | | |
| | Devanagari | `models/deva-v2` | frozen Newar (Devanagari) test set | 0.062 (grapheme 0.131) | | |
| Both numbers come from the training records in each `model-card.json`. The Sirijonga test labels are | |
| silver (machine-assisted), so treat them as diagnostic, not a benchmark. | |
| ## Quick start | |
| ```bash | |
| pip install -U huggingface_hub | |
| hf auth login # after your access request is approved | |
| hf download ampixa/limbu-ocr --local-dir limbu-ocr | |
| cd limbu-ocr | |
| pip install -r requirements.txt # paddlepaddle 3.3.1, paddleocr 3.7.0, pillow, opencv, pypdfium2 | |
| python -m limbu_ocr line line.png # one cropped text line, script detected | |
| python -m limbu_ocr line line.png --script sirijonga # force a recognizer | |
| python -m limbu_ocr page page.jpg --json page.json # detect lines, order them, read each | |
| python -m limbu_ocr pdf book.pdf --dpi 200 --evidence out/ # every page; crops + annotated pages in out/ | |
| ``` | |
| From Python: | |
| ```python | |
| import limbu_ocr | |
| limbu_ocr.read_line("line.png")["text"] # {"text", "engine", "confidence", "candidates"} | |
| page = limbu_ocr.read_page("page.jpg", script="auto") | |
| print(page["text"]) # lines joined by newlines, in reading order | |
| for row in page["rows"]: | |
| print(row["box"], row["selected_engine"], row["text"]) | |
| ``` | |
| The first page or PDF run downloads PaddleOCR's own PP-OCRv5 text detector from PaddleOCR's model hub. | |
| Line recognition needs nothing beyond this repo. | |
| `python app.py` starts the Gradio interface from the original demo (install `gradio==5.49.1` first). | |
| ## Options | |
| - `--script auto|sirijonga|devanagari`: `auto` runs both recognizers and keeps the reading with the higher | |
| confidence. Set the script when you know it; it halves the work. | |
| - `--order Auto|Rows LTR|Columns LTR|Columns RTL`: page reading order. `Auto` detects two-column layouts. | |
| - `--seed sirijonga|devanagari`: recognizer used inside the detection pass. Each detected line is read again | |
| with `--script`. | |
| - `read_page(...)` also exposes the detector settings (`det_limit_side_len`, `det_thresh`, `det_box_thresh`, | |
| `det_unclip_ratio`, `crop_padding`). | |
| ## What changed from the demo Space | |
| The private `ampixa/limbu-ocr` Space had three problems, all fixed here: | |
| 1. Its startup check looked for `models/deva-v2/artifacts/nep_eng_dict.txt`, which does not exist, so every | |
| recognition request failed. It now checks for the real dictionary file (`devanagari-v2.txt`). | |
| 2. `auto` mode added a bonus per Limbu character. The Sirijonga recognizer always outputs Limbu characters, | |
| so it won on Devanagari images even at much lower confidence (Devanagari lines came back as Limbu | |
| gibberish, CER 0.86). `auto` now compares confidence only; on test renders it picks the right script for | |
| every line. | |
| 3. Paddle 3.3.1's oneDNN CPU path crashes inside the page detector. oneDNN is now disabled for all models. | |
| On lines rendered with Noto Sans Limbu and Noto Sans Devanagari, all four test lines read with CER 0.000 | |
| in both forced and auto mode. Full-page OCR of the same lines found and ordered all four; two Devanagari | |
| lines had one-character slips at the crop edge. | |
| ## Contents | |
| ``` | |
| limbu_ocr/ Python API + CLI (core.py = the demo's OCR functions without the UI) | |
| app.py Gradio UI from the demo, with the fixes above | |
| models/limbu-sirijonga-ft-v2/ Sirijonga recognizer (inference.json/.pdiparams/.yml, dictionary, model card) | |
| models/deva-v2/ Devanagari recognizer | |
| models/line-detector/best.pt optional YOLO line detector used by the UI's diagnostic tab (needs ultralytics) | |
| ``` | |
| ## Limitations | |
| - Line recognizers expect one horizontal text line per image. Use `page` for anything larger. | |
| - Page output is a draft for human correction, not benchmark-quality text. | |
| - Training used Limbu print sources (newspaper and textbook pages) and synthetic renders; handwriting and | |
| unusual fonts are untested. | |
| - Older candidates from the demo (`limbu-sirijonga-real-heavy`, and `limbu-devanagari-ppocrv5`, whose | |
| truncated dictionary produced garbage) are not included. | |