DeepGuard: Deepfake Face Detection using ResNet + Frequency Analysis
Model Description
A deepfake detection model using a dual-stream architecture combining a spatial stream (ResNet50) and a frequency stream (DCT-based CNN) to identify AI-generated or face-swapped content in images and video.
Most deepfake detectors rely solely on spatial artifacts (blending edges, unnatural skin texture). This model additionally analyzes the frequency domain, where GAN-generated and diffusion-generated faces leave distinctive spectral fingerprints invisible to the human eye β making it substantially harder to fool with post-processing.
Architecture: Dual-Stream Fusion Network
Stream 1 β Spatial Stream (ResNet50)
- Backbone: ResNet50 pretrained on ImageNet
- Input: RGB face crop (224Γ224), normalized
- Modifications:
- Final FC layer replaced with 512-dim embedding layer
- Added CBAM (Convolutional Block Attention Module) after layer3 to focus on face boundaries, eyes, and mouth β regions most commonly artifacts in deepfakes
- Dropout(0.4) before embedding layer
- Output: 512-dim spatial feature vector
Stream 2 β Frequency Stream (DCT-CNN)
- Input: Grayscale face crop converted to frequency domain via
2D Discrete Cosine Transform (DCT)
- High-frequency components amplified (Γ3) before input β this is where GAN fingerprints concentrate
- Architecture: Lightweight 5-layer CNN
- Conv(1β32, 3Γ3) β BN β ReLU
- Conv(32β64, 3Γ3) β BN β ReLU β MaxPool
- Conv(64β128, 3Γ3) β BN β ReLU
- Conv(128β128, 3Γ3) β BN β ReLU β MaxPool
- GlobalAvgPool β FC(512)
- Output: 512-dim frequency feature vector
Fusion + Classifier
- Concatenate spatial + frequency vectors β 1024-dim
- FC(1024 β 256) β ReLU β Dropout(0.3)
- FC(256 β 1) β Sigmoid
- Output: Probability score [0,1] β 0 = real, 1 = fake
Full Inference Pipeline
Input: Image or Video β βΌ βββββββββββββββββββββββββββ β Face Detection β RetinaFace or MTCNN β β Extract all faces β crop + align β β Skip frames with no detected face βββββββββββββββββββββββββββ β ββββ΄βββββββββββββββ βΌ βΌ ββββββββββββ ββββββββββββββββ β RGB Crop β β Grayscale β β 224Γ224 β β β DCT β β Normalizeβ β β Amplify HF β ββββββββββββ ββββββββββββββββ β β βΌ βΌ ββββββββββββ ββββββββββββββββ β ResNet50 β β DCT-CNN β β + CBAM β β (5 layers) β β β 512-d β β β 512-d β ββββββββββββ ββββββββββββββββ β β ββββββββββ¬ββββββββββ βΌ βββββββββββββββββββ β Concatenate β 1024-dim β β FC(256) β β β Sigmoid β βββββββββββββββββββ β βΌ Per-face score: P(fake) [For Video]: Aggregate frame scores β temporal smoothing (rolling avg, window=8) β Final video-level verdict