Fine-tuned model on Real and Fake Faces dataset with improvements
Browse files- .gitattributes +1 -0
- README.md +38 -0
- config.json +24 -0
- model.safetensors +3 -0
- preprocessor_config.json +23 -0
- training_plots.png +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
training_plots.png filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
tags:
|
4 |
+
- deepfake-detection
|
5 |
+
- image-classification
|
6 |
+
- real-and-fake-faces
|
7 |
+
---
|
8 |
+
|
9 |
+
# Deepfake Image Detector (Real and Fake Faces Fine-Tuned)
|
10 |
+
|
11 |
+
## Model Performance
|
12 |
+
- Test Accuracy: 88.37%
|
13 |
+
- Best Validation Accuracy: 91.76%
|
14 |
+
- Best Epoch: 4
|
15 |
+
- Planned Epochs: 12
|
16 |
+
- Actual Epochs Trained: 8 (early stopping applied)
|
17 |
+
|
18 |
+
## Dataset
|
19 |
+
- Training: 1,367 images
|
20 |
+
- Validation: 170 images
|
21 |
+
- Test: 172 images
|
22 |
+
|
23 |
+
## Training Details
|
24 |
+
Training was stopped early at epoch 8 due to early stopping criteria being met.
|
25 |
+
The best model was achieved at epoch 4 with validation accuracy of 91.76%.
|
26 |
+
|
27 |
+
## Usage
|
28 |
+
```python
|
29 |
+
from transformers import ViTForImageClassification, ViTFeatureExtractor
|
30 |
+
|
31 |
+
model = ViTForImageClassification.from_pretrained('shivani1511/deepfake-image-detector-new-latest-v2')
|
32 |
+
feature_extractor = ViTFeatureExtractor.from_pretrained('shivani1511/deepfake-image-detector-new-latest-v2')
|
33 |
+
```
|
34 |
+
|
35 |
+
## Notes
|
36 |
+
- Fine-tuned on Real and Fake Faces dataset to address AI-generated fake detection.
|
37 |
+
- Base model: shivani1511/deepfake-image-detector-new-latest (Vision Transformer).
|
38 |
+
- Improvements: Enhanced data augmentation, class-weighted loss, Mixup, more unfrozen layers.
|
config.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"ViTForImageClassification"
|
4 |
+
],
|
5 |
+
"attention_probs_dropout_prob": 0.0,
|
6 |
+
"encoder_stride": 16,
|
7 |
+
"hidden_act": "gelu",
|
8 |
+
"hidden_dropout_prob": 0.0,
|
9 |
+
"hidden_size": 768,
|
10 |
+
"image_size": 224,
|
11 |
+
"initializer_range": 0.02,
|
12 |
+
"intermediate_size": 3072,
|
13 |
+
"layer_norm_eps": 1e-12,
|
14 |
+
"model_type": "vit",
|
15 |
+
"num_attention_heads": 12,
|
16 |
+
"num_channels": 3,
|
17 |
+
"num_hidden_layers": 12,
|
18 |
+
"patch_size": 16,
|
19 |
+
"pooler_act": "tanh",
|
20 |
+
"pooler_output_size": 768,
|
21 |
+
"qkv_bias": true,
|
22 |
+
"torch_dtype": "float32",
|
23 |
+
"transformers_version": "4.51.3"
|
24 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:496ace032b8dcd934ab9e4a7f2453444d7b01725d509502eb36ce9bdd3ca41a0
|
3 |
+
size 343223976
|
preprocessor_config.json
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"do_convert_rgb": null,
|
3 |
+
"do_normalize": true,
|
4 |
+
"do_rescale": true,
|
5 |
+
"do_resize": true,
|
6 |
+
"image_mean": [
|
7 |
+
0.5,
|
8 |
+
0.5,
|
9 |
+
0.5
|
10 |
+
],
|
11 |
+
"image_processor_type": "ViTFeatureExtractor",
|
12 |
+
"image_std": [
|
13 |
+
0.5,
|
14 |
+
0.5,
|
15 |
+
0.5
|
16 |
+
],
|
17 |
+
"resample": 2,
|
18 |
+
"rescale_factor": 0.00392156862745098,
|
19 |
+
"size": {
|
20 |
+
"height": 224,
|
21 |
+
"width": 224
|
22 |
+
}
|
23 |
+
}
|
training_plots.png
ADDED
![]() |
Git LFS Details
|