File size: 1,934 Bytes
93eec1c 394e95f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
---
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 |