Dear List members,

We are happy to announce mitra-sanskrit-ocr, a freely available OCR model for printed Sanskrit:

https://huggingface.co/buddhist-nlp/mitra-sanskrit-ocr

The model is a fine-tune of Surya-OCR-2, an open OCR model by Datalab. It is the OCR engine behind the Dharmamitra OCR service (https://dharmamitra.org), where it can be used live without installing anything.

We trained the model on about 37,000 pages from 346 printed Sanskrit editions scanned on archive.org. Each page was aligned with an existing human-typed e-text of the same work, and the e-text corrected the OCR wherever an independent second OCR agreed with it.

We measured the model against a human-typed reference of a 1971 letterpress edition (24 pages, about 7,800 phonemes). Counting only the errors specific to each engine, the results are:

mitra-sanskrit-ocr: 69 errors
Surya-OCR-2 (unmodified): 92 errors
Google Cloud Vision: 115 errors
Chandra-OCR-2: 168 errors

On 60 pages from editions in Devanagari held out of training, the character error rate fell from 2.6% to 1.7%. Romanized Sanskrit (IAST) is read somewhat better than by the base model, and other content like English and Japanese is unaffected.

The model is small (0.8 billion parameters) and runs on a GPU with vLLM. For Apple Silicon Macs (M1 and later) and other machines without an NVIDIA GPU, there is a llama.cpp version:

https://huggingface.co/buddhist-nlp/mitra-sanskrit-ocr-gguf

Heavily damaged scans remain difficult, and on such pages the model may drop or repeat lines. It is not intended for manuscripts or for Tibetan.

We would be grateful for feedback, and especially for examples of pages where the model fails!

Best regards,

Sebastian, on behalf of the Dharmamitra team

--
Sebastian Nehrdich

Distinguished Assistant Professor 
Tohoku University
Center for Integrated Japanese Studies

東北大学 合日本学センター   
ディスティングイッシュトアシスタントプロフェッサー(助教)

〒980-8576
https://cijs.oii.tohoku.ac.jp/
sebastian-nehrdich.com 
✉️ nehrdich@tohoku.ac.jp
☎️ 022-795-3822