DeepfakeDet-ViT — Model Playground
Compare PyTorch vs ONNX inference on a single image. Toggle variants to see how predictions and speed differ across backends without re-running the PyTorch model.
Batch-test multiple images across ONNX variants. Measures per-variant inference speed (avg / max ms) and prediction agreement to help you choose the right model for deployment.
Variant guide
full (84 MB) — Best accuracy, largest file, slowest CPU inference
int8 (22 MB) — Fastest CPU, balanced speed/accuracy — recommended for CPU
uint8 (22 MB) — Fast CPU, unsigned integer variant
qntzd (22 MB) — Alias of INT8 for compatibility
q4 (16 MB) — Smallest, 4-bit — use when disk/RAM constrained
Model: buildborderless/CommunityForensics-DeepfakeDet-ViT — ViT-Small classifier for deepfake image detection, trained on 2.7M samples across 4,803 generators. Outputs real/fake with sigmoid confidence.
Compare tab
Upload a single image to see inference results side-by-side from the PyTorch model and your selected ONNX variants.
- PyTorch runs the full-precision model on CUDA (or CPU if no GPU).
- ONNX runs pre-exported variants optimized for different deployment scenarios.
- Toggling ONNX variants re-uses the cached PyTorch result — only ONNX re-runs.
- Click All / None to quickly select or clear variants.
- Expand Raw JSON to see the exact numeric output for scripting.
Benchmark tab
Upload multiple images and run batch inference across selected ONNX variants.
- Each image runs through every selected variant: 5 warmup runs + 10 timed runs.
- Predictions table shows per-image, per-variant verdicts with real/fake probabilities.
- Avg / Max ms footer row shows mean inference time and worst-case latency.
- Uploaded images appear in the thumbnail gallery above the upload control.
- Use Select All / Deselect All and the Run / Clear buttons to iterate quickly.
ONNX variant guide
Five pre-exported ONNX models with different size/speed trade-offs. All use the corrected config (single-class sigmoid output).
| Variant | Size | Speed (CPU) | Fidelity vs FP32 | Best For |
|---|---|---|---|---|
model.onnx (full) |
83 MB | ★★★ | Reference (FP32) | Maximum accuracy, server-side baseline |
model_int8.onnx |
22 MB | ★★★★★ | High fidelity on standard inputs; may diverge on OOD generators | Fastest CPU, general deployment |
model_uint8.onnx |
22 MB | ★★★★★ | Alternative dynamic quantization error profile | Fast CPU deployment |
model_quantized.onnx |
22 MB | ★★★★★ | Identical to model_int8.onnx |
Drop-in INT8 alias |
model_q4.onnx |
15 MB | ★★★ | Aggressive weight quantization; high variance on subtle inputs | Smallest disk/RAM footprint |
Which variant should I use?
| Use case | Recommended variant | Why |
|---|---|---|
| Server-side, maximum accuracy | model.onnx (full) |
No quantization loss, FP32 precision — reference baseline |
| General CPU deployment | model_int8.onnx |
Fastest CPU inference, matches FP32 on clear-cut inputs |
| Disk/RAM constrained | model_q4.onnx |
Smallest file size (15 MB), low disk/RAM footprint |
Running locally
pip install gradio torch transformers onnxruntime huggingface_hub
python app.py