BDRC/script-classification-Benchmark
Viewer • Updated • 540 • 14
How to use BDRC/6-way-balanced-script-classifier with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-classification", model="BDRC/6-way-balanced-script-classifier")
pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("BDRC/6-way-balanced-script-classifier", dtype="auto")Fine-tuned DINOv3 ViT-S for six Tibetan script families:
Danyig, Druma, Gyuyig, Pedri, Tsugdri, Uchen
Experiment: dinov3_6way_script_classifier (6_way_script_classification)
Pooling: ViT CLS token (last_hidden_state[:, 0, :]) — not global average pooling
Weights: final_model.pt (best validation macro-F1 across stages A/B)
| Split | Dataset |
|---|---|
| Train / val | BDRC/6-class-balanced-script-classification-dataset |
| Test (benchmark) | BDRC/script-classification-Benchmark |
| Split | Mode | Notes |
|---|---|---|
| train | standard_aug |
random resize ≈244 → crop 220 + affine / jitter / blur |
| val | none |
full page |
| test | none |
full page (benchmark) |
Processor size: 224 px. Inference default: --preprocess none.
| Metric | Value |
|---|---|
| Accuracy | 36.5% |
| Macro F1 | 0.342 |
| Weighted F1 | 0.342 |
| Loss | 1.8323 |
Best val checkpoint: best_stage_b_last_blocks.pt epoch 1 macro-F1 0.307
| Parameter | Value |
|---|---|
lr_head_a |
5e-05 |
lr_backbone_b |
1e-06 |
lr_head_b |
1e-05 |
epochs_a |
6 |
epochs_b |
15 |
unfreeze_blocks_b |
4 |
scheduler |
cosine |
warmup_epochs_a |
0 |
warmup_epochs_b |
0 |
warmup_start_factor |
1.0 |
min_lr_ratio |
0.01 |
early_stop_patience |
3 |
class_weight_mode |
balanced |
label_smoothing |
0.1 |
dropout |
0.2 |
weight_decay |
0.05 |
grad_clip_norm |
1.0 |
precision recall f1-score support
Danyig 0.25 0.03 0.06 90
Druma 0.28 0.39 0.32 90
Gyuyig 0.43 0.49 0.46 90
Pedri 0.81 0.29 0.43 90
Tsugdri 0.21 0.30 0.25 90
Uchen 0.44 0.69 0.54 90
accuracy 0.36 540
macro avg 0.40 0.36 0.34 540
weighted avg 0.40 0.36 0.34 540
| True \ Pred | Danyig | Druma | Gyuyig | Pedri | Tsugdri | Uchen |
|---|---|---|---|---|---|---|
| Danyig | 3 | 22 | 10 | 2 | 20 | 33 |
| Druma | 1 | 35 | 4 | 3 | 28 | 19 |
| Gyuyig | 2 | 24 | 44 | 0 | 12 | 8 |
| Pedri | 3 | 23 | 8 | 26 | 19 | 11 |
| Tsugdri | 3 | 17 | 35 | 1 | 27 | 7 |
| Uchen | 0 | 6 | 1 | 0 | 21 | 62 |
| File | Description |
|---|---|
final_model.pt |
Best val-F1 weights + label maps + test metrics |
results.json |
Full metrics, history, resolved config |
config.yaml |
Training config used for this run |
model_card.json |
Summary metadata |
confusion_matrix.json / .png |
Benchmark test CM |
training_history.png |
Stage loss / val F1 curves |
inference.py |
Classify image paths |
requirements-inference.txt |
Pip deps |
pip install -r requirements-inference.txt
python inference.py --checkpoint final_model.pt --image path/to/page.jpg --preprocess none
python scripts/download_hf_6class_datasets.py
python experiments/synthetic_data/train.py
Model repo: BDRC/6-way-balanced-script-classifier
Base model
facebook/dinov3-vit7b16-pretrain-lvd1689m