| --- |
| tags: |
| - image-classification |
| - vision |
| - vit |
| - deepfake |
| - binary-classification |
| pipeline_tag: image-classification |
| language: en |
| license: apache-2.0 |
| --- |
| |
| # π§ Model1-v1-Rival β Deepfake Image Classifier |
|
|
| This model is a fine-tuned **Vision Transformer (ViT)** for detecting whether a face image is **REAL** or **FAKE (Deepfake)**. |
|
|
| It was trained using a mixed deepfake dataset with augmentations to ensure robustness across manipulation methods and compression artifacts. |
|
|
| --- |
|
|
| ## π Model Details |
|
|
| | Field | Value | |
| |-------|-------| |
| | Base Model | `google/vit-base-patch16-224-in21k` | |
| | Task | Image Classification (Binary) | |
| | Labels | `{0: Fake, 1: Real}` | |
| | File Format | `safetensors` | |
| | Optimizer | AdamW | |
| | Epochs | 2 | |
| | Learning Rate | `1e-6` | |
| | Batch Size | 32 | |
|
|
| --- |
|
|
| ## π·οΈ Labels |
|
|
| The model predicts: |
|
|
| | Label | Meaning | |
| |-------|---------| |
| | `fake` | manipulated / deepfake image | |
| | `real` | authentic human face | |
|
|
| --- |
|
|
| ## π Usage |
|
|
| #### π§ With `transformers` |
|
|
| ```python |
| from transformers import AutoModelForImageClassification, AutoImageProcessor |
| from PIL import Image |
| import torch |
| |
| model_name = "alrivalda/Model1-v1-Rival" |
| |
| processor = AutoImageProcessor.from_pretrained(model_name) |
| model = AutoModelForImageClassification.from_pretrained(model_name) |
| |
| img = Image.open("your_image.jpg") |
| |
| inputs = processor(img, return_tensors="pt") |
| outputs = model(**inputs).logits |
| probabilities = torch.softmax(outputs, dim=1) |
| |
| pred_id = torch.argmax(probabilities).item() |
| label = model.config.id2label[pred_id] |
| |
| print("Prediction:", label) |
| print("Confidence:", float(probabilities[0][pred_id])) |
| |