Image Classification
Transformers
ONNX
Safetensors
timm
vit
detection
deepfake
forensics
deepfake_detection
community
opensight
Instructions to use buildborderless/CommunityForensics-DeepfakeDet-ViT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use buildborderless/CommunityForensics-DeepfakeDet-ViT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="buildborderless/CommunityForensics-DeepfakeDet-ViT") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("buildborderless/CommunityForensics-DeepfakeDet-ViT") model = AutoModelForImageClassification.from_pretrained("buildborderless/CommunityForensics-DeepfakeDet-ViT", device_map="auto") - timm
How to use buildborderless/CommunityForensics-DeepfakeDet-ViT with timm:
import timm model = timm.create_model("hf_hub:buildborderless/CommunityForensics-DeepfakeDet-ViT", pretrained=True) - Inference
- Notebooks
- Google Colab
- Kaggle
Update README.md (#7)
Browse files- Update README.md (528fa9c9343c0f685957b428b97976d097af3261)
README.md
CHANGED
|
@@ -108,23 +108,23 @@ print(f"verdict: {'fake' if fake_prob > 0.5 else 'real'}")
|
|
| 108 |
|
| 109 |
Five pre-exported ONNX models with different size/speed trade-offs. All use the corrected config (single-class sigmoid output).
|
| 110 |
|
| 111 |
-
| Variant | Size | Speed (CPU) |
|
| 112 |
|---|---|---|---|---|
|
| 113 |
-
| `model.onnx` (full) |
|
| 114 |
-
| `model_int8.onnx` | 22 MB | β
β
β
β
β
|
|
| 115 |
-
| `model_uint8.onnx` | 22 MB | β
β
β
β
β
|
|
| 116 |
-
| `model_quantized.onnx` | 22 MB | β
β
β
β
β
|
|
| 117 |
-
| `model_q4.onnx` |
|
| 118 |
|
| 119 |
**Which variant should I use?**
|
| 120 |
|
| 121 |
| Use case | Recommended variant | Why |
|
| 122 |
|---|---|---|
|
| 123 |
-
| Server-side, maximum accuracy | `model.onnx` (full) | No quantization loss, FP32 precision |
|
| 124 |
-
| General CPU deployment | `model_int8.onnx` | Fastest CPU inference,
|
| 125 |
-
| Disk/RAM constrained | `model_q4.onnx` | Smallest file size,
|
| 126 |
|
| 127 |
-
> **Quantization note**: Dynamic quantization
|
| 128 |
|
| 129 |
```python
|
| 130 |
import onnxruntime as ort, numpy as np
|
|
|
|
| 108 |
|
| 109 |
Five pre-exported ONNX models with different size/speed trade-offs. All use the corrected config (single-class sigmoid output).
|
| 110 |
|
| 111 |
+
| Variant | Size | Speed (CPU) | Fidelity vs FP32 | Best For |
|
| 112 |
|---|---|---|---|---|
|
| 113 |
+
| `model.onnx` (full) | 83 MB | β
β
β
| Reference (FP32) | Maximum accuracy, server-side baseline |
|
| 114 |
+
| `model_int8.onnx` | 22 MB | β
β
β
β
β
| High fidelity on standard inputs; may diverge on OOD generators | **Fastest CPU**, general deployment |
|
| 115 |
+
| `model_uint8.onnx` | 22 MB | β
β
β
β
β
| Alternative dynamic quantization error profile | Fast CPU deployment |
|
| 116 |
+
| `model_quantized.onnx` | 22 MB | β
β
β
β
β
| Identical to `model_int8.onnx` | Drop-in INT8 alias |
|
| 117 |
+
| `model_q4.onnx` | 15 MB | β
β
β
| Aggressive weight quantization; high variance on subtle inputs | Smallest disk/RAM footprint |
|
| 118 |
|
| 119 |
**Which variant should I use?**
|
| 120 |
|
| 121 |
| Use case | Recommended variant | Why |
|
| 122 |
|---|---|---|
|
| 123 |
+
| Server-side, maximum accuracy | `model.onnx` (full) | No quantization loss, FP32 precision β reference baseline |
|
| 124 |
+
| General CPU deployment | `model_int8.onnx` | Fastest CPU inference, matches FP32 on clear-cut inputs |
|
| 125 |
+
| Disk/RAM constrained | `model_q4.onnx` | Smallest file size (15 MB), low disk/RAM footprint |
|
| 126 |
|
| 127 |
+
> **Quantization note**: Dynamic per-tensor quantization without calibration causes quantized variants to diverge from FP32 on certain inputs (up to 10β70 percentage points) β particularly images from generators outside the training set. **Significant disagreement between FP32 and INT8/Q4 indicates the input is near the model's decision boundary or out-of-distribution.** For maximum single-model consistency, use `model.onnx` (FP32).
|
| 128 |
|
| 129 |
```python
|
| 130 |
import onnxruntime as ort, numpy as np
|