/ Модель

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

Библиотека
pytorch
Опубликована
31 окт 2026

moroccan-darija-ocr

Описание изображенийИзображение → текст5 профессий
171скачиваний за 30 дней1лайквеса обновлены2 дек 2026

Описание модели

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

Небольшая CNN-BiLSTM-CTC модель распознаёт печатный арабский текст на изображениях отдельных строк, но не обучалась на марокканской даридже.

Модель sailu4/moroccan-darija-ocr — чекпойнт распознавания печатных строк арабского текста, разработанный как базовая модель для проекта Moroccan Darija OCR. Она принимает уже обрезанные изображения отдельных строк и преобразует их в текст; для распознавания целой страницы нужны отдельные этапы обнаружения строк и восстановления порядка чтения. Архитектура состоит из сверточной нейронной сети для обработки изображений в оттенках серого, двухслойной двунаправленной LSTM и классификатора CTC. Модель содержит около 1,94 млн параметров, поддерживает 92 символьных класса и рассчитана на входы высотой 64 пикселя и шириной до 1600 пикселей.

Чекпойнт обучен на изображениях строк печатного текста из «Официального вестника Марокко». На фиксированной тестовой выборке из 1 212 строк авторы сообщают CER 1,49%, WER 6,94% и точность полного совпадения строки 51,65% при жадном CTC-декодировании без языковой модели. Эти результаты относятся к печатному арабскому тексту вестника, а не к марокканской даридже: модель не обучалась на дариже, и синтетические эксперименты с дарижей не являются оценкой на реальных документах. В репозитории приведён формат PyTorch; лицензия модели в предоставленных данных не установлена.

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

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

Ограничения

Модель не обучалась на дариже, поэтому её показатели на печатном арабском тексте нельзя считать оценкой качества для дариджи. Она ожидает изображения отдельных строк; обработка полной страницы требует предварительного выделения строк и восстановления порядка чтения.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

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

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

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

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

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

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

Открыть на Hugging Face

Moroccan Arabic OCR — CNN + BiLSTM + CTC

This repository contains the trained line-recognition checkpoint from the companion project moroccan-darija-ocr.

📖 Documentation détaillée en français : ouvrir le Space du projet. Il réunit 15 chapitres, la recherche, les commandes, des exemples interactifs CNN/CTC, les résultats audités et le cours PDF de 32 pages.

The model was trained on Arabic printed text-line images from the Moroccan Official Gazette. It is an Arabic baseline for later Moroccan Darija adaptation; it was not trained on Darija and should not be presented as a Darija benchmark result.

Checkpoint

best.pt is a PyTorch checkpoint containing the model, vocabulary, optimizer state, scheduler state, AMP scaler state, and training configuration. The architecture is a grayscale CNN followed by a two-layer bidirectional LSTM and a CTC classifier. CTC blank index is 0; the vocabulary is in vocab.json.

Configuration: height 64, maximum input width 1600, hidden size 128, CNN channels 32, 92 character classes plus the CTC blank. The checkpoint has 1,940,797 parameters.

Reported evaluation

On the fixed 1,212-line official test split:

  • CER: 1.49%
  • WER: 6.94%
  • exact line accuracy: 51.65%

These are printed Arabic Gazette results, using greedy CTC decoding without a language model. They do not measure Darija performance. The full metrics and independent verification are included as metrics.json and verification.json.

Validation and training curves

Test metrics summary

Per-line CER distribution

Detailed CNN and CTC architecture

Test visualization

The executable test-gallery notebook is available at notebooks/03_test_images_transcriptions.ipynb. It displays test images with reference transcriptions, model predictions, and per-line CER. A generated gallery is available at test_artifacts/test_images_transcriptions_gallery.png.

Loading

import torch

checkpoint = torch.load("best.pt", map_location="cpu", weights_only=False)
print(checkpoint["characters"])
print(checkpoint["config"])

For inference and preprocessing, use the source code in the GitHub repository. The model expects already-cropped line images. A full page needs line detection and reading-order reconstruction before recognition.

Intended next step: Darija

AtlasOCR is audited in the GitHub repository. Its public rows expose page or paragraph images with text and metadata, but the inspected version does not expose reliable line boxes or line-level transcriptions. The adaptation tools therefore require vetted one-line image/transcription pairs and reject multiline text. AtlasOCRBench must remain a held-out evaluation set.

Synthetic Darija pipeline smoke test

A first reproducible subset of 5,000 DODa Arabic-script sentences was rendered with Arabic fonts and split into 4,500 training lines and 500 validation lines. After three RTX 5070 epochs, the synthetic validation reached 2.21% CER, 9.92% WER, and 61.4% exact-line accuracy. This experiment is stored under experiments/darija_synthetic_v2 and is a pipeline check only; it is not a real-document Darija benchmark.

A filtered Atlas-text run is also available under experiments/atlas_synthetic_filtered. It uses 5,329 rendered lines after foreign-script filtering and reaches 6.63% CER, 15.01% WER, and 15.20% exact-line accuracy after three RTX 5070 epochs. It is still synthetic pre-training data, not real-document evaluation.

Local demo and experiment audit

The companion repository now provides a shared line/page recognizer and an optional local Gradio interface. The usage guide covers installation, loading this repository's checkpoints, single-column page OCR and JSON/TXT exports. CPU and RTX 5070 inference and both Gradio modes were checked with the mixed checkpoint; a three-line composed fixture is a functional smoke test only, not a real-document benchmark.

An audit of historical experiments identified changing validation memberships between augmentation runs, shared Atlas source paragraphs across mixed train/validation, and omitted vowel marks in historical synthetic rendering. Historical Darija metrics are exploratory. The corrected generator groups source pages, fixes validation rendering and preserves vowel marks. These corrections apply to newly generated corpora; no existing checkpoint was retrained in this update.

French theory and implementation course

A complete French course explains CNNs, BiLSTMs, CTC alignment, Arabic rendering, data isolation, GPU training, evaluation and page inference using this project's actual code. The 32-page PDF includes 12 worked exercises and 10 interview questions. Historical experiment limitations are explained alongside the results.

Data and attribution

The baseline data source is the Moroccan Official Gazette line-image corpus, Zenodo DOI 10.5281/zenodo.21702529, announced under CC BY 4.0. See the GitHub repository for the complete audit, preparation code, limitations, and attribution details.

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

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

GPU в ailist

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

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

Архитектура ? неизвестна transformers в образе рантайма.

Ревизия весов
112669f

0 моделей