Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ocr-models

On-device OCR ("Copy text") models for Photos for Proton, the unofficial Proton Drive Photos client for Android.

The app reads text from a photo entirely on the device, with no network calls and no cloud service. These are the model files it loads. They are PaddleOCR PP-OCRv5 models, exported to ONNX, and are published here as release assets so every app version that expects these exact bytes points at the same immutable files.

What is here

Published as release assets (not in the repository tree), verified by size and SHA-256:

File What it does Size (bytes) SHA-256
det.onnx Detection: finds where the words are 4748769 d7fe3ea74652890722c0f4d02458b7261d9f5ae6c92904d05707c9eb155c7924
cls.onnx Classification: whether a line is upside down 582663 f4bb53707100c5f3d59ba834eb05bb400369f20aed35d4b26807b1bfadd2a70e
rec_latin.onnx Recognition: turns a line into characters (Latin script) 8064539 995b0f5f28d2073896a78c03b5b863eae6af3744bafa0245b8522beea6994927
ppocrv5_latin_dict.txt The alphabet the recogniser emits 2616 ccbcc45730b3fbbd9050c5bc74db6a99067141ef1035e3d14889a84a6b9b1aff

The recognition model is the Latin-script PP-OCRv5 recogniser (45 Latin-script languages, including Hungarian), rather than the full multilingual one. Its alphabet is small (836 characters plus the CTC blank and a space, 838 output classes), which makes it more accurate on Latin text and lets it read the full accent set, including the Hungarian double-acute letters that the multilingual dictionary does not contain.

Input for the recogniser is [N, 3, 48, W], BGR, normalised to [-1, 1]; the output is [N, T, 838], decoded with CTC greedy argmax against the dictionary.

License

Everything here is under the Apache License 2.0 (see LICENSE and NOTICE).

The models and the dictionary are from PaddleOCR, Copyright (C) PaddlePaddle Authors, licensed under Apache-2.0. The recognition and detection networks are redistributed here in ONNX format; the conversion is a format change only.

The ONNX conversion and this repository are by Akoos (https://akoos.eu), maintainer of Photos for Proton.

Reusing these files

You may use, modify and redistribute these files, including in your own apps and commercially, under the terms of the Apache License 2.0. Keep the LICENSE and NOTICE, and retain the attribution above. The SHA-256 values let anyone verify the exact bytes.

Reproducing rec_latin.onnx

The Latin recogniser is converted from the official PaddleOCR release. The script in convert/convert.sh downloads the upstream model, runs the conversion, downloads the dictionary and checks the results against the SHA-256 values above. It runs on Linux (a container, WSL or a plain machine) with Python 3.10 to 3.12.

cd convert
./convert.sh

det.onnx and cls.onnx are the PP-OCRv5 mobile detection and angle-classification models from the same PaddleOCR line; they are language-agnostic and are included as-is.

About

On-device OCR models (PaddleOCR PP-OCRv5, Apache-2.0) for Photos for Proton, exported to ONNX with a reproducible conversion script.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages