--- language: - smp - sam license: apache-2.0 library_name: kraken tags: - ocr - htr - handwriting-recognition - ppocrv6 - hebrew - samaritan - safetensors - oxygraphos-ocr pipeline_tag: image-to-text base_model: - PaddlePaddle/PP-OCRv6 datasets: - johnlockejrr/sam_44_mss_pango_metadata --- # PP-OCRv6 Samaritan Hebrew recognizers Line-level **text recognition** models for Samaritan Hebrew manuscripts, trained with kraken’s PP-OCRv6 port (`ketos train --arch ppocrv6`) and usable with [oxygraphos-ocr / Ppocrv6-OCR](https://github.com/johnlockejrr/oxygraphos-ocr) (`ppocrv6-ocr`) or stock kraken ≥ 7.0. These are **recognizers only** (line crops / baseline polygons). Pair with a page segmenter for full-page OCR. ## Files | File | Variant | Val char accuracy* | Codec | Size (approx.) | Notes | |------|---------|--------------------|-------|----------------|-------| | `ppocrv6_sam_heb_small.safetensors` | `small` | 0.9872 | 28 Hebrew letters + space | ~12 MB | From scratch | | `ppocrv6_sam_heb_medium.safetensors` | `medium` | 0.9877 | 28 Hebrew letters + space | ~60 MB | From scratch | | `ppocrv6_sam_heb_medium_ft.safetensors` | `medium` | 0.9886 | ~1622 chars (multilingual head retained) | ~61 MB | Fine-tuned from a multilingual PP-OCRv6 checkpoint | \*Accuracy is the kraken checkpoint score embedded in the original `best_*.safetensors` filename (validation character accuracy). **Default recommendation:** `ppocrv6_sam_heb_medium_ft.safetensors` for best accuracy on this domain. Use `small` when latency / footprint matters. Prefer the Hebrew-only `small` / `medium` codecs if you want a locked Samaritan alphabet (no Latin / punctuation emissions). ## Model details | | | |--|--| | Architecture | `PPOCRv6Model` (kraken), task `recognition` | | Input | RGB line images, target height **96**, baseline / polygon-dewarped lines (`seg_type: baselines`) | | Normalization | NFD + whitespace normalize; BiDi reordering enabled at train time | | Data | Samaritan Hebrew PAGE-XML line corpus (`sam_44_mss_pango` / additional split), compiled to binary Arrow | | Min kraken | 7.0.0 (`_kraken_min_version` in metadata) | Codec is stored inside each `.safetensors` file under `kraken_meta` — no sidecar alphabet file is required. ## Usage ### Download ```bash hf download johnlockejrr/ppocrv6-sam-heb ppocrv6_sam_heb_medium_ft.safetensors --local-dir ./models ``` ### oxygraphos-ocr / ppocrv6-ocr ```bash ppocrv6-ocr -d cuda:0 infer \ -m ./models/ppocrv6_sam_heb_medium_ft.safetensors \ -f page --output-dir ./out page.xml ``` ### kraken ```bash kraken -i line.png text.txt ocr -m ./models/ppocrv6_sam_heb_medium_ft.safetensors ``` ## Intended use - Samaritan Hebrew manuscript line recognition (square Hebrew Unicode) - Offline HTR pipelines that already produce line polygons / crops ## Limitations - Not a page layout / line detector - Trained on this manuscript family; other hands / scripts may need fine-tuning - `medium_ft` retains a large multilingual output vocabulary; greedy decoding can occasionally emit non-Hebrew symbols on ambiguous lines - Hebrew-only `small` / `medium` cannot emit characters outside their 28-letter (+ space) codec ## Training summary - Trainer: kraken `ketos` / PP-OCRv6 (`AdamW+Muon`, cosine schedule, bf16-mixed) - Augmentation on; `--base-dir R` / RTL-aware setup for Hebrew - `medium` / `small`: trained from scratch on the Samaritan binary dataset - `medium_ft`: fine-tuned from a multilingual medium checkpoint onto the same data (lower LR); final weights keep the large pretrained codec ## Citation / credits - PP-OCR / PP-OCRv6: [PaddlePaddle/PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) - kraken PP-OCRv6 port: [mittagessen/kraken](https://github.com/mittagessen/kraken) - Packaging: [johnlockejrr/oxygraphos-ocr](https://github.com/johnlockejrr/oxygraphos-ocr) (`Ppocrv6-OCR`) ## License Apache-2.0 (weights and card). Upstream PaddleOCR / kraken licenses still apply to those codebases.