Wahb12111's picture
Upload README.md with huggingface_hub
5afbf20 verified
---
title: Deepfake Image Classification
colorFrom: blue
colorTo: pink
sdk: keras
tags:
- deepfake
- image-classification
- computer-vision
- efficientnet
license: mit
app_file: Deepfake_Image_Classification.ipynb
model-index:
- name: deepfake_image_classification_model
results: []
---
# Deepfake Image Classification
This repository contains a TensorFlow/Keras model trained to classify **REAL vs FAKE (deepfake) images**.
The model is based on **EfficientNetB4** with data augmentation and fine-tuning.
## πŸ“‚ Files
- `deepfake_image_classification_model.keras` – trained Keras model.
- `Deepfake_Image_Classification.ipynb` – full training notebook (Google Colab).
## 🧠 Model Details
- Backbone: EfficientNetB4 (pretrained on ImageNet).
- Input size: `224 x 224 x 3` RGB images.
- Output: Binary classification (REAL = 0, FAKE = 1).
- Loss: `binary_crossentropy`.
- Optimizer: `Adam (lr=0.001)`.
## πŸ“Š Dataset
Trained on [Deepfake Faces dataset](https://www.kaggle.com/datasets/dagnelies/deepfake-faces).
Balanced subset: 16,000 REAL + 16,000 FAKE images.
## πŸš€ Usage
Install dependencies:
```bash
pip install tensorflow
Load and use the model:
python
Copy code
import tensorflow as tf
# Load model
model = tf.keras.models.load_model("deepfake_image_classification_model.keras")
# Preprocess image
img = tf.keras.utils.load_img("example.jpg", target_size=(224, 224))
x = tf.keras.utils.img_to_array(img)
x = tf.expand_dims(x, axis=0) # add batch dimension
# Predict
pred = model.predict(x)[0][0]
label = "FAKE" if pred > 0.5 else "REAL"
print(f"Prediction: {label} (score: {pred:.4f})")
πŸ“ˆ Performance
Validation Accuracy: ~92%
Test Accuracy: ~91%
πŸ““ Training
For full details of the training pipeline (dataset loading, augmentation, callbacks, etc.), check the notebook:
Deepfake_Image_Classification.ipynb