File size: 4,697 Bytes
b846912
 
 
 
 
 
 
555c94c
 
 
 
 
b568d00
 
33d3862
 
 
 
 
 
c1c4b4b
33d3862
 
c1c4b4b
 
 
 
 
33d3862
 
 
 
 
 
 
 
 
 
aabb518
33d3862
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c1c4b4b
 
 
33d3862
 
 
 
 
c1c4b4b
 
33d3862
 
c1c4b4b
 
 
 
33d3862
 
 
 
 
 
c1c4b4b
 
 
33d3862
 
 
 
c1c4b4b
 
33d3862
 
 
c1c4b4b
33d3862
 
c1c4b4b
 
 
33d3862
 
 
 
 
aabb518
33d3862
 
 
 
 
 
 
 
 
 
 
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
---
license: mit
language:
- he
tags:
- languages
- manuscripts
- hebrew
- ocr
- letters
- manuscript
- digital-humanities
datasets:
- bsesic/HebrewManuscripts
---

# Hebrew Letter Recognition Model

## Model Description

This is a **Convolutional Neural Network (CNN)** model trained to recognize **Hebrew letters** and a **stop symbols** in images. The model can identify individual letters from a provided image, outputting their respective class along with probabilities.

## Model Details:
* **Model Type**: Convolutional Neural Network (CNN)
* **Framework**: TensorFlow 2.x / Keras
* **Input Size**: 64x64 grayscale images of isolated letters.
* **Output Classes**: 28 Hebrew letters + 1 stop symbol (.)
* **Use Case**: Recognizing handwritten or printed Hebrew letters and punctuation in scanned images or photos of documents.

## Intended Use

This model is designed for the automatic recognition of *Hebrew letters* from images. The model can be used in applications such as:

* Optical character recognition (OCR) systems for Hebrew text.
* Educational tools to help learners read Hebrew text.
* Historical document digitization of Hebrew manuscripts.

## How to Use:
```python
from tensorflow.keras.models import load_model
import numpy as np
import cv2

# Load the model
model = load_model('path_to_model.hebrew_letter_model.keras')

# Preprocess an input image (example for one letter)
img = cv2.imread('path_to_image.jpg', cv2.IMREAD_GRAYSCALE)
img_resized = cv2.resize(img, (64, 64)) / 255.0
img_array = np.expand_dims(img_resized, axis=0)

# Predict
predictions = model.predict(img_array)
predicted_class = np.argmax(predictions, axis=1)[0]

# Class names for Hebrew letters
class_names = ['stop', '讗', '讘', '讙', '讚', '讛', '讜', '讝', '讞', '讟', '讬', '讱', '讻', '诇', '诐', '诪', '谉', '谞', '住', '注', '祝', '驻', '抓', '爪', '拽', '专', '砖', '转']

print("Predicted letter:", class_names[predicted_class])

```

## Example:
If given an image with the Hebrew word "讗讘专诐" (Abram), the model can detect and classify the letters and stop symbols with probabilities.

## Limitations:

* **Font Variations**: The model performs best on specific fonts (e.g., square Hebrew letters). Performance may degrade with highly stylized or cursive fonts.
* **Noise Sensitivity**: Images with a lot of noise, artifacts, or low resolution may lead to incorrect predictions.
* **Stop Symbol**: The stop symbol is particularly recognized by detecting three vertical dots. However, false positives can occur if letters with similar shapes are present.

## Training Data:

The model was trained on a dataset containing *Hebrew letters and stop symbols*. The training dataset includes:

* **28 Hebrew letters**.
* **1 stop symbol** representing three vertical dots (.).

## Training Procedure:
* **Optimizer**: Adam
* **Loss function**: Categorical Crossentropy
* **Batch size**: 32
* **Epochs**: 10

Data augmentation was applied to reduce overfitting and increase the model's generalizability to unseen data. This includes random rotations, zooms, and horizontal flips.

## Model Performance

# Metrics:
* **Accuracy**: 95% on the validation dataset.
* **Precision**: 94%
* **Recall**: 93%
* 
Performance may vary depending on the quality of the input images, noise levels, and whether the letters are handwritten or printed.

## Known Issues:
* **False Positives for Stop Symbols**: The model sometimes incorrectly identifies letters that resemble three vertical dots as stop symbols.
* **Overfitting to Specific Fonts**: Performance can degrade on handwritten texts or cursive fonts not represented well in the training set.

## Ethical Considerations

* **Bias**: The model was trained on a specific set of Hebrew fonts and may not perform equally well across all types of Hebrew texts, particularly historical or handwritten documents.
Fairness: The model may produce varying results depending on font style, quality of input images, and preprocessing applied.

## Future Work:

* **Improving Generalization**: Future work will focus on improving the model's robustness to different fonts, handwriting styles, and noisy inputs.
Multilingual Expansion: Adding support for other Semitic scripts or expanding the model for multilingual OCR tasks.
Citation:

If you use this model in your work, please cite it as follows:

```bibtex
@misc{hebrew-letter-recognition,
  title={Hebrew Manuscripts Letter Recognition Model},
  author={Benjamin Schnabel},
  year={2024},
  howpublished={\url{https://huggingface.co./bsesic/HebrewManuscriptsMNIST}},
}
```

License:

This model is licensed under [MIT License](https://huggingface.co./datasets/choosealicense/licenses/blob/main/markdown/mit.md).