With so many AI‐generated “faces” flooding the web, it has become more urgent than ever to know what's real and what's not. I wanted something simple and accessible: drag any headshot of a face instantly know if it’s “real” or “fake.”

What It Does:

Trains on 10 K real vs. 10 K AI‐generated faces from stable diffusion

Uses a truncated VGG-16 backbone + squeeze‐and‐excite attention + a tiny MLP head

Delivers a continuous “realness” score (0–1) via both a web UI and JSON API

Validates at 97.8 % accuracy on 24 K held-out test samples!

How I Built It:

Data: sampled 10 K/class for fast prototyping, intend on full 120 K/class for final runs

Model: froze the backbone, trained for 3 epochs, then unfroze and fine-tuned with staged OneCycleLR (per-layer LRs)

UI: FastAPI + Jinja2 + vanilla JS drag-&-drop → preview + confidence bar

Challenges & Wins

LR tuning took several tweaks to avoid “accuracy dips” when unfreezing

Lots of GPU and training issues that were overcome

Proud to have an end-to-end demo—drag an image, get a verdict—ready in under a minute!

What We Learned

The magic of per-group learning rates and OneCycleLR’s knobs

Integrating PyTorch into a FastAPI service (HTML + JSON)

What’s Next

Full test-set evaluation & ROC curve

Visuals and heatmaps

Dockerize for one-click deployment

Extend to video (frame-by-frame deepfake detection)

Threshold‐tuning UI so you can choose high‐precision vs. high‐recall

Built With

Share this project:

Updates