Commit
·
7fdab2a
1
Parent(s):
0e82ad7
updated readme
Browse files
README.md
CHANGED
|
@@ -14,11 +14,31 @@ safetensors:
|
|
| 14 |
total: 1
|
| 15 |
format: safetensors
|
| 16 |
weight_dtype: float32
|
| 17 |
-
size_in_bytes: 80000000
|
| 18 |
|
| 19 |
model-index:
|
| 20 |
- name: Deepfake Detection with Improved EfficientViT
|
| 21 |
-
results:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
config: config.json
|
| 23 |
metadata:
|
| 24 |
model_type: EfficientViT
|
|
@@ -90,19 +110,21 @@ pip install -r requirements.txt
|
|
| 90 |
```python
|
| 91 |
|
| 92 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 93 |
import torch
|
| 94 |
from model import ImprovedEfficientViT
|
| 95 |
-
from inference import predict_vedio
|
| 96 |
|
| 97 |
# 1️⃣ Download the checkpoint from Hugging Face
|
| 98 |
checkpoint_path = hf_hub_download(
|
| 99 |
repo_id="faisalishfaq2005/deepfake-detection-efficientnet-vit",
|
| 100 |
-
filename="model.
|
| 101 |
)
|
| 102 |
|
| 103 |
-
# 2️⃣ Load the model
|
|
|
|
| 104 |
model = ImprovedEfficientViT()
|
| 105 |
-
model.load_state_dict(
|
| 106 |
model.eval()
|
| 107 |
|
| 108 |
# 3️⃣ Run inference on a video
|
|
@@ -111,7 +133,6 @@ result = predict_vedio(video_path, model)
|
|
| 111 |
print(result)
|
| 112 |
# Example Output: {'class': 1}
|
| 113 |
|
| 114 |
-
|
| 115 |
```
|
| 116 |
# 2. Manual Download
|
| 117 |
|
|
|
|
| 14 |
total: 1
|
| 15 |
format: safetensors
|
| 16 |
weight_dtype: float32
|
| 17 |
+
size_in_bytes: 80000000
|
| 18 |
|
| 19 |
model-index:
|
| 20 |
- name: Deepfake Detection with Improved EfficientViT
|
| 21 |
+
results:
|
| 22 |
+
- task:
|
| 23 |
+
type: image-classification
|
| 24 |
+
name: Deepfake Detection
|
| 25 |
+
dataset:
|
| 26 |
+
type: custom
|
| 27 |
+
name: FaceForensics++,Celeb-DF
|
| 28 |
+
metrics:
|
| 29 |
+
- name: Accuracy
|
| 30 |
+
type: accuracy
|
| 31 |
+
value: 0.8864
|
| 32 |
+
- name: Precision
|
| 33 |
+
type: precision
|
| 34 |
+
value: 0.8920
|
| 35 |
+
- name: Recall
|
| 36 |
+
type: recall
|
| 37 |
+
value: 0.8792
|
| 38 |
+
- name: F1-score
|
| 39 |
+
type: f1
|
| 40 |
+
value: 0.8856
|
| 41 |
+
|
| 42 |
config: config.json
|
| 43 |
metadata:
|
| 44 |
model_type: EfficientViT
|
|
|
|
| 110 |
```python
|
| 111 |
|
| 112 |
from huggingface_hub import hf_hub_download
|
| 113 |
+
from safetensors.torch import load_file
|
| 114 |
import torch
|
| 115 |
from model import ImprovedEfficientViT
|
| 116 |
+
from inference import predict_vedio
|
| 117 |
|
| 118 |
# 1️⃣ Download the checkpoint from Hugging Face
|
| 119 |
checkpoint_path = hf_hub_download(
|
| 120 |
repo_id="faisalishfaq2005/deepfake-detection-efficientnet-vit",
|
| 121 |
+
filename="model.safetensors"
|
| 122 |
)
|
| 123 |
|
| 124 |
+
# 2️⃣ Load the model weights safely
|
| 125 |
+
state_dict = load_file(checkpoint_path)
|
| 126 |
model = ImprovedEfficientViT()
|
| 127 |
+
model.load_state_dict(state_dict)
|
| 128 |
model.eval()
|
| 129 |
|
| 130 |
# 3️⃣ Run inference on a video
|
|
|
|
| 133 |
print(result)
|
| 134 |
# Example Output: {'class': 1}
|
| 135 |
|
|
|
|
| 136 |
```
|
| 137 |
# 2. Manual Download
|
| 138 |
|