Image-to-Text
Hezar
Persian
File size: 1,322 Bytes
5c76600
 
 
 
 
 
 
 
 
820b26f
9492734
820b26f
9492734
 
 
 
 
 
 
 
 
9160227
 
 
 
 
 
 
 
be357a5
9160227
 
 
 
 
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
---
license: apache-2.0
language:
- fa
library_name: hezar
tags:
- hezar
- image-to-text
pipeline_tag: image-to-text
---
A CRNN model for Persian OCR. This model is based on a simple CNN + LSTM architecture inspired by [this paper](https://arxiv.org/abs/1507.05717). 

This is a successor model to our previous model [hezarai/crnn-base-fa-64x256](https://huggingface.co./hezarai/crnn-base-fa-64x256). 
The improvements include:
- 5X larger dataset
- Change input image size from 64x256 to 32x384
- Increase max output length from 64 to 96 (Max length of the samples in the dataset was 48 to handle CTC loss issues)
- Support numbers and special characters (see id2label in `model_config.yaml`)
- Auto-handling of LTR characters like digits in between the text

Note that this model is only optimized for printed/scanned documents and works best on texts with a length of up to 50-ish characters. (For an end-to-end OCR pipeline, use a text detector model first to 
extract text boxes preferrably in word-level and then use this model), but it can be used to be fine-tuned on other domains like license plate or handwritten texts.

#### Usage
```
pip install hezar
```

```python
from hezar.models import Model

crnn = Model.load("hezarai/crnn-fa-printed-96-long")
texts = crnn.predict(["sample_image.jpg"])
print(texts)
```