|
|
--- |
|
|
tags: |
|
|
- vision |
|
|
- image-classification |
|
|
- vit |
|
|
- transformer |
|
|
- fake-image-detection |
|
|
license: apache-2.0 |
|
|
datasets: |
|
|
- ciplab/real-and-fake-face-detection |
|
|
model-index: |
|
|
- name: SahAi |
|
|
results: |
|
|
- task: |
|
|
name: Image Classification |
|
|
type: image-classification |
|
|
dataset: |
|
|
name: Real and Fake Face Detection Dataset |
|
|
type: ciplab/real-and-fake-face-detection |
|
|
metrics: |
|
|
- name: Accuracy |
|
|
type: accuracy |
|
|
value: 99.12 |
|
|
- name: Precision |
|
|
type: precision |
|
|
value: 98.95 |
|
|
- name: Recall |
|
|
type: recall |
|
|
value: 99.00 |
|
|
--- |
|
|
|
|
|
# SahAi - Enhanced Fake Image Detection Model |
|
|
**SahAi** is a fine-tuned Vision Transformer (ViT) model designed for fake image localization in social media. |
|
|
|
|
|
### 🚀 Model Description |
|
|
- **Base Model:** ViT-B/16 |
|
|
- **Input Size:** 224x224 |
|
|
- **Output Classes:** Real (0), Fake (1) |
|
|
|
|
|
### 🔥 How to Use |
|
|
```python |
|
|
from transformers import ViTForImageClassification, AutoFeatureExtractor |
|
|
from PIL import Image |
|
|
import torch |
|
|
|
|
|
model = ViTForImageClassification.from_pretrained("SahilSha/SahAi") |
|
|
feature_extractor = AutoFeatureExtractor.from_pretrained("google/vit-base-patch16-224-in21k") |
|
|
|
|
|
image = Image.open("test_image.jpg").convert("RGB") |
|
|
inputs = feature_extractor(images=image, return_tensors="pt") |
|
|
|
|
|
with torch.no_grad(): |
|
|
outputs = model(**inputs) |
|
|
prediction = outputs.logits.argmax(-1).item() |
|
|
|
|
|
print("Real" if prediction == 0 else "Fake") |