Deep-Fake-Detector
Classroom CNN experiment on real and face-swap images; about 94% on an internal evaluation.
Summer 2024 · Machine learning · Archived experiment

Stack
Stack: Python · TensorFlow · Keras · InsightFace · TensorFlow.js · BlazeFace · React
A still-image class experiment: FFHQ photographs for the real class and InsightFace-generated face-swaps for the fake class.
Log
Summer 2024 — UTD research class
Two weeks of fundamentals — model architectures, use cases, a detour through reinforcement learning — and a final brief: pick a thing and train a CNN on it. The brief picked itself.
The pipeline
Six steps on the whiteboard: collect a dataset, clean it, augment it, define the layers, train and test, ship. The model was step four. Almost everything that mattered happened before it.
The 'real' half — FFHQ
NVlabs' Flickr-Faces-HQ (FFHQ) is a GAN-benchmark dataset of real photographs. I used its portraits as the real class for this experiment.

Real-photo examples from FFHQ. The 'fake' half — InsightFace
I generated still-image face-swaps with InsightFace by selecting a source and target photo and saving the swapped frame. This created the fake-image class for the experiment; performance on broader deepfakes or video was not established.

Source + target → result. The fake class, generated one frame at a time. Architecture
Sequential CNN — four Conv2D blocks (32 → 64 → 128 → 128, 3×3, ReLU) with a MaxPool after each, Flatten, two Dropout(0.5) gates around a Dense(512) head, sigmoid out for binary. Standard shape, no surprises.

The stack. Input on top, sigmoid verdict on the bottom. Trial and error — unbalanced data
The 10-epoch run reported 60%, the 50-epoch run 75%, and the 100-epoch balanced-data run about 94%. The architecture stayed the same; the runs changed the data balance and training duration.

Three runs, same architecture. Different shape of data, different shape of curve. Final result
The internal class-project evaluation reported about 94% accuracy. Performance beyond the evaluated images, including on video deepfakes, was not established.
Browser deploy
Converted the .h5/Keras weights into a TensorFlow.js JSON folder, dropped them into a React/Tailwind page, and put BlazeFace upstream of the CNN to crop the face out of any uploaded image. Drag a photo into the upload zone, get a verdict in the browser. Pushed to GitHub Pages as deepdetect.github.io.

The shipped page. CNN running in the browser, BlazeFace cropping the face before it ever sees the model.
Gallery

Result
~94% reported internal class-project evaluation
What I learned
The architecture stayed the same across the project runs, while the reported result changed with data balance and training duration. The internal class-project evaluation reported about 94%; performance on other image sources or video was not established. Most of the work sat before model definition: choosing a real-photo dataset, generating still-image swaps, and balancing the classes. Once the weights existed, they were a few megabytes of JSON the browser could load with TensorFlow.js.