Update README.md
Browse files
README.md
CHANGED
@@ -13,15 +13,15 @@ model-index:
|
|
13 |
type: video-classification
|
14 |
name: Video Classification
|
15 |
dataset:
|
16 |
-
name:
|
17 |
-
type: image-folder
|
18 |
-
split:
|
19 |
metrics:
|
20 |
- type: accuracy
|
21 |
-
value: 0.
|
22 |
-
name: Accuracy
|
23 |
-
- type: f1
|
24 |
-
value: 0.94 #
|
25 |
name: F1 Score
|
26 |
---
|
27 |
# Deepfake Detection Model
|
@@ -74,13 +74,11 @@ pip install tensorflow opencv-python numpy mtcnn Pillow
|
|
74 |
The model weights are loaded from `COMBINED_best_Phase1.keras`. Ensure this file is accessible at the specified `model_path`.
|
75 |
|
76 |
```python
|
77 |
-
model_path = '
|
78 |
model = build_model() # Architecture defined in the `build_model` function
|
79 |
model.load_weights(model_path)
|
80 |
```
|
81 |
-
|
82 |
The `build_model` function defines the architecture as:
|
83 |
-
|
84 |
```python
|
85 |
import tensorflow as tf
|
86 |
from tensorflow import keras
|
@@ -109,27 +107,7 @@ def build_model(lstm_hidden_size=256, num_classes=2, dropout_rate=0.5):
|
|
109 |
return model
|
110 |
```
|
111 |
|
112 |
-
#### 3\.
|
113 |
-
|
114 |
-
Use the extract_faces_from_video function to get preprocessed face frames from your video. This function handles face detection (using MTCNN), resizing, and preprocessing.
|
115 |
-
```python
|
116 |
-
from mtcnn import MTCNN
|
117 |
-
import cv2
|
118 |
-
import numpy as np
|
119 |
-
from PIL import Image
|
120 |
-
from tensorflow.keras.applications.xception import preprocess_input
|
121 |
-
|
122 |
-
def extract_faces_from_video(video_path, num_frames=30):
|
123 |
-
# ... (function implementation to extract and preprocess faces)
|
124 |
-
pass
|
125 |
-
|
126 |
-
# Ensure TIME_STEPS is defined, as it's used by extract_faces_from_video
|
127 |
-
# TIME_STEPS = 30
|
128 |
-
video_path = 'path/to/your/video.mp4' # Replace with your video
|
129 |
-
video_array = extract_faces_from_video(video_path, num_frames=TIME_STEPS)
|
130 |
-
```
|
131 |
-
|
132 |
-
#### 4\. Prediction
|
133 |
|
134 |
Once the `video_array` (preprocessed frames) is ready, you can make a prediction using the loaded model:
|
135 |
|
|
|
13 |
type: video-classification
|
14 |
name: Video Classification
|
15 |
dataset:
|
16 |
+
name: FaceForensics++ & CelebDFv2 # Updated to reflect both datasets
|
17 |
+
type: image-folder # Refers to the processed frames from videos
|
18 |
+
split: test # Updated to reflect testing data
|
19 |
metrics:
|
20 |
- type: accuracy
|
21 |
+
value: 0.9593 # Updated with Test Accuracy
|
22 |
+
name: Test Accuracy
|
23 |
+
- type: f1
|
24 |
+
value: 0.94 # Using previous F1, if you have a specific test F1, update here
|
25 |
name: F1 Score
|
26 |
---
|
27 |
# Deepfake Detection Model
|
|
|
74 |
The model weights are loaded from `COMBINED_best_Phase1.keras`. Ensure this file is accessible at the specified `model_path`.
|
75 |
|
76 |
```python
|
77 |
+
model_path = ''
|
78 |
model = build_model() # Architecture defined in the `build_model` function
|
79 |
model.load_weights(model_path)
|
80 |
```
|
|
|
81 |
The `build_model` function defines the architecture as:
|
|
|
82 |
```python
|
83 |
import tensorflow as tf
|
84 |
from tensorflow import keras
|
|
|
107 |
return model
|
108 |
```
|
109 |
|
110 |
+
#### 3\. Prediction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
Once the `video_array` (preprocessed frames) is ready, you can make a prediction using the loaded model:
|
113 |
|