Instructions to use desireemcv/vit-face-real-vs-fake with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use desireemcv/vit-face-real-vs-fake with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="desireemcv/vit-face-real-vs-fake") 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("desireemcv/vit-face-real-vs-fake") model = AutoModelForImageClassification.from_pretrained("desireemcv/vit-face-real-vs-fake", device_map="auto") - Notebooks
- Google Colab
- Kaggle
vit-face-real-vs-fake
This model is a fine-tuned version of google/vit-base-patch16-224-in21k on the desireemcv/face-real-vs-fake dataset. It achieves the following results on the evaluation set:
- Loss: 0.2046
- Accuracy: 0.9467
Model description
More information neeThis model is a fine-tuned Vision Transformer (ViT-Base) for binary image classification of human faces as either REAL (authentic photographs) or FAKE (AI-generated). It was fine-tuned from google/vit-base-patch16-224-in21k on the Computer Vision Face Classification Dataset (v2.0, 2026), which contains facial images sourced from Unsplash (real) and various AI generation methods (fake).
The model achieves 94.67% accuracy on the test set, with balanced performance across both classes (F1=0.94 for FAKE, F1=0.95 for REAL). It was trained for 4 epochs using PyTorch and the Hugging Face Transformers library on a Google Colab T4 GPU.ded
Intended uses & limitations
This model is intended for detecting AI-generated facial images (deepfakes) in binary classification scenarios. It can be used as a baseline for deepfake detection research or as a component in content authenticity verification pipelines.
Limitations:
- Trained on a specific set of AI generation methods; may not generalize to newer deepfake techniques.
- Approximately 14% of original dataset images were unavailable during download, reducing training data.
- Not evaluated against adversarial post-processing (compression, cropping, filters).
- Designed for frontal face images only; performance may degrade on non-frontal or occluded faces.
Training and evaluation data
More information needed
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 0.0002
- train_batch_size: 16
- eval_batch_size: 16
- seed: 42
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: linear
- num_epochs: 4
- mixed_precision_training: Native AMP
Training results
| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|---|---|---|---|---|
| 0.2606 | 1.0 | 195 | 0.1915 | 0.9524 |
| 0.2163 | 2.0 | 390 | 0.1641 | 0.9472 |
| 0.1764 | 3.0 | 585 | 0.1451 | 0.9498 |
| 0.1469 | 4.0 | 780 | 0.1253 | 0.9524 |
Framework versions
- Transformers 5.9.0
- Pytorch 2.10.0+cu128
- Datasets 4.8.5
- Tokenizers 0.22.2
- Downloads last month
- 70
Model tree for desireemcv/vit-face-real-vs-fake
Base model
google/vit-base-patch16-224-in21k