Synermix DeepFake Detection Framework

Case study
Python PyTorch Gradio OpenCV
Synermix DeepFake Detection Framework — screenshot 1Synermix DeepFake Detection Framework — screenshot 2
5
generators tested
GAN + diffusion
families covered
GradCAM
explainable verdicts

Overview

SynerMix is my BS Computer Science thesis — a novel data-augmentation method that improves how well a synthetic-image detector transfers across generative architectures. Built on T-GD (ICML 2020), it adds “synergistic mixing” during pretraining so a detector trained on one generator’s fakes better catches fakes from generators it has never seen. Done with my thesis partner, Immaculate Fallaria.

Context

Built over three semesters — from the second semester of third year through the end of fourth year. Synthetic faces carry subtle, model-specific fingerprints, so a detector trained on one generator often collapses on another — a StyleGAN2 detector fails on a Stable Diffusion image, and retraining for every new generator is impractical. T-GD tackles that transfer problem; our thesis asks whether smarter augmentation during pretraining makes the detector transfer better.

My Role

I built the system. I designed and implemented SynerMix — the augmentation method — along with the full training and evaluation harness (reproducibility, metrics, test suite, CI) and the Gradio demo. My partner, Immaculate Fallaria, led the research side: the review of related literature, feasibility analysis, and most of the documentation.

Architecture & Key Decisions

  • Base detector. T-GD’s EfficientNet-b0 real-vs-generated classifier, transferred across generators with L2-SP self-training; a ResNeXt backbone powers an ensemble mode. Evaluated across five modern sources spanning GANs (StyleGAN, StyleGAN2), diffusion models (Stable Diffusion, FLUX.1), and the DEFACTO manipulation set.
  • SynerMix — the contribution. Two complementary mixing strategies under a dynamic schedule:
    • Intra-class feature mixing — weighted blends of feature vectors within a class for tighter, more compact representations.
    • Inter-class CutMix — area-corrected CutMix across classes (the label weight matches the pasted-patch area) for honest boundary regularization.
    • Dynamic β schedule — a warm-up defers mixing until the backbone stabilizes, then β balances the two objectives — aiming for tighter clusters and better-calibrated decision boundaries than CutMix alone.
  • Reproducible and tested. Fixed seeds, per-run config/metrics export, a test suite (SynerMix, detector, metrics, reproducibility), CI, and a CPU smoke dataset so the whole pipeline runs without downloading gigabytes of data.
  • Explainable demo. A Gradio app returns a real/fake verdict plus a GradCAM heatmap showing where the detector looked.

Hardest Challenge

Two walls. First, making dual-mixing actually help instead of hurting it — naive mixing destabilizes training, which is why SynerMix defers mixing through a warm-up and then balances the intra- and inter-class objectives on a dynamic β schedule. Second, turning a 2020 research codebase into something reproducible and trustworthy — fixed seeds, exported per-run metrics, a test suite, CI, and a CPU smoke path — so results could be regenerated and compared rather than taken on faith.

Outcome & Impact

  • A novel augmentation, SynerMix, extending a published detection framework (T-GD) and evaluated across five modern sources spanning GAN and diffusion generators.
  • Reproducible research code — a test suite, CI, exported per-run metrics, and an explainable GradCAM-backed Gradio demo.