Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,81 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Here is the updated markdown description for your model:
|
| 2 |
+
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# CNN-Based Deepfake Detection Model
|
| 6 |
+
|
| 7 |
+
This repository contains a Convolutional Neural Network (CNN)-based model fine-tuned for deepfake detection. The model has been trained to classify images as either "real" or "fake" (deepfake) using a custom dataset of processed images.
|
| 8 |
+
|
| 9 |
+
## Model Overview
|
| 10 |
+
|
| 11 |
+
This model is a custom CNN architecture built specifically for deepfake detection. It has been designed to efficiently distinguish between real and fake images through a series of convolutional and pooling layers, followed by fully connected layers for classification.
|
| 12 |
+
|
| 13 |
+
### Key Features:
|
| 14 |
+
- **Model Architecture:** Convolutional Neural Network (CNN)
|
| 15 |
+
- **Input Size:** 128x128 pixels
|
| 16 |
+
- **Number of Classes:** 2 (Real, Fake)
|
| 17 |
+
- **Activation Function:** ReLU in hidden layers, Sigmoid for binary classification
|
| 18 |
+
- **Regularization:** L2 regularization and Dropout layers to prevent overfitting
|
| 19 |
+
- **Optimizer:** Adam with a learning rate of 0.0001
|
| 20 |
+
- **Training Epochs:** 100 epochs (with early stopping based on validation loss)
|
| 21 |
+
|
| 22 |
+
## Training Details
|
| 23 |
+
|
| 24 |
+
The model was trained on a custom dataset of real and deepfake images, using data augmentation techniques to improve generalization. The training process involved the following components:
|
| 25 |
+
|
| 26 |
+
- **Data Augmentation:** Random rotations, shifts, flips, and brightness adjustments.
|
| 27 |
+
- **Loss Function:** Binary Cross-Entropy Loss
|
| 28 |
+
- **Optimizer:** Adam with a learning rate of 0.0001
|
| 29 |
+
- **Callbacks:** Early stopping, learning rate scheduler, and model checkpointing were used to optimize training.
|
| 30 |
+
|
| 31 |
+
## Model Performance
|
| 32 |
+
|
| 33 |
+
The model was evaluated on a held-out test set. Below is the key performance metric:
|
| 34 |
+
|
| 35 |
+
- **Test Accuracy:** 71%
|
| 36 |
+
|
| 37 |
+
This accuracy reflects the model's ability to correctly identify real and deepfake images.
|
| 38 |
+
|
| 39 |
+
## Usage
|
| 40 |
+
|
| 41 |
+
You can use this model for inference by loading the model and running predictions on new images. Below is an example using TensorFlow/Keras:
|
| 42 |
+
|
| 43 |
+
```python
|
| 44 |
+
from tensorflow.keras.models import load_model
|
| 45 |
+
from tensorflow.keras.preprocessing import image
|
| 46 |
+
import numpy as np
|
| 47 |
+
|
| 48 |
+
# Load the trained model
|
| 49 |
+
model = load_model('cnn_model.h5')
|
| 50 |
+
|
| 51 |
+
# Load and preprocess the image
|
| 52 |
+
img_path = 'path_to_your_image.jpg'
|
| 53 |
+
img = image.load_img(img_path, target_size=(128, 128))
|
| 54 |
+
img_array = image.img_to_array(img) / 255.0
|
| 55 |
+
img_array = np.expand_dims(img_array, axis=0)
|
| 56 |
+
|
| 57 |
+
# Make a prediction
|
| 58 |
+
prediction = model.predict(img_array)
|
| 59 |
+
print('Real' if prediction[0][0] < 0.5 else 'Fake')
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
## How to Use
|
| 63 |
+
|
| 64 |
+
1. **Clone the repository**:
|
| 65 |
+
```bash
|
| 66 |
+
git clone https://github.com/MaanVader/DeepFake-Detection-model.git
|
| 67 |
+
cd DeepFake-Detection-model.git
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
2. **Run Inference**:
|
| 71 |
+
Use the provided script or the sample code above to run inference on your images.
|
| 72 |
+
|
| 73 |
+
## License
|
| 74 |
+
|
| 75 |
+
This project is licensed under the MIT License. Feel free to use and modify the model as needed.
|
| 76 |
+
|
| 77 |
+
## Acknowledgments
|
| 78 |
+
|
| 79 |
+
Thanks to the various open-source projects and contributors whose work has made this project possible.
|
| 80 |
+
|
| 81 |
+
---
|