Batik Vision AI v4.0 β€” DINOv2-ViT-S/14 (INT8 & FP16 ONNX)

A fast, calibrated 28-class Indonesian Batik motif classifier built for browser (WebGPU / WebGL / WASM) and desktop ONNX Runtime inference.


Highlights

  • Compact & Fast (22.47 MB INT8): 3.65x smaller than v3 (82.1 MB EfficientNetV2S FP32) with zero quantization accuracy drop (89.82% Top-1 vs 89.42% FP32).
  • Drop-In Preprocessing Inside ONNX: Accepts raw float32[batch, 224, 224, 3] RGB pixels in [0, 255] (NHWC) β€” ImageNet normalization and channel permutation are embedded directly inside the ONNX graph (opset 17).
  • Honest "Not Batik" Detection (OOD AUROC 0.9591): Post-hoc Temperature Scaling (T = 0.8242) + entropy/confidence thresholds calibrated against 177 non-batik negatives (including hard Indonesian woven textiles: Songket, Tenun Ikat, and Ulos).
  • Zero-Leakage Evaluation: Trained and evaluated on strictly leak-free semantic cluster splits (0 shared DINOv2 clusters across train/val/test).

Model Files

File Size Precision Recommended Use
batik_model_v4_int8.onnx 22.47 MB Dynamic INT8 (QUInt8) Web / mobile / edge deployment (deployed on batik-vision-ai.vercel.app)
batik_model_v4_fp16.onnx 43.53 MB FP16 weights (FP32 I/O) High-precision desktop / WebGPU (max_abs_diff = 0.007 vs PyTorch)
model_config.json 1 KB JSON Calibrated temperature, OOD thresholds, input_size, and ordered 28-class labels
v4_benchmark_summary.json 7 KB JSON Full 3-backbone benchmark (DINOv2-ViT-S/14, ConvNeXt-Tiny, EfficientNetV2-S)
v4_classification_report.txt 2 KB Text Per-class precision, recall, and F1 on the 501-image holdout test set
v4_confusion_matrix.png ~200 KB PNG 28x28 holdout confusion matrix
SHA256SUMS.txt 1 KB Text SHA-256 checksums for all files

Leak-Free Benchmark Comparison (n = 501 Unseen Holdout Test + 177 OOD Negatives)

Backbone Input Size Val Macro-F1 Holdout Top-1 Holdout Top-3 Holdout Macro-F1 Test ECE OOD Entropy AUROC OOD Recall @ <=5% FRR
DINOv2-ViT-S/14 (INT8 3-Tile β€” Deployed) 224Β² 22.47 MB 87.49% 89.82% 96.01% 87.47% 0.0392 0.9591 75.7%
DINOv2-ViT-S/14 (FP32 Single-Crop) 224Β² 86.74 MB 87.49% 89.02% 95.41% 87.29% 0.0332 0.9542 73.5%
ConvNeXt-Tiny (FP32 Single-Crop) 288Β² 111.3 MB 87.44% 90.42% 95.01% 88.38% 0.0411 0.9577 74.6%
EfficientNetV2-S (FP32 Single-Crop) 300Β² 82.1 MB 87.09% 87.82% 95.01% 87.29% 0.0341 0.9291 54.8%

Batik Vision AI v4 Holdout Confusion Matrix


Quick Start (Python + ONNX Runtime)

import json, math
import numpy as np
import onnxruntime as ort
from PIL import Image, ImageOps
from huggingface_hub import hf_hub_download

model_path = hf_hub_download("benedictpepper/batik-vision-ai-v4", "batik_model_v4_int8.onnx")
cfg_path   = hf_hub_download("benedictpepper/batik-vision-ai-v4", "model_config.json")
cfg = json.load(open(cfg_path))

sess = ort.InferenceSession(model_path, providers=["CPUExecutionProvider"])

# Center square crop -> 224x224 raw float32 [0, 255] NHWC
im = ImageOps.exif_transpose(Image.open("my_batik.jpg")).convert("RGB")
s = min(im.size)
im = im.crop(((im.width - s)//2, (im.height - s)//2, (im.width + s)//2, (im.height + s)//2))
im = im.resize((cfg["input_size"], cfg["input_size"]), Image.Resampling.BILINEAR)
x = np.asarray(im, dtype=np.float32)[None, ...]  # [1, 224, 224, 3] in [0, 255]

logits = sess.run(None, {sess.get_inputs()[0].name: x})[0][0]
scaled = logits / cfg["temperature"]
probs = np.exp(scaled - scaled.max())
probs /= probs.sum()

top_idx = int(np.argmax(probs))
norm_entropy = float(-np.sum(probs * np.log(np.clip(probs, 1e-12, 1.0))) / math.log(len(probs)))
is_ood = (probs[top_idx] < cfg["ood_min_confidence"]) or (norm_entropy > cfg["ood_entropy_threshold"])

print(f"Predicted: {cfg['labels'][top_idx]} ({probs[top_idx]*100:.1f}%) | OOD: {is_ood}")
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 benedictpepper/batik-vision-ai-v4

Quantized
(18)
this model

Dataset used to train benedictpepper/batik-vision-ai-v4

Evaluation results

  • Holdout Top-1 Accuracy (3-Tile) on Indonesian Batik v2.0 (Leak-Free Holdout)
    self-reported
    89.820
  • Holdout Macro-F1 (3-Tile) on Indonesian Batik v2.0 (Leak-Free Holdout)
    self-reported
    87.470
  • OOD Entropy AUROC (vs 177 Negatives) on Indonesian Batik v2.0 (Leak-Free Holdout)
    self-reported
    0.959