/ Модель

Характеристики

Лицензия
Своя лицензия
Библиотека
onnx
Опубликована
31 окт 2026

Netra-OCR

Описание изображенийИзображение → текст7 профессий

Модель Netra-OCR распознаёт кхмерский и английский текст на изображениях строк, включая сканы и фотографии документов.

0скачиваний за 30 дней1лайквеса обновлены20 ноя 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Netra-OCR — разработанная Netra Lab модель распознавания строк текста на кхмерском и английском языках. Она предназначена для чтения отсканированных документов и фотографий; распознавание PDF и преобразование страниц в редактируемые документы описаны как сценарии приложения Netra OCR, использующего несколько моделей. Модель содержит 19 млн параметров и обучена с нуля на 1,3 млн синтетических изображений строк. Архитектура сочетает CNN с блоками Squeeze-and-Excitation, Transformer-энкодер и декодер, а также двунаправленную LSTM для объединения частей длинной строки. Репозиторий предоставляет веса в формате ONNX; распознавание выполняется на CPU, также заявлена поддержка CUDA и запуск в браузере.

Для кхмерского текста модель выдаёт символы группами, соответствующими кхмерским кластерам. В приведённом сравнении она показала меньшую частоту ошибок символов, чем указанные базовые модели, на трёх наборах данных. При этом сложные фотографии и отдельные короткие слова распознаются хуже, а английский текст может содержать небольшие ошибки. Лицензия указана как other, конкретные условия в предоставленных данных не раскрыты.

Сценарии применения

  • распознавание кхмерского текста на сканах документов
  • извлечение английского текста из изображений строк
  • оцифровка сфотографированных кхмерских документов
  • распознавание печатного текста на кхмерском языке

Ограничения

На сложных фотографиях и коротких изолированных словах точность ниже, чем на стандартных тестовых строках; английский текст может содержать небольшие ошибки. Указана лицензия other, но её конкретные условия в доступных данных не раскрыты.

Для каких профессий подходит7

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Netra OCR

Khmer and English scans, photos and PDFs in, editable documents out. Netra-OCR is a 19M-parameter text-line recognizer for Khmer and English, trained from scratch on 1.3M synthetic line images. A Squeeze-and-Excitation CNN and a Transformer encoder read each line in overlapping chunks, a bidirectional LSTM joins the chunks, and a Transformer decoder writes the text one Khmer character cluster at a time. It runs on the CPU.

Results

Character error rate (%) on single text lines, lower is better. Netra-OCR uses beam search with width 3.

ModelParamsKHOBLegal DocumentsPrinted Words
Tesseract 5 (khm)–5.1241.7820.14
Surya OCR–14.5251.1628.45
Qwen2.5-VL-3B (LoRA on Khmer)3B89.2184.6398.62
DeepSeek-OCR (LoRA on Khmer)3B33.2344.2269.79
Netra-OCR19M0.965.312.95
  • Where it wins: the lowest error on all three sets, including phone photos of legal documents (5.31% against 41.78% for Tesseract).
  • Where it's weaker: hard photos and short isolated words cost accuracy (5.31% and 2.95% against 0.96% on KHOB), and English can come back with small errors.

The baselines' outputs are normalised the same way. The two vision-language models had a short LoRA fine-tune on 6,000 of our lines, since neither documents Khmer support. Legal Documents is not public, because the documents belong to real people.

The full benchmark, with word error rate, exact match and the zero-shot vision-language models, is in docs/RESULTS.md.

Architecture

A text line is chunked, each chunk is encoded in parallel, and the vision tokens are merged into one sequence. A bidirectional LSTM smooths the chunk seams, and the Transformer decoder writes the text one character cluster at a time.

  • Chunking: each line is resized to 48 px high and split into 48 × 100 px chunks that overlap by 16 px, so long lines are never squeezed.
  • Encoder: a Squeeze-and-Excitation CNN (5 VGG-style blocks, SE over height only in blocks 3–5), a patch module and a 2-layer Transformer encoder turn each chunk into 384-dimensional tokens.
  • Across chunks: the tokens of all chunks are concatenated, and a one-layer bidirectional LSTM carries context across each seam.
  • Decoder: a 2-layer Transformer decoder over a 2,101-token vocabulary. Khmer is written as character clusters (a consonant with its subscripts and vowels), which makes Khmer sequences about 43% shorter.

Blockwise parallel decoding

One step of blockwise parallel decoding (Stern et al., 2018). A small proposal head guesses the next 4 tokens; the decoder checks all of them in one parallel pass, keeps the guesses it agrees with, and adds its own token where it first disagrees. Every kept token is one greedy decoding would also write, so the output is identical.

On KHOB (325 lines) in PyTorch:

DecoderCERms per lineTokens per stepSpeed-up
Autoregressive1.1717.6011.00×
Blockwise, 4 proposed1.1711.352.71.55×

The ONNX models in this repo cache the decoder's keys and values, which makes each pass cheap, so there both decoders run at about the same speed (see Parity and speed).

Try the app

The Docker image bundles every model in this repo with a browser editor. It rebuilds each page as it looked (pictures, seals, columns, alignment and font sizes), lets you correct any block, and exports Word, HTML, Markdown, JSON or plain text. Files never leave your machine.

docker run -d --name netra-ocr -p 8000:8000 -v netra-data:/data ghcr.io/netra-ai-lab/netra-ocr
# then open http://localhost:8000

A scanned Khmer press release (left, detected blocks outlined) and the editable page the app rebuilt from it (right), in version 1.3.1 on the CPU.

Models in this repo

The models behind the Netra OCR app, exported to ONNX. Each folder holds the ONNX graphs plus a netra-model.json config with the settings the app's pre- and post-processing need (line height and chunk width, decoder shape, class names, thresholds). The netra-ocr package runs them on ONNX Runtime on CPU and CUDA, and its web/ folder runs the same files in the browser (WebGPU / WebAssembly), with no PyTorch.

Each folder is one model:

FolderTaskWhat it isDownloadVariants
recognition/text recognitionKhmer + English line recognizer, 19M params, greedy decoding with a KV cache41 MB–
recognition-blockwise/text recognitionthe same recognizer plus a blockwise proposal head (same output, fewer decoder passes)44 MB–
lines/object detectionYOLO text-line and logo detector38 MB (19 MB on CUDA)fp16 (CUDA default)
layout/object detectionDocLayout-YOLO (DocStructBench) page-layout analyzer39 MBfp16 (CUDA default)

A full page pipeline on the CPU downloads about 118 MB. The recognizers' and the layout model's weights are stored in half precision and cast back to float32 when the model loads, so they run in float32 at the same speed; only the weights' rounding changes. On 325 test lines, the text matches the float32 files on 325/325 lines on the CPU and 321/325 on CUDA (on the other 4, the number of errors against the labels is unchanged). The layout model gives identical pages. The line detector stays float32, because half-precision storage moved boxes on 2 of 10 test pages.

Usage

pip install "netra-ocr[cpu]"     # or [gpu] for CUDA
from netra_ocr.inference import Detector, Recognizer

recognizer = Recognizer("hf://Netra-Lab/Netra-OCR/recognition")   # device: "auto" (default), "cpu", "cuda"
print(recognizer("line.png").text)

detector = Detector("hf://Netra-Lab/Netra-OCR/lines")
for box in detector("page.png"):
    print(box.label, box.score, box.box)
// web/src/index.js in the Netra-OCR repo
import { loadRecognizer } from "./web/src/index.js";
const recognizer = await loadRecognizer("hf://Netra-Lab/Netra-OCR/recognition");
const { text } = await recognizer.recognize(imageElement);

hf:// downloads only the folder you ask for, and only the files your device runs, once, into the Hugging Face cache. For whole pages (detection, layout, reading order, Word/HTML/Markdown export) use netra_ocr.KhmerOCRPipeline, the netra_ocr serve web app or the Netra OCR Docker image.

Parity and speed

Measured against the PyTorch models on test_set/khob_eval (325 lines) and 10 test pages, on an i7-13700KF and an RTX 3060.

  • Recognizer: text identical to PyTorch greedy decoding on 325/325 lines, on CPU and CUDA, single and batched. Per line: CPU 36.7 → about 13 ms, CUDA 23 → 12.8 ms.
  • Blockwise: identical text, 2.32 tokens per decoder pass. Not faster than the KV-cached greedy decoder on CPU, CUDA or WebGPU (82 vs 85 ms per line in Chrome).
  • Full page pipeline: CPU 2.18 → 1.14 s/page, GPU 1.24 → 0.70 s/page. 7 of 10 pages identical to the PyTorch pipeline, 0.43% characters different overall (the letterbox resize is Netra OCR's own float64 bilinear resize rather than OpenCV's, which moves about 1% of borderline boxes).
  • fp16: default on CUDA for the detectors (DocLayout 65 → 39 ms). Not used on WebGPU, where it is broken in onnxruntime-web 1.31.
  • Browser: WebAssembly gives the same text on 325/325 lines and detector boxes at IoU 1.0; WebGPU in Chrome gave the same text on 100/100 lines.

The recognizer's CER is the PyTorch model's: see the results.

PyTorch checkpoints

pytorch/ holds the recognizer the ONNX folders were exported from, for fine-tuning and research. The app doesn't download it.

FileContents
pytorch/khmerocr_cluster_ar.pththe recognizer (cluster vocabulary, autoregressive decoder), exported as recognition/
pytorch/khmerocr_cluster_blockwise.pththe same model plus the blockwise proposal head, exported as recognition-blockwise/
pytorch/char2idx_cluster.jsontheir vocabulary

To fine-tune on your own text lines, from a clone of the GitHub repo:

bash training/setup.sh
bash training/finetune.sh my_lines/ --name my-model     # starts from pytorch/khmerocr_cluster_ar.pth
bash training/export.sh training/runs/my-model/best.pth

See training/README.md.

Files

FileContents
*/netra-model.jsonconfig: pre/post-processing settings, graphs, precision variants, sha256 of every file
*/*.onnxopset-18 graphs (encoder/decoder_step for recognition, model for detection)
recognition*/vocab.jsontokenizer vocabulary (class names of the detectors are in the config)

The Python reader is netra_ocr/inference/; the exporters are in training/netra_ocr_train/scripts/.

Training data and test sets

The recognizer was trained only on synthetic lines:

It was tested on Netra-Lab/khob-eval (325 real lines, cropped from the Khmer OCR Benchmark by EKYC Solutions) and Netra-Lab/khmer-printed-words (short words in 10 fonts).

Learn more

READMEThe project overview: quick start, install, usage and limitations
UsageEvery detector, decoder, output format and option, and the REST API
ArchitectureChunking, the SE network, the BiLSTM, decoding and tokenisation
ResultsThe full benchmark and the decoder comparison
TrainingFine-tuning, training, evaluating and exporting the recognizer
PaperA Squeeze-and-Excitation Transformer Network for Khmer Optical Character Recognition
IssuesBug reports and questions

License and attribution

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · onnx

Нельзя запустить

В репозитории нет config.json: не понять архитектуру модели.

Ревизия весов
0587daf

0 моделей