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.
Balanced subset: 16,000 REAL + 16,000 FAKE images.
π Usage
Install dependencies:
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
- Downloads last month
- 29