Transformer Portfolio Project

Image Classification with a Vision Transformer

A DeiT-tiny Vision Transformer fine-tuned on CIFAR-10 and deployed as a validated ONNX model. All inference runs locally in your browser.

DeiT-tiny CIFAR-10 ONNX Runtime Web WebGPU + WASM
Test accuracy 10,000 untouched test images
Macro F1 Balanced performance across classes
ONNX model Validated browser artifact
PyTorch/ONNX agreement Full test-set parity evaluation

Live inference

Classify an image in your browser

The model supports ten CIFAR-10 classes: airplane, automobile, bird, cat, deer, dog, frog, horse, ship, and truck.

1

Select an image

This model was trained on the ten CIFAR-10 categories. Images outside those categories can still receive a prediction, but that result may not be reliable.

2

Run trained-model inference

Not loaded
Model is ready to load

The validated ONNX model is approximately 23 MB and loads only when required.

Model DeiT-tiny / ViT
Input 224 × 224 RGB
Precision FP32
Runtime Pending

Verified evaluation

Real test results—not placeholder values

Both models were evaluated on the same untouched 10,000-image CIFAR-10 test set.

Vision Transformer macro F1 Ten-class macro average
ResNet-18 accuracy
Accuracy difference ViT minus ResNet-18

ViT versus ResNet-18

Accuracy, efficiency and latency comparison

Model Accuracy Macro F1 Parameters Model size GPU latency
Loading real results…

Interpretability

Vision Transformer attention rollout

Attention rollout summarizes how attention is propagated through the model's transformer layers.

Transformer layers
Attention heads
Patch grid
Visualizations
Attention rollout for correct predictions
Correct prediction examples
Attention rollout for incorrect predictions
Incorrect prediction examples

Project methodology

End-to-end transformer engineering

01

Dataset

CIFAR-10 with a deterministic, stratified 45,000/5,000 training-validation split and the untouched 10,000-image official test set.

02

Vision Transformer

ImageNet-pretrained DeiT-tiny fine-tuned for ten classes using mixed precision, AdamW, warm-up and cosine learning-rate scheduling.

03

CNN baseline

A pretrained ResNet-18 was trained on the same split and evaluated with identical metrics for a controlled architecture comparison.

04

Deployment

The best ViT checkpoint was exported to ONNX, validated across dynamic batch sizes, compared with PyTorch, and prepared for local browser inference.

Project limitations

These limitations are displayed intentionally so the model is not presented as a general real-world image classifier.