Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -6,34 +6,64 @@ tags:
|
|
| 6 |
- ocr
|
| 7 |
- pytorch
|
| 8 |
- handwritten
|
| 9 |
-
license:
|
| 10 |
datasets:
|
| 11 |
- mrrtmob/km_en_image_line
|
| 12 |
---
|
| 13 |
|
| 14 |
# Kiri OCR Model
|
| 15 |
|
| 16 |
-
|
| 17 |
-
Trained on the [mrrtmob/km_en_image_line](https://huggingface.co/datasets/mrrtmob/km_en_image_line) dataset.
|
| 18 |
|
| 19 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
```python
|
| 22 |
-
from kiri_ocr
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
ocr = OCR(
|
| 26 |
|
| 27 |
# Extract text
|
| 28 |
-
text, results = ocr.extract_text(
|
| 29 |
print(text)
|
| 30 |
```
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
## Model Details
|
| 33 |
-
- Architecture
|
| 34 |
-
- Framework
|
| 35 |
-
- Input Size
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
## Benchmarks
|
| 38 |

|
|
|
|
| 39 |

|
|
|
|
|
|
| 6 |
- ocr
|
| 7 |
- pytorch
|
| 8 |
- handwritten
|
| 9 |
+
license: apache-2.0
|
| 10 |
datasets:
|
| 11 |
- mrrtmob/km_en_image_line
|
| 12 |
---
|
| 13 |
|
| 14 |
# Kiri OCR Model
|
| 15 |
|
| 16 |
+
**Kiri OCR** is a lightweight, OCR library for **English and Khmer** documents. It provides document-level text detection, recognition, and rendering capabilities in a compact package (~13MB model).
|
|
|
|
| 17 |
|
| 18 |
+
## ✨ Key Features
|
| 19 |
+
|
| 20 |
+
- **Lightweight**: Only ~13MB model size (Lite version).
|
| 21 |
+
- **Bi-lingual**: Native support for English and Khmer (and mixed).
|
| 22 |
+
- **Document Processing**: Automatic text line and word detection.
|
| 23 |
+
- **Robust Detection**: Works on both light and dark backgrounds (Dark Mode support).
|
| 24 |
+
- **Visualizations**: Generate annotated images and HTML reports.
|
| 25 |
+
|
| 26 |
+
## 📊 Dataset
|
| 27 |
+
|
| 28 |
+
The model is trained on the [mrrtmob/km_en_image_line](https://huggingface.co/datasets/mrrtmob/km_en_image_line) dataset, which contains **5 million** synthetic images of Khmer and English text lines.
|
| 29 |
+
|
| 30 |
+
## 💻 Usage
|
| 31 |
+
|
| 32 |
+
### Installation
|
| 33 |
+
|
| 34 |
+
```bash
|
| 35 |
+
pip install kiri-ocr
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
### Python API
|
| 39 |
|
| 40 |
```python
|
| 41 |
+
from kiri_ocr import OCR
|
| 42 |
|
| 43 |
+
# Initialize (loads from Hugging Face automatically)
|
| 44 |
+
ocr = OCR()
|
| 45 |
|
| 46 |
# Extract text
|
| 47 |
+
text, results = ocr.extract_text('document.jpg')
|
| 48 |
print(text)
|
| 49 |
```
|
| 50 |
|
| 51 |
+
### CLI Tool
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
kiri-ocr predict path/to/document.jpg --output results/
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
## Model Details
|
| 58 |
+
- **Architecture**: CRNN (CNN + LSTM + CTC)
|
| 59 |
+
- **Framework**: PyTorch
|
| 60 |
+
- **Input Size**: Height 32px (width variable)
|
| 61 |
+
|
| 62 |
+
## 📈 Benchmarks
|
| 63 |
+
|
| 64 |
+
Results on synthetic test images (10 popular fonts):
|
| 65 |
|
|
|
|
| 66 |

|
| 67 |
+
|
| 68 |

|
| 69 |
+
|