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
File size: 3,300 Bytes
07f3418 e3c43bd 07f3418 9eb411e e3c43bd | 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 | ---
language:
- he
library_name: timm
license: mit
pipeline_tag: image-classification
tags:
- hebrew-manuscripts
- hebrew-paleography
- document-image-analysis
- script-classification
- computational-humanities
- digital-humanities
- attention-visualization
- convnext
---
# Hebrew Script Mode Classifier
The Hebrew Script Mode Classifier is a deep learning model for classifying
handwritten Hebrew document images into two script mode categories:
- **Square**
- **Non-square**
The accompanying inference interface also produces a spatial attention
overlay showing the regions that received higher weights from the model's
gated-attention pooling layer.
## Model Details
### Model Description
The model processes a handwritten Hebrew document image using a ConvNeXt
feature extractor followed by masked gated-attention pooling and a binary
classification head.
The pixel mask prevents padded image regions from contributing to the
attention pooling operation. The output consists of class probabilities for
`square` and `non_square`.
The public checkpoint is approximately 950 MB.
- **Shared by:** Tel Aviv University Computational Humanities (TAU-CH) GitHub organization
- **Model type:** Image classifier with a ConvNeXt backbone and masked gated-attention pooling
- **Task:** Hebrew script mode classification
- **Language:** Hebrew handwritten document images
- **Number of classes:** 2
- **Classes:** `square`, `non_square`
- **Framework:** PyTorch and timm
- **Checkpoint format:** PyTorch `.pt`
- **Base architecture:** ConvNeXt; the exact backbone configuration is stored in the checkpoint
- **Default backbone fallback:** `convnext_base.fb_in22k_ft_in1k`
### Model Sources
- **GitHub repository:**
https://github.com/TAU-CH/midrash_hebrew_script_mode_classifier
- **Model repository:**
https://huggingface.co/beratkurar/hebrew_script_mode_classifier
- **Interactive Colab demo:**
https://colab.research.google.com/github/TAU-CH/midrash_hebrew_script_mode_classifier/blob/main/Hebrew_Script_Mode_Classifier.ipynb
- **Paper:** TODO: add the publication link when available
## Uses
### Direct Use
The model is intended for classification of handwritten
Hebrew document images into square and non-square script modes.
The provided Colab interface allows users to:
1. Start the inference environment.
2. Upload a handwritten Hebrew document image.
3. Receive class probabilities for square and non-square.
4. View an attention heatmap overlaid on the input image.
The simplest way to use the model is through the public Colab notebook:
[](https://colab.research.google.com/github/TAU-CH/midrash_hebrew_script_mode_classifier/blob/main/Hebrew_Script_Mode_Classifier.ipynb)
### Mixed-Script Documents
A page may contain multiple hands, scripts, annotations, marginalia, or mixed
square and non-square writing. The model returns one page-level classification
and does not explicitly model mixed-script content.
### Image Cropping
Images larger than the configured maximum dimensions are center-cropped.
Relevant evidence near the page boundaries may therefore be excluded.
The public inference code uses checkpoint-configured maximum dimensions, with
a fallback of 2500 × 2500 pixels.
|