Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,115 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model:
|
| 4 |
+
- keras/xception_41_imagenet
|
| 5 |
+
---
|
| 6 |
+
# Model Summary
|
| 7 |
+
|
| 8 |
+
This model is designed for detecting deepfake content in images and video frames. It uses a lightweight Convolutional Neural Network (CNN) trained on the **FaceForensics++ dataset**, focusing on high-resolution face manipulations (c23 compression). The model classifies whether a face in an input image is **real or fake**.
|
| 9 |
+
|
| 10 |
+
* Architecture: CNN-based binary classifier
|
| 11 |
+
* Input: Aligned and cropped face images (224x224 RGB)
|
| 12 |
+
* Output: Real or Fake label with confidence
|
| 13 |
+
* Accuracy: \~92% on unseen FaceForensics++ test set
|
| 14 |
+
|
| 15 |
+
## Usage
|
| 16 |
+
|
| 17 |
+
```python
|
| 18 |
+
from keras.models import load_model
|
| 19 |
+
import cv2
|
| 20 |
+
import numpy as np
|
| 21 |
+
|
| 22 |
+
model = load_model('deepfake_cnn_model.h5')
|
| 23 |
+
|
| 24 |
+
def preprocess(img_path):
|
| 25 |
+
img = cv2.imread(img_path)
|
| 26 |
+
img = cv2.resize(img, (224, 224))
|
| 27 |
+
img = img / 255.0
|
| 28 |
+
return np.expand_dims(img, axis=0)
|
| 29 |
+
|
| 30 |
+
input_img = preprocess('test_face.jpg')
|
| 31 |
+
pred = model.predict(input_img)
|
| 32 |
+
print("Fake" if pred[0][0] > 0.5 else "Real")
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
**Input shape**: `(1, 224, 224, 3)`
|
| 36 |
+
**Output**: Probability of being fake
|
| 37 |
+
|
| 38 |
+
⚠️ *Fails with very low-resolution images or occluded faces.*
|
| 39 |
+
|
| 40 |
+
## System
|
| 41 |
+
|
| 42 |
+
This model is **standalone**, usable in any face verification system or deepfake detection pipeline. Inputs should be properly aligned face crops. Output can be integrated into moderation systems or alerts.
|
| 43 |
+
|
| 44 |
+
**Dependencies**: Keras/TensorFlow, OpenCV for preprocessing
|
| 45 |
+
|
| 46 |
+
## Implementation requirements
|
| 47 |
+
|
| 48 |
+
* Trained on Google Colab with a single NVIDIA T4 GPU
|
| 49 |
+
* Training time: \~6 hours over 30 epochs
|
| 50 |
+
* Model inference: <50ms per image
|
| 51 |
+
* Memory requirement: \~150MB RAM at inference
|
| 52 |
+
|
| 53 |
+
# Model Characteristics
|
| 54 |
+
|
| 55 |
+
## Model initialization
|
| 56 |
+
|
| 57 |
+
The model was **trained from scratch** using CNN layers, ReLU activations, dropout, and batch normalization.
|
| 58 |
+
|
| 59 |
+
## Model stats
|
| 60 |
+
|
| 61 |
+
* Size: \~10MB
|
| 62 |
+
* Layers: \~8 convolutional layers + dense head
|
| 63 |
+
* Inference latency: \~40ms on GPU, \~200ms on CPU
|
| 64 |
+
|
| 65 |
+
## Other details
|
| 66 |
+
|
| 67 |
+
* Not pruned or quantized
|
| 68 |
+
* No use of differential privacy during training
|
| 69 |
+
|
| 70 |
+
# Data Overview
|
| 71 |
+
|
| 72 |
+
## Training data
|
| 73 |
+
|
| 74 |
+
* Dataset: FaceForensics++ (c23 compression level)
|
| 75 |
+
* Preprocessing: face alignment (using Dlib), resize to 224x224, normalization
|
| 76 |
+
* Augmentations: horizontal flip, brightness variation
|
| 77 |
+
|
| 78 |
+
## Demographic groups
|
| 79 |
+
|
| 80 |
+
The dataset contains celebrity faces scraped from YouTube. It includes a mix of ethnicities and genders, but **not balanced or labeled** explicitly by demographic.
|
| 81 |
+
|
| 82 |
+
## Evaluation data
|
| 83 |
+
|
| 84 |
+
* Train/Val/Test: 70% / 15% / 15%
|
| 85 |
+
* The test set includes unseen identities and manipulations (Deepfakes, FaceSwap, NeuralTextures)
|
| 86 |
+
|
| 87 |
+
# Evaluation Results
|
| 88 |
+
|
| 89 |
+
## Summary
|
| 90 |
+
|
| 91 |
+
* Accuracy: \~92%
|
| 92 |
+
* F1 Score: 0.91
|
| 93 |
+
* ROC-AUC: 0.95
|
| 94 |
+
|
| 95 |
+
## Subgroup evaluation results
|
| 96 |
+
|
| 97 |
+
No explicit subgroup evaluation was conducted, but performance dropped slightly on:
|
| 98 |
+
|
| 99 |
+
* Low-light images
|
| 100 |
+
* Images with occlusions (masks, hands)
|
| 101 |
+
|
| 102 |
+
## Fairness
|
| 103 |
+
|
| 104 |
+
No explicit fairness metrics were applied due to lack of demographic labels. However, output bias may exist due to uneven representation in training data.
|
| 105 |
+
|
| 106 |
+
## Usage limitations
|
| 107 |
+
|
| 108 |
+
* Struggles on low-res or occluded faces
|
| 109 |
+
* Doesn’t work on audio-based or voice deepfakes
|
| 110 |
+
* Requires good lighting and clear facial visibility
|
| 111 |
+
* Not suitable for legal or forensics-grade use cases without further testing
|
| 112 |
+
|
| 113 |
+
## Ethics
|
| 114 |
+
|
| 115 |
+
This model is intended for **educational and research purposes only**. It should not be used to make real-world judgments (legal, political, etc.) without human oversight. Deepfake detection systems must be transparent about their limitations and avoid misuse in surveillance or personal targeting.
|