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

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using necrosyth/deepfake_detection_using_resnet 1