How under-the-horizon/deepfake_detection works
Deepfake_Detection trains a frame-based real/fake classifier and provides both command-line and Gradio video inference, plus benchmark evaluation. Inference samples and preprocesses frames, runs the detector, averages class probabilities, and reports a verdict. Training builds Celeb-DF frame batches, combines classification and contrastive losses, and saves the best weights. The README describes broader hybrid-model capabilities; sampled implementation shows a CNN feature extractor, spatial Transformer, and Conv1D head, but not a separate Siamese or Swin implementation. Edges reflect explicit calls and documented behavior in the excerpts.
Main entry points: detector.py Detector orchestrator · train.py Training loop · infer.py CLI inference · evaluate.py Evaluation run
Components 19
Training Data & Learning
- Celeb-DF dataset
data/dataset.py - Run configuration
configs/config.py - Training loop
train.py - Contrastive loss
losses/contrastive.py - Saved detector weights
configs/config.py
Detection Model
- Detector orchestrator
models/detector.py - CNN feature extractor
models/components.py - Spatial Transformer
models/components.py - Conv1D classifier
models/components.py
Video Inference
- CLI inference
infer.py - Gradio interface
app.py - Frame sampling & prep
infer.py - Web frame prep
app.py - Video verdict
infer.py - Web result
app.py
Model Assessment
- Evaluation run
evaluate.py - Classification metrics
evaluate.py
Other components
- Video user
- Training run
Connections 25
- Training run → Training loop: starts
train.py - Training loop → Run configuration: reads
train.py - Training loop → Celeb-DF dataset: loads batches
train.py - Training loop → Detector orchestrator: trains
train.py - Training loop → Contrastive loss: computes loss
train.py - Training loop → Saved detector weights: saves best
train.py - Detector orchestrator → CNN feature extractor: calls
models/detector.py - Detector orchestrator → Spatial Transformer: calls
models/detector.py - Detector orchestrator → Conv1D classifier: calls
models/detector.py - Video user → Gradio interface: uploads video
app.py - Gradio interface → Web frame prep: preprocesses
app.py - Gradio interface → Detector orchestrator: classifies frames
app.py - Gradio interface → Web result: returns verdict
app.py - Training run → CLI inference: runs inference
infer.py - CLI inference → Run configuration: reads
infer.py - CLI inference → Saved detector weights: loads
infer.py - CLI inference → Frame sampling & prep: extracts frames
infer.py - CLI inference → Detector orchestrator: classifies frames
infer.py - CLI inference → Video verdict: averages probabilities
infer.py - Training run → Evaluation run: runs evaluation
evaluate.py - Evaluation run → Run configuration: reads
evaluate.py - Evaluation run → Saved detector weights: loads
evaluate.py - Evaluation run → Celeb-DF dataset: loads test data
evaluate.py - Evaluation run → Detector orchestrator: evaluates
evaluate.py - Evaluation run → Classification metrics: computes
evaluate.py