bsesic commited on
Commit
33d3862
โ€ข
1 Parent(s): b568d00

Update README.md

Browse files

Description added.

Files changed (1) hide show
  1. README.md +109 -1
README.md CHANGED
@@ -7,4 +7,112 @@ tags:
7
  - manuscripts
8
  datasets:
9
  - bsesic/HebrewManuscripts
10
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  - manuscripts
8
  datasets:
9
  - bsesic/HebrewManuscripts
10
+ ---
11
+
12
+ # Hebrew Letter Recognition Model
13
+
14
+ ## Model Description
15
+
16
+ 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.
17
+
18
+ ## Model Details:
19
+ * *Model Type*: Convolutional Neural Network (CNN)
20
+ * *Framework*: TensorFlow 2.x / Keras
21
+ * *Input Size*: 64x64 grayscale images of isolated letters.
22
+ * *Output Classes*: 28 Hebrew letters + 1 stop symbol (.)
23
+ * *Use Case*: Recognizing handwritten or printed Hebrew letters and punctuation in scanned images or photos of documents.
24
+
25
+ ## Intended Use
26
+
27
+ This model is designed for the automatic recognition of *Hebrew letters* from images. The model can be used in applications such as:
28
+
29
+ * Optical character recognition (OCR) systems for Hebrew text.
30
+ * Educational tools to help learners read Hebrew text.
31
+ * Historical document digitization of Hebrew manuscripts.
32
+
33
+ ## How to Use:
34
+ ```
35
+ from tensorflow.keras.models import load_model
36
+ import numpy as np
37
+ import cv2
38
+
39
+ # Load the model
40
+ model = load_model('path_to_model.hebrew_letter_model.keras')
41
+
42
+ # Preprocess an input image (example for one letter)
43
+ img = cv2.imread('path_to_image.jpg', cv2.IMREAD_GRAYSCALE)
44
+ img_resized = cv2.resize(img, (64, 64)) / 255.0
45
+ img_array = np.expand_dims(img_resized, axis=0)
46
+
47
+ # Predict
48
+ predictions = model.predict(img_array)
49
+ predicted_class = np.argmax(predictions, axis=1)[0]
50
+
51
+ # Class names for Hebrew letters
52
+ class_names = ['stop', 'ื', 'ื‘', 'ื’', 'ื“', 'ื”', 'ื•', 'ื–', 'ื—', 'ื˜', 'ื™', 'ืš', 'ื›', 'ืœ', 'ื', 'ืž', 'ืŸ', 'ื ', 'ืก', 'ืข', 'ืฃ', 'ืค', 'ืฅ', 'ืฆ', 'ืง', 'ืจ', 'ืฉ', 'ืช']
53
+
54
+ print("Predicted letter:", class_names[predicted_class])
55
+
56
+ ```
57
+
58
+ ## Example:
59
+ If given an image with the Hebrew word "ืื‘ืจื" (Abram), the model can detect and classify the letters and stop symbols with probabilities.
60
+
61
+ ## Limitations:
62
+
63
+ * *Font Variations*: The model performs best on specific fonts (e.g., square Hebrew letters). Performance may degrade with highly stylized or cursive fonts.
64
+ * *Noise Sensitivity*: Images with a lot of noise, artifacts, or low resolution may lead to incorrect predictions.
65
+ * *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.
66
+
67
+ ## Training Data:
68
+
69
+ The model was trained on a dataset containing *Hebrew letters and stop symbols*. The training dataset includes:
70
+
71
+ * *28 Hebrew letters*.
72
+ * *1 stop symbol* representing three vertical dots (.).
73
+
74
+ ## Training Procedure:
75
+ * *Optimizer*: Adam
76
+ * *Loss function*: Categorical Crossentropy
77
+ * *Batch size*: 32
78
+ * *Epochs*: 10
79
+
80
+ Data augmentation was applied to reduce overfitting and increase the model's generalizability to unseen data. This includes random rotations, zooms, and horizontal flips.
81
+
82
+ ## Model Performance
83
+
84
+ # Metrics:
85
+ * *Accuracy*: 95% on the validation dataset.
86
+ * *Precision*: 94%
87
+ * *Recall*: 93%
88
+ *
89
+ Performance may vary depending on the quality of the input images, noise levels, and whether the letters are handwritten or printed.
90
+
91
+ ## Known Issues:
92
+ * *False Positives for Stop Symbols*: The model sometimes incorrectly identifies letters that resemble three vertical dots as stop symbols.
93
+ * *Overfitting to Specific Fonts*: Performance can degrade on handwritten texts or cursive fonts not represented well in the training set.
94
+
95
+ ## Ethical Considerations
96
+
97
+ * *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.
98
+ Fairness: The model may produce varying results depending on font style, quality of input images, and preprocessing applied.
99
+ Future Work:
100
+
101
+ * *Improving Generalization*: Future work will focus on improving the model's robustness to different fonts, handwriting styles, and noisy inputs.
102
+ Multilingual Expansion: Adding support for other Semitic scripts or expanding the model for multilingual OCR tasks.
103
+ Citation:
104
+
105
+ If you use this model in your work, please cite it as follows:
106
+
107
+ ```
108
+ @misc{hebrew-letter-recognition,
109
+ title={Hebrew Manuscripts Letter Recognition Model},
110
+ author={Benjamin Schnabel},
111
+ year={2024},
112
+ howpublished={\url{https://huggingface.co/bsesic/HebrewManuscriptsMNIST}},
113
+ }
114
+ ```
115
+
116
+ License:
117
+
118
+ This model is licensed under [MIT License](https://huggingface.co/datasets/choosealicense/licenses/blob/main/markdown/mit.md).