Technical case study
Deepfake Image Detection
A TensorFlow notebook compares a custom convolutional network with transfer learning using Xception for binary image classification.

Overview
The benchmark contains 140,000 face images from a real-image collection and a StyleGAN-generated collection. The experiment evaluates binary classification on the dataset’s predefined splits.
Problem
Authentic and generated faces can look similar to a person. A classifier can test whether learned image features separate the two categories in a defined dataset.
Objective
Compare a custom CNN baseline with a pretrained architecture and evaluate the models on held-out faces.
My approach
I used the dataset’s train, validation, and test CSVs to prepare labeled image batches, then compared a custom CNN with a classifier head trained on top of frozen Xception features.
Technology stack
- Python
- TensorFlow
- Keras
- CNN
- Transfer Learning
- Xception
Architecture
-
Face images
Read file paths and labels from the benchmark split CSVs.
-
Preprocessing
Prepare and transform images for TensorFlow batches.
-
Feature extraction
Train convolutional layers or reuse a frozen ImageNet Xception base.
-
Binary head
Map the extracted features to an authentic or synthetic prediction.
-
Evaluation
Compare predictions with held-out labels using accuracy and classification diagnostics.
Key engineering decisions
- Keep a custom CNN baseline alongside transfer learning so there is a concrete comparator.
- Use the provided train, validation, and test splits to distinguish training from evaluation.
- Inspect a confusion matrix and class-level reports to see where errors occur.
Implementation details
- Build the custom model using convolution, pooling, dropout, and a sigmoid output.
- Train a dense classification head above the frozen Xception base.
- Evaluate on test batches and compute classification reports.
Results and limitations
The README reports over 98% test accuracy on its Real and Fake Faces benchmark. Its synthetic faces come from a particular generator. Performance with other generators, compression, or images from different sources has not been established.
Lessons learned
A high benchmark result still leaves a generalization question. Testing other generators and image pipelines would show which features transfer beyond this dataset.