8-Class Tibetan Page Classifier (DINOv3 ViT-B)

Page-level classification of Tibetan manuscript / print images into 8 classes: danyig_pedri, druma, gyuyig_tsugdri, multiscript, non_tibetan, uchen, blank, nonplaintext.

The six script classes match BDRC/6-class-tibetan-script-classifier; this model adds two page-type classes — blank (blank / bleed-through pages) and nonplaintext (tables, illustration-only pages, musical scores) — so an OCR pipeline can route pages before recognition.

Fine-tuned DINOv3 ViT-B/16.

Dataset (HF): BDRC/8-class-tibetan-page-classification-dataset
Experiment: dinov3_8way_vitb16_center_crop
Checkpoint: best_stage_main.pt (epoch 9, val macro-F1 0.950)

Quick start

python inference.py --checkpoint final_model.pt --image page.jpg
from inference import DINOv3Classifier, label_order
from transformers import AutoImageProcessor
import torch

ckpt = torch.load("final_model.pt", map_location="cpu", weights_only=False)
classes = label_order(ckpt)
model = DINOv3Classifier(ckpt["model_id"], num_classes=len(classes), pooling=ckpt["pooling"])
model.load_state_dict(ckpt["model_state_dict"]); model.eval()
processor = AutoImageProcessor.from_pretrained(ckpt["model_id"])

inference.py ships alongside the weights — no extra dependencies beyond torch and transformers.

Preprocessing (inference)

Split Mode
train center_crop
val center_crop
test center_crop

Short-edge resize to 448 then center crop. Pooling: cls_mean_std (CLS ⊕ patch-mean ⊕ patch-std).

Test metrics (n=479)

Metric Value
Accuracy 91.6%
Macro F1 0.916
Weighted F1 0.916
Loss 0.4955

Per-class (test)

precision    recall  f1-score   support

  danyig_pedri       0.79      0.77      0.78        60
         druma       0.86      0.85      0.86        60
gyuyig_tsugdri       0.89      0.98      0.94        60
   multiscript       0.89      0.83      0.86        60
   non_tibetan       0.98      0.97      0.97        60
         uchen       1.00      1.00      1.00        60
         blank       0.98      0.95      0.97        60
  nonplaintext       0.92      0.98      0.95        59

      accuracy                           0.92       479
     macro avg       0.92      0.92      0.92       479
  weighted avg       0.92      0.92      0.92       479

Training config

Setting Value
Stages head-warmup (1 ep) + main (10 ep) + polish (2 ep)
LR backbone / head (main) 2e-05 / 0.001
Scheduler main cosine_warmup
Sampler class-balanced (WeightedRandomSampler)
Label smoothing 0.05
Weight decay 0.02
Dropout 0.3
Gradient clip 1.0

Training history

Training curves

Confusion matrix (test)

Confusion matrix

Files

File Description
final_model.pt Weights + idx_to_label + model_id + pooling + metrics
inference.py Standalone inference (torch + transformers only)
results.json Full training config, history, per-class report
confusion_matrix.png Confusion-matrix plot
training_history.png Loss / F1 curves
split_stats.json Train/val/test class counts

Load weights

import torch
ckpt = torch.load("final_model.pt", map_location="cpu", weights_only=False)
print(ckpt["test_metrics"]); print(ckpt["idx_to_label"])

Citation

@misc{8classtibetanpageclassifier,
  title  = {8-Class Tibetan Page Classifier (DINOv3 ViT-B)},
  author = {Buddhist Digital Resource Center and OpenPecha},
  year   = {2026},
  url    = {https://huggingface.co/BDRC/8-class-tibetan-page-classifier},
  dataset = {https://huggingface.co/datasets/BDRC/8-class-tibetan-page-classification-dataset},
  note   = {Trained on BDRC manuscript images}
}

License

The fine-tuned model weights are derivative works of DINOv3 and are distributed under the DINOv3 License. The original inference code in this repository is available under the Apache License 2.0.

Acknowledgements

All images are provided by the Buddhist Digital Resource Center (BDRC). This dataset was developed by Dharmaduta from specifications provided by BDRC for the project "The BDRC Etext Corpus", with funding from the Khyentse Foundation. Buddhist Digital Resource Center (BDRC). Developed by Dharmaduta / OpenPecha.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for BDRC/8-class-tibetan-page-classifier

Dataset used to train BDRC/8-class-tibetan-page-classifier

Collection including BDRC/8-class-tibetan-page-classifier