Update Arabic-HLR-Model/README.md
Browse files- Arabic-HLR-Model/README.md +79 -79
Arabic-HLR-Model/README.md
CHANGED
|
@@ -1,79 +1,79 @@
|
|
| 1 |
-
---
|
| 2 |
-
language:
|
| 3 |
-
- ar
|
| 4 |
-
license: cc-by-nc-4.0
|
| 5 |
-
tags:
|
| 6 |
-
- handwritten-text-recognition
|
| 7 |
-
- arabic
|
| 8 |
-
- khatt
|
| 9 |
-
- densenet
|
| 10 |
-
- transformer
|
| 11 |
-
- transfer-learning
|
| 12 |
-
- pytorch
|
| 13 |
-
- safetensors
|
| 14 |
-
datasets:
|
| 15 |
-
- KHATT
|
| 16 |
-
- DASTNUS
|
| 17 |
-
metrics:
|
| 18 |
-
- cer
|
| 19 |
-
- wer
|
| 20 |
-
pipeline_tag: image-to-text
|
| 21 |
-
---
|
| 22 |
-
|
| 23 |
-
# Arabic Handwritten Text Recognition: DenseNet121-Transformer (Fine-tuned on KHATT)
|
| 24 |
-
|
| 25 |
-
## Model Description
|
| 26 |
-
A lightweight DenseNet121-Transformer architecture for Arabic handwritten line recognition,
|
| 27 |
-
pre-trained on the Kurdish DASTNUS dataset and fine-tuned on the KHATT Arabic handwritten dataset.
|
| 28 |
-
Uses a triple unified vocabulary covering Kurdish, Arabic, and Urdu scripts (192 tokens).
|
| 29 |
-
|
| 30 |
-
## Architecture
|
| 31 |
-
- **CNN Backbone:** DenseNet-121 (pretrained on ImageNet)
|
| 32 |
-
- **Encoder:** 3 Transformer encoder layers
|
| 33 |
-
- **Decoder:** 3 Transformer decoder layers
|
| 34 |
-
- **Attention Heads:** 8
|
| 35 |
-
- **Hidden Size:** 256
|
| 36 |
-
- **Parameters:** ~12.8M
|
| 37 |
-
- **Vocabulary:** 192 tokens (Triple unified: Kurdish + Arabic + Urdu)
|
| 38 |
-
|
| 39 |
-
## Transfer Learning Pipeline
|
| 40 |
-
1. Pre-trained on Kurdish DASTNUS dataset (with unified vocabulary)
|
| 41 |
-
2. Fine-tuned on KHATT Arabic handwritten line dataset
|
| 42 |
-
|
| 43 |
-
## Performance on KHATT Test Set
|
| 44 |
-
| Metric | Value |
|
| 45 |
-
|--------|-------|
|
| 46 |
-
| CER | 0.1135 |
|
| 47 |
-
| WER | 0.4156 |
|
| 48 |
-
| CRR | 88.65% |
|
| 49 |
-
|
| 50 |
-
## Training Data
|
| 51 |
-
- **Pre-training:** DASTNUS Kurdish handwritten dataset
|
| 52 |
-
- **Fine-tuning:** KHATT Arabic handwritten dataset (5,166 training, 574 validation)
|
| 53 |
-
|
| 54 |
-
## Usage
|
| 55 |
-
```python
|
| 56 |
-
from safetensors.torch import load_file
|
| 57 |
-
import json
|
| 58 |
-
|
| 59 |
-
# Load model weights
|
| 60 |
-
state_dict = load_file("model.safetensors")
|
| 61 |
-
|
| 62 |
-
# Load config
|
| 63 |
-
with open("config.json", "r") as f:
|
| 64 |
-
config = json.load(f)
|
| 65 |
-
|
| 66 |
-
# Load vocabulary
|
| 67 |
-
with open("vocab.json", "r", encoding="utf-8") as f:
|
| 68 |
-
vocab = json.load(f)
|
| 69 |
-
|
| 70 |
-
# Load full unified vocabulary info
|
| 71 |
-
with open("unified_vocabulary.json", "r", encoding="utf-8") as f:
|
| 72 |
-
unified_vocab = json.load(f)
|
| 73 |
-
```
|
| 74 |
-
|
| 75 |
-
## Citation
|
| 76 |
-
[]
|
| 77 |
-
|
| 78 |
-
## License
|
| 79 |
-
This model is released for non-commercial scientific research purposes only.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- ar
|
| 4 |
+
license: cc-by-nc-4.0
|
| 5 |
+
tags:
|
| 6 |
+
- handwritten-text-recognition
|
| 7 |
+
- arabic
|
| 8 |
+
- khatt
|
| 9 |
+
- densenet
|
| 10 |
+
- transformer
|
| 11 |
+
- transfer-learning
|
| 12 |
+
- pytorch
|
| 13 |
+
- safetensors
|
| 14 |
+
datasets:
|
| 15 |
+
- KHATT
|
| 16 |
+
- DASTNUS
|
| 17 |
+
metrics:
|
| 18 |
+
- cer
|
| 19 |
+
- wer
|
| 20 |
+
pipeline_tag: image-to-text
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
# Arabic Handwritten Text Recognition: DenseNet121-Transformer (Fine-tuned on KHATT)
|
| 24 |
+
|
| 25 |
+
## Model Description
|
| 26 |
+
A lightweight DenseNet121-Transformer architecture for Arabic handwritten line recognition,
|
| 27 |
+
pre-trained on the Kurdish DASTNUS dataset and fine-tuned on the KHATT Arabic handwritten dataset.
|
| 28 |
+
Uses a triple unified vocabulary covering Kurdish, Arabic, and Urdu scripts (192 tokens). The KHATT dataset is publicly available at https://www.kaggle.com/datasets/iraqyomar/khatt-arabic-hand-written-lines/code
|
| 29 |
+
|
| 30 |
+
## Architecture
|
| 31 |
+
- **CNN Backbone:** DenseNet-121 (pretrained on ImageNet)
|
| 32 |
+
- **Encoder:** 3 Transformer encoder layers
|
| 33 |
+
- **Decoder:** 3 Transformer decoder layers
|
| 34 |
+
- **Attention Heads:** 8
|
| 35 |
+
- **Hidden Size:** 256
|
| 36 |
+
- **Parameters:** ~12.8M
|
| 37 |
+
- **Vocabulary:** 192 tokens (Triple unified: Kurdish + Arabic + Urdu)
|
| 38 |
+
|
| 39 |
+
## Transfer Learning Pipeline
|
| 40 |
+
1. Pre-trained on Kurdish DASTNUS dataset (with unified vocabulary)
|
| 41 |
+
2. Fine-tuned on KHATT Arabic handwritten line dataset
|
| 42 |
+
|
| 43 |
+
## Performance on KHATT Test Set
|
| 44 |
+
| Metric | Value |
|
| 45 |
+
|--------|-------|
|
| 46 |
+
| CER | 0.1135 |
|
| 47 |
+
| WER | 0.4156 |
|
| 48 |
+
| CRR | 88.65% |
|
| 49 |
+
|
| 50 |
+
## Training Data
|
| 51 |
+
- **Pre-training:** DASTNUS Kurdish handwritten dataset
|
| 52 |
+
- **Fine-tuning:** KHATT Arabic handwritten dataset (5,166 training, 574 validation)
|
| 53 |
+
|
| 54 |
+
## Usage
|
| 55 |
+
```python
|
| 56 |
+
from safetensors.torch import load_file
|
| 57 |
+
import json
|
| 58 |
+
|
| 59 |
+
# Load model weights
|
| 60 |
+
state_dict = load_file("model.safetensors")
|
| 61 |
+
|
| 62 |
+
# Load config
|
| 63 |
+
with open("config.json", "r") as f:
|
| 64 |
+
config = json.load(f)
|
| 65 |
+
|
| 66 |
+
# Load vocabulary
|
| 67 |
+
with open("vocab.json", "r", encoding="utf-8") as f:
|
| 68 |
+
vocab = json.load(f)
|
| 69 |
+
|
| 70 |
+
# Load full unified vocabulary info
|
| 71 |
+
with open("unified_vocabulary.json", "r", encoding="utf-8") as f:
|
| 72 |
+
unified_vocab = json.load(f)
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
## Citation
|
| 76 |
+
[]
|
| 77 |
+
|
| 78 |
+
## License
|
| 79 |
+
This model is released for non-commercial scientific research purposes only.
|