Image Classification
timm
Hebrew
hebrew-manuscripts
hebrew-paleography
document-image-analysis
script-classification
computational-humanities
digital-humanities
attention-visualization
convnext
Instructions to use beratkurar/hebrew_script_mode_classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use beratkurar/hebrew_script_mode_classifier with timm:
import timm model = timm.create_model("hf_hub:beratkurar/hebrew_script_mode_classifier", pretrained=True) - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,8 +1,98 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
license: mit
|
| 3 |
pipeline_tag: image-classification
|
| 4 |
tags:
|
| 5 |
- hebrew-manuscripts
|
| 6 |
-
-
|
| 7 |
-
-
|
| 8 |
-
--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- he
|
| 4 |
+
library_name: timm
|
| 5 |
license: mit
|
| 6 |
pipeline_tag: image-classification
|
| 7 |
tags:
|
| 8 |
- hebrew-manuscripts
|
| 9 |
+
- hebrew-paleography
|
| 10 |
+
- document-image-analysis
|
| 11 |
+
- script-classification
|
| 12 |
+
- computational-humanities
|
| 13 |
+
- digital-humanities
|
| 14 |
+
- attention-visualization
|
| 15 |
+
- convnext
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# Hebrew Script Mode Classifier
|
| 19 |
+
|
| 20 |
+
The Hebrew Script Mode Classifier is a deep learning model for classifying
|
| 21 |
+
handwritten Hebrew document images into two script mode categories:
|
| 22 |
+
|
| 23 |
+
- **Square**
|
| 24 |
+
- **Non-square**
|
| 25 |
+
|
| 26 |
+
The accompanying inference interface also produces a spatial attention
|
| 27 |
+
overlay showing the regions that received higher weights from the model's
|
| 28 |
+
gated-attention pooling layer.
|
| 29 |
+
|
| 30 |
+
## Model Details
|
| 31 |
+
|
| 32 |
+
### Model Description
|
| 33 |
+
|
| 34 |
+
The model processes a handwritten Hebrew document image using a ConvNeXt
|
| 35 |
+
feature extractor followed by masked gated-attention pooling and a binary
|
| 36 |
+
classification head.
|
| 37 |
+
|
| 38 |
+
The pixel mask prevents padded image regions from contributing to the
|
| 39 |
+
attention pooling operation. The output consists of class probabilities for
|
| 40 |
+
`square` and `non_square`.
|
| 41 |
+
|
| 42 |
+
The public checkpoint is approximately 950 MB.
|
| 43 |
+
|
| 44 |
+
- **Shared by:** Tel Aviv University Computational Humanities (TAU-CH) GitHub organization
|
| 45 |
+
- **Model type:** Image classifier with a ConvNeXt backbone and masked gated-attention pooling
|
| 46 |
+
- **Task:** Hebrew script mode classification
|
| 47 |
+
- **Language:** Hebrew handwritten document images
|
| 48 |
+
- **Number of classes:** 2
|
| 49 |
+
- **Classes:** `square`, `non_square`
|
| 50 |
+
- **Framework:** PyTorch and timm
|
| 51 |
+
- **Checkpoint format:** PyTorch `.pt`
|
| 52 |
+
- **Base architecture:** ConvNeXt; the exact backbone configuration is stored in the checkpoint
|
| 53 |
+
- **Default backbone fallback:** `convnext_base.fb_in22k_ft_in1k`
|
| 54 |
+
|
| 55 |
+
### Model Sources
|
| 56 |
+
|
| 57 |
+
- **GitHub repository:**
|
| 58 |
+
https://github.com/TAU-CH/midrash_hebrew_script_mode_classifier
|
| 59 |
+
|
| 60 |
+
- **Model repository:**
|
| 61 |
+
https://huggingface.co/beratkurar/hebrew_script_mode_classifier
|
| 62 |
+
|
| 63 |
+
- **Interactive Colab demo:**
|
| 64 |
+
https://colab.research.google.com/github/TAU-CH/midrash_hebrew_script_mode_classifier/blob/main/Hebrew_Script_Mode_Classifier.ipynb
|
| 65 |
+
|
| 66 |
+
- **Paper:** TODO: add the publication link when available
|
| 67 |
+
|
| 68 |
+
## Uses
|
| 69 |
+
|
| 70 |
+
### Direct Use
|
| 71 |
+
|
| 72 |
+
The model is intended for classification of handwritten
|
| 73 |
+
Hebrew document images into square and non-square script modes.
|
| 74 |
+
|
| 75 |
+
The provided Colab interface allows users to:
|
| 76 |
+
|
| 77 |
+
1. Start the inference environment.
|
| 78 |
+
2. Upload a handwritten Hebrew document image.
|
| 79 |
+
3. Receive class probabilities for square and non-square.
|
| 80 |
+
4. View an attention heatmap overlaid on the input image.
|
| 81 |
+
|
| 82 |
+
The simplest way to use the model is through the public Colab notebook:
|
| 83 |
+
|
| 84 |
+
[](https://colab.research.google.com/github/TAU-CH/midrash_hebrew_script_mode_classifier/blob/main/Hebrew_Script_Mode_Classifier.ipynb)
|
| 85 |
+
|
| 86 |
+
### Mixed-Script Documents
|
| 87 |
+
|
| 88 |
+
A page may contain multiple hands, scripts, annotations, marginalia, or mixed
|
| 89 |
+
square and non-square writing. The model returns one page-level classification
|
| 90 |
+
and does not explicitly model mixed-script content.
|
| 91 |
+
|
| 92 |
+
### Image Cropping
|
| 93 |
+
|
| 94 |
+
Images larger than the configured maximum dimensions are center-cropped.
|
| 95 |
+
Relevant evidence near the page boundaries may therefore be excluded.
|
| 96 |
+
|
| 97 |
+
The public inference code uses checkpoint-configured maximum dimensions, with
|
| 98 |
+
a fallback of 2500 × 2500 pixels.
|