benito47's picture
Update README.md
ff65f98 verified
|
Raw
History Blame Contribute Delete
2.94 kB
---
license: mit
---
# Introduction
This repository hosts the [EasyOCR](https://github.com/JaidedAI/EasyOCR) models — the
[CRAFT detector](https://github.com/clovaai/CRAFT-pytorch) and the [CRNN recognizer](https://www.jaided.ai/easyocr/modelhub/) — for the
[React Native ExecuTorch](https://www.npmjs.com/package/react-native-executorch) library,
exported to `.pte` for the **ExecuTorch** runtime (XNNPACK, CoreML and Vulkan backends).
If you'd like to run these models in your own ExecuTorch runtime, refer to the
[official documentation](https://pytorch.org/executorch/stable/index.html) for setup instructions.
Each language ships as **one fused `.pte`** (CRAFT *detect* + CRNN *recognize* in a single
file) per backend, using **static bucketed methods** — no dynamic-shape footguns. The `.pte`
is a pure tensor→tensor function; all pre/post-processing (resize, normalize, box extraction,
crop, CTC decode) is the client's job and is driven by `config.json`.
## Languages
| code | charset size | code | charset size |
|---|---|---|---|
| english | 96 | korean | 1008 |
| latin | 351 | telugu | 165 |
| japanese | 2214 | kannada | 167 |
| zh_sim | 6718 | cyrillic | 207 |
All languages share the same CRAFT detector and CRNN architecture — they differ **only** in
the recognizer charset. The detector half of each fused PTE is identical across languages.
## Backends
| backend | target | precision |
|---|---|---|
| `xnnpack` | CPU (Android/iOS) | int8 (CRAFT + CRNN) |
| `coreml` | Apple ANE | weight-only int8 |
| `vulkan` | Android GPU | CRAFT int8 (GPU) + CRNN int8 (XNNPACK, mixed-delegate) |
## Files
```
config.json # shared base config (schema v1)
charsets/easyocr_<lang>.charset.txt # per-language CTC charset (JSON array)
<lang>/<backend>/easyocr_<lang>_<backend>_bucketed.pte
```
- `config.json` is **shared** across all languages; it carries
`charsetUrlPattern: "easyocr_<lang>.charset.txt"` so the client resolves the charset by
language. Charset index `i` maps to logit `i + 1` (logit `0` is the CTC blank).
## Buckets
Static per-size methods (`is_bucketed()` reports `[detect sides ; recognize widths]`):
- **detect** (square sides): `800, 1280``detect_800`, `detect_1280` (+ a `1280×320` portrait method)
- **recognize** (widths, height 64): `64, 128, 256, 512``recognize_64 … recognize_512`
`detect` runs once per image; `recognize` runs once per text line.
## Compatibility
If you intend to use these models outside of React Native ExecuTorch, make sure your runtime is
compatible with the **ExecuTorch** version used to export the `.pte` files. For more details, see
the compatibility note in the
[ExecuTorch GitHub repository](https://github.com/pytorch/executorch/blob/main/runtime/COMPATIBILITY.md).
If you work with React Native ExecuTorch, the library constants guarantee compatibility with the
runtime used behind the scenes.