Card: the PyTorch checkpoints in pytorch/, images from this repo
Browse files
README.md
CHANGED
|
@@ -16,7 +16,7 @@ tags:
|
|
| 16 |
---
|
| 17 |
|
| 18 |
<p align="center">
|
| 19 |
-
<img src="https://huggingface.co/
|
| 20 |
</p>
|
| 21 |
|
| 22 |
<hr>
|
|
@@ -24,7 +24,7 @@ tags:
|
|
| 24 |
<p align="center">
|
| 25 |
<a href="https://github.com/netra-ai-lab/Netra-OCR"><b>GitHub</b></a> |
|
| 26 |
<a href="https://pypi.org/project/netra-ocr/"><b>PyPI</b></a> |
|
| 27 |
-
<a href="https://huggingface.co/
|
| 28 |
</p>
|
| 29 |
|
| 30 |
# Netra OCR
|
|
@@ -78,7 +78,27 @@ Measured against the PyTorch models on `test_set/khob_eval` (325 lines) and 10 t
|
|
| 78 |
- **fp16:** default on CUDA for the detectors (DocLayout 65 → 39 ms). Not used on WebGPU, where it is broken in onnxruntime-web 1.31.
|
| 79 |
- **Browser:** WebAssembly gives the same text on 325/325 lines and detector boxes at IoU 1.0; WebGPU in Chrome gave the same text on 100/100 lines.
|
| 80 |
|
| 81 |
-
The recognizer's CER is the PyTorch model's: see [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
## Files
|
| 84 |
|
|
@@ -92,6 +112,6 @@ The Python reader is [`netra_ocr/inference/`](https://github.com/netra-ai-lab/Ne
|
|
| 92 |
|
| 93 |
## License and attribution
|
| 94 |
|
| 95 |
-
- **`recognition/`, `recognition-blockwise/`:** MIT. Trained by Netra Lab; the training data includes [SoyVitou/KhmerSynthetic1M](https://huggingface.co/datasets/SoyVitou/KhmerSynthetic1M), whose terms restrict use to research — check them before commercial use.
|
| 96 |
- **`lines/`:** AGPL-3.0, as a model trained with Ultralytics YOLO.
|
| 97 |
- **`layout/`:** Apache-2.0. Converted from [juliozhao/DocLayout-YOLO-DocStructBench](https://huggingface.co/juliozhao/DocLayout-YOLO-DocStructBench) by [opendatalab/DocLayout-YOLO](https://github.com/opendatalab/DocLayout-YOLO); please cite their paper.
|
|
|
|
| 16 |
---
|
| 17 |
|
| 18 |
<p align="center">
|
| 19 |
+
<img src="https://huggingface.co/Netra-Lab/Netra-OCR/resolve/main/assets/header.png" width="260" alt="Netra Lab" />
|
| 20 |
</p>
|
| 21 |
|
| 22 |
<hr>
|
|
|
|
| 24 |
<p align="center">
|
| 25 |
<a href="https://github.com/netra-ai-lab/Netra-OCR"><b>GitHub</b></a> |
|
| 26 |
<a href="https://pypi.org/project/netra-ocr/"><b>PyPI</b></a> |
|
| 27 |
+
<a href="https://huggingface.co/Netra-Lab/Netra-OCR/tree/main/pytorch"><b>PyTorch weights</b></a>
|
| 28 |
</p>
|
| 29 |
|
| 30 |
# Netra OCR
|
|
|
|
| 78 |
- **fp16:** default on CUDA for the detectors (DocLayout 65 → 39 ms). Not used on WebGPU, where it is broken in onnxruntime-web 1.31.
|
| 79 |
- **Browser:** WebAssembly gives the same text on 325/325 lines and detector boxes at IoU 1.0; WebGPU in Chrome gave the same text on 100/100 lines.
|
| 80 |
|
| 81 |
+
The recognizer's CER is the PyTorch model's: see the [results](https://github.com/netra-ai-lab/Netra-OCR/blob/master/docs/RESULTS.md).
|
| 82 |
+
|
| 83 |
+
## PyTorch checkpoints
|
| 84 |
+
|
| 85 |
+
`pytorch/` holds the recognizer the ONNX folders were exported from, for fine-tuning and research. The app doesn't download it.
|
| 86 |
+
|
| 87 |
+
| File | Contents |
|
| 88 |
+
|---|---|
|
| 89 |
+
| `pytorch/khmerocr_cluster_ar.pth` | the recognizer (cluster vocabulary, autoregressive decoder), exported as `recognition/` |
|
| 90 |
+
| `pytorch/khmerocr_cluster_blockwise.pth` | the same model plus the blockwise proposal head, exported as `recognition-blockwise/` |
|
| 91 |
+
| `pytorch/char2idx_cluster.json` | their vocabulary |
|
| 92 |
+
|
| 93 |
+
To fine-tune on your own text lines, from a clone of the [GitHub repo](https://github.com/netra-ai-lab/Netra-OCR):
|
| 94 |
+
|
| 95 |
+
```bash
|
| 96 |
+
bash training/setup.sh
|
| 97 |
+
bash training/finetune.sh my_lines/ --name my-model # starts from pytorch/khmerocr_cluster_ar.pth
|
| 98 |
+
bash training/export.sh training/runs/my-model/best.pth
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
See [training/README.md](https://github.com/netra-ai-lab/Netra-OCR/blob/master/training/README.md).
|
| 102 |
|
| 103 |
## Files
|
| 104 |
|
|
|
|
| 112 |
|
| 113 |
## License and attribution
|
| 114 |
|
| 115 |
+
- **`recognition/`, `recognition-blockwise/`, `pytorch/`:** MIT. Trained by Netra Lab; the training data includes [SoyVitou/KhmerSynthetic1M](https://huggingface.co/datasets/SoyVitou/KhmerSynthetic1M), whose terms restrict use to research — check them before commercial use.
|
| 116 |
- **`lines/`:** AGPL-3.0, as a model trained with Ultralytics YOLO.
|
| 117 |
- **`layout/`:** Apache-2.0. Converted from [juliozhao/DocLayout-YOLO-DocStructBench](https://huggingface.co/juliozhao/DocLayout-YOLO-DocStructBench) by [opendatalab/DocLayout-YOLO](https://github.com/opendatalab/DocLayout-YOLO); please cite their paper.
|