/ Модель

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

Лицензия
Своя лицензия
Опубликована
7 ноя 2026

Bina-0.4-Rizeh

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

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

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

Бенчмарки

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

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

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

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

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

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

Bina 0.4 Rizeh — небольшая и быстрая система OCR для персидского языка от Reza2kn. Она обрабатывает целые страницы и отдельные изображения документов: печатный текст, обычный почерк, формы, снимки экрана, письма и газеты. Пайплайн примерно на 71 млн параметров объединяет детектор строк на архитектуре Surya, CTC-распознаватели строк и этапы восстановления порядка чтения; для компоновки использует модель Surya Layout, загружаемую при первом запуске. В репозитории есть форматы ONNX и safetensors.

Модель рассчитана прежде всего на распознавание персидского текста и может читать латиницу и цифры, хотя другие языки не были целью разработки. Для страниц она выдаёт текст в порядке чтения и JSON с распознанными строками, координатами, типом слоя и оценкой уверенности. Авторы приводят результаты проверки на 193 фрагментах, но отмечают, что набор не был независимым тестом. Лицензия указана как other; входящие в пайплайн компоненты сохраняют условия своих издателей, включая CC-BY-NC-SA-4.0 для модели таблиц, поэтому условия использования следует проверять для каждого компонента.

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

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

Ограничения

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

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

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

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

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

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

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

Открыть на Hugging Face

Bina 0.4 Rizeh

Bina 0.4 Rizeh is the small, fast member of the Bina 0.4 Persian OCR family. It reads whole pages (printed text, handwriting, forms, screenshots, letters, newspapers and simple math). Its core is about 71M parameters: a 38.5M line detector (fine-tuned Surya text detector) and a 32.8M CTC line recognizer distilled from Bina 0.4 Koochik. They run inside a page pipeline:

  1. Layout: Surya layout (datalab-to/surya_layout2, pinned revision, downloaded on first run).
  2. Lines: fine-tuned Surya-architecture line detectors (body text, printed layer, handwriting page path).
  3. Reading: the 95k-step Indra CTC student for body text, plus specialist readers with the same architecture: printed/form labels, short form cells, numeric and math, and degraded scans.
  4. Assembly: row consolidation, column and table ordering, printed-label admission and page-level ordering.

This repository bundles the production recognizers, specialist weights, calibration data and runtime code. The 2026-11-24 public-runner repair restores omitted crop/table helpers and exposes the input modes used by the historical pipeline. The reproducible original193 result below was measured with the repaired public image-only pipeline.

Quick run

hf download Reza2kn/Bina-0.4-Rizeh --local-dir Bina-0.4-Rizeh
cd Bina-0.4-Rizeh
pip install -r requirements.txt          # Python 3.10, NVIDIA GPU recommended
python setup_table_runtime.py             # isolated CPU table helper; pinned weights
python rizeh.py examples/demo.png --out results
python rizeh.py scan1.jpg scan2.png document.pdf --out results

The first run binds the bundled paths to your checkout (it edits the bundled text files in place, and reruns automatically if you move the folder) and downloads the pinned Surya layout model. For each page you get <name>.txt with the page text in reading order, and <name>.json with every line's text, box, layer (printed / handwriting / body) and confidence. PDFs are rendered at 200 dpi.

From Python:

from PIL import Image
from rizeh import Rizeh
ocr = Rizeh("cuda")
result = ocr(Image.open("page.jpg").convert("RGB"))
print(result["text"])

Reproduce the public 193-crop result (2026-11-24)

On Reza2kn/persian-ocr-bench-submitted10-bbox-crops revision 906b97fb1225d77003584e8f082da6f41d1a0618, the repaired public pipeline completed 193/193 with 87.55% mean normalized similarity, 21.27% corpus CER and 36.83% corpus WER. The earlier archived development predictions, rescored with the same original references/scorer, were 87.52%, 21.43% and 37.14% respectively. The unrepaired public page-only run scored 80.04% similarity. These numbers compare OCR pipelines; the recognizer and specialist weights are unchanged.

python benchmark_submitted10.py --device cuda --out submitted10-results

The script verifies every original PNG against benchmark_manifest.jsonl, runs all 193 inputs with crop mode, automatic pixel-derived table routing and automatic column ordering, then downloads reference text only after inference completes. It uses the original gold labels, original normalizer, and unclipped corpus CER/WER. It never reads benchmark categories, reference boxes, archived predictions, or filename hints for inference. validation/submitted10-public-repair.json and validation/submitted10-public-predictions.jsonl contain the receipt and predictions. This repeatedly used development benchmark is not an untouched held-out test set.

For cropped regions in your own documents:

python rizeh.py region.png --input-type crop --out results

--input-type auto is the new default; page preserves explicit whole-page handling. --content-type newspaper|table|text|math and --table-column-order ltr|rtl|auto are optional caller-supplied settings for known document types/conventions. The reported public score uses content-type auto and table-column-order auto uniformly, with no per-image metadata. Renaming an input does not change routing.

The restored dedicated table model uses Surya 0.17.0 / Transformers 4.57.1 on CPU, isolated from the main Surya 0.22.1 / Transformers 5 runtime. Its model files are downloaded from the publisher and SHA-256 checked before loading. Missing or broken helpers now raise a clear error; successful results include table-call and routing diagnostics. Helpers require Python 3.10-3.12; if your shell uses another version, run python setup_table_runtime.py --python python3.10. Runtime/model downloads happen during setup or first use; OCR itself runs locally. The table checkpoint retains its publisher's CC-BY-NC-SA-4.0 license; the layout model retains its publisher terms.

Historical internal-gate scores

The historical gate below used corrected-v3 references, convention transforms and clipped per-crop errors for the 193-crop view. Its 9.39% CER is not the original193 corpus CER and must not be mixed into the public comparison above. Other gates retain their original evaluation contracts. Lower CER is better.

GateCER
193 cropped regions, overall9.39
· forms3.80
· screenshots4.65
· prose9.15
· math12.09
· newspaper13.49
· tables19.63
50 handwriting pages, handwritten body only3.97
50 handwriting pages, full page incl. printed form text10.89
338 printed lines1.76
7 real scanned documents (printed regions)10.61
Scanned official letter2.12

Persian OCR Triple Threat, same 95k recognizer, measured 2026-11-03 before the final assembly fixes (lower is better):

SplitRowsWERCERS³Triple Threat
Printed6,6694.701.375.884.74
Handwriting6,66918.4813.0115.1915.41
Equal-split overall13,33811.597.1910.5410.08

Limitations

  • Historical manuscripts do not work. On HPHD (historical nastaliq and shekasteh manuscripts) the recognizer is at 67% CER even on oracle line crops, and full pages come out as fluent-looking nonsense. Do not use it for manuscripts.
  • Tables are weak (about 20% CER), especially dense or low-resolution tables with handwriting over the cells.
  • Reading order on busy layouts (multi-column newspapers, exam sheets with many labels) is the largest remaining error source; the characters are usually right but lines can come out in a different order.
  • Faint or coloured printed labels (light-blue Nastaliq on forms) are often missed.
  • The pipeline has many stages tuned together. Swapping one component (for example a newer recognizer) without retuning the stages after it makes results worse; this was measured, not assumed.
  • Persian-first. Latin text and digits are read, but other languages were not a goal.
  • Confidences are model scores, not calibrated probabilities.

Training and provenance

  • Recognizer: Indra CTC, 32,796,250 parameters, 20 blocks, 1,617-symbol vocabulary; 95,000 training steps, distilled from Bina 0.4 Koochik checkpoint 18,404.
  • Specialist readers (printed labels, form cells, numeric/math, degraded scans) are 32.8M fine-tunes of the same recognizer; the two line detectors are 38.5M fine-tunes of Surya's text detector, and the printed-text head adds 0.39M.
  • Checkpoint selection used internal development sets only; the gates above were never used to pick weights.
  • model.safetensors holds the two core networks (recognizer.*, 32.8M, and line_detector.*, 38.5M) in safetensors form for reuse and fine-tuning. rizeh.py runs from the original files under stallion/, which contain the same weights.
  • MANIFEST.json lists every bundled file with its original location and size. Under stallion/ the files are organized by experiment directory exactly as they ran in production; rizeh.py is the entry point.

License

Bina recognizer weights and code: CC BY-NC 4.0, matching the non-commercial training data. Line-detector weights are fine-tunes of Surya (datalab) detection weights, and the Surya layout model is downloaded from datalab; both stay under Surya's model license, which limits commercial use.

فارسی

بینا ۰٫۴ ریزه عضو کوچک و سریع خانواده OCR فارسی بینا ۰٫۴ است. یک مدل CTC با ۳۲٫۸ میلیون پارامتر که از بینا ۰٫۴ کوچیک تقطیر شده، درون یک خط‌لوله کامل صفحه کار می‌کند: چیدمان صفحه، تشخیص خط، خواندن متن چاپی و دست‌نویس، فرم‌ها، اعداد و چیدن متن به ترتیب خواندن.

pip install -r requirements.txt
python setup_table_runtime.py
python rizeh.py page.jpg --out results

محدودیت مهم: روی نسخه‌های خطی تاریخی (نستعلیق و شکسته قدیمی) قابل استفاده نیست، و جدول‌ها و ترتیب خواندن صفحه‌های شلوغ هنوز ضعیف‌اند.

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

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

GPU в ailist

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

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

Не удалось определить, чем загружать веса модели (нет library_name и architectures).

Ревизия весов
062b15c

0 моделей