File size: 3,227 Bytes
9c0b13d d928246 9c0b13d d928246 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | ---
license: apache-2.0
library_name: pytorch
tags:
- ocr
- text-detection
- text-recognition
- easyocr
- craft
- safetensors
---
# EasyOCR weights (CRAFT detector and English recogniser) in safetensors
The two pretrained models the [EasyOCR](https://github.com/JaidedAI/EasyOCR) `en` reader uses, converted from the
official `.pth` files to `.safetensors`. Nothing was retrained or modified: every tensor is identical, in value and dtype,
to the original, and the key names (including the `module.` prefix) are unchanged.
| File | Model | Tensors | SHA-256 |
|---|---|---|---|
| `craft_mlt_25k.safetensors` | CRAFT text detector | 154 | `4ab7f69bd8161b437f18f1718b8f6e58136bd081639f238b567e987415c20268` |
| `english_g2.safetensors` | English recogniser (CRNN, "generation 2") | 44 | `307a47690148280d00e4314b1868ebce44089d0974903a56fe7822902d1b31d0` |
`SHA256SUMS` lists the same values: `sha256sum -c SHA256SUMS`.
## Origin
Converted from the official EasyOCR release assets (EasyOCR's own MD5 values in `easyocr/config.py` are shown):
| Original | Release asset | MD5 of the original `.pth` |
|---|---|---|
| `craft_mlt_25k.pth` | https://github.com/JaidedAI/EasyOCR/releases/download/pre-v1.1.6/craft_mlt_25k.zip | `2f8227d2def4037cdb3b34389dcf9ec1` |
| `english_g2.pth` | https://github.com/JaidedAI/EasyOCR/releases/download/v1.3/english_g2.zip | `5864788e1821be9e454ec108d61b887d` |
Conversion: `torch.load(..., weights_only=True)` of the state dict, then `safetensors.torch.save_file`. The saved file was
loaded back and compared tensor by tensor with the original (all equal). An EasyOCR reader fed these tensors returned the
same boxes, text and confidences as the original reader on the test images it was checked with (CPU).
## Use
These are state dicts, not a ready `easyocr.Reader` folder: EasyOCR itself only looks for MD5-checked `.pth` files, so the
detector and recogniser have to be built from the state dicts by the caller.
```python
from safetensors.torch import load_file
craft = load_file("craft_mlt_25k.safetensors") # CRAFT state dict (keys start with "module.")
recog = load_file("english_g2.safetensors") # recogniser state dict (keys start with "module.")
```
## Licence and attribution
The files are redistributed under the licences of the projects they come from. Keep these notices with them.
- **EasyOCR**, JaidedAI: Apache License 2.0. https://github.com/JaidedAI/EasyOCR
- **CRAFT** (`craft_mlt_25k`), Clova AI Research, NAVER Corp.: MIT License. https://github.com/clovaai/CRAFT-pytorch.
Paper: Baek et al., "Character Region Awareness for Text Detection", CVPR 2019 (https://arxiv.org/abs/1904.01941).
EasyOCR ships Clova AI's pretrained CRAFT model.
- **Recognition training pipeline**, a modified version of `clovaai/deep-text-recognition-benchmark`: Apache License 2.0.
https://github.com/clovaai/deep-text-recognition-benchmark. Model architecture: CRNN (Shi et al., 2015).
The upstream projects publish licences for their code. The weight files carry no separate licence statement that was found,
so they are assumed to follow the repositories above. This repository is an unofficial conversion and is not affiliated
with JaidedAI or Clova AI.
|