Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 DeepScan – Deepfake Detection Suite

Desktop GUI (PyQt5) + Web API (Flask).
Video analysis via Optical Flow & ensemble models. Image analysis via Autoencoder & CBAM attention.
PDF/HTML reports with error maps. Batch processing. Screen recording.


Why Deepfake Detection?

Deepfakes are no longer science fiction – they are reality. Hyper-realistic manipulations of faces, voices, and movements are spreading at an alarming rate. The consequences: disinformation, reputational damage, fraud, and a steady erosion of trust in audiovisual evidence.

Anyone who still believes deepfakes are recognizable by rough edges or jerky movements has lost touch. Modern deepfakes are pixel-perfect, temporally coherent, and often indistinguishable from genuine recordings.

Detection must therefore go deeper – to the level of motion, temporal consistency, and statistical anomalies. That is exactly what DeepScan does.


How DeepScan Works (Without Giving Away the Farm)

DeepScan combines multiple independent analysis methods that look at different aspects of a video or image:

  • Optical Flow Analysis – examines motion patterns between frames. Deepfakes often show subtle inconsistencies in how pixels move over time.
  • Ensemble Models – multiple classifiers (not just XGBoost) work together. Each model looks for different types of artifacts. The ensemble decision is more robust than any single model.
  • Autoencoder Reconstruction – for images, an autoencoder with CBAM attention tries to rebuild the input. Deepfakes show higher reconstruction error because they lack the statistical regularities of real images.
  • Error Maps – visual heatmaps that highlight regions where the model detects anomalies. Useful for human verification.

The system does not rely on a single "magic bullet". It combines multiple signals to reach a decision. This makes it harder to fool and more reliable in practice.


The Problem with Deepfakes – A Deeper Look

Deepfakes are created using generative models – primarily GANs (Generative Adversarial Networks) and diffusion models. These models learn the statistical distribution of real faces and then generate new samples that look like they come from the same distribution.

The problem is that these models are not perfect. They introduce subtle artifacts that are invisible to the human eye but detectable by statistical analysis:

Temporal Inconsistencies
GANs generate frames independently or with limited temporal coherence. Even the best video-based GANs struggle to maintain perfect consistency across hundreds of frames. The result: micro-jitter, unnatural motion patterns, and flickering in specific frequency bands.

Spectral Artifacts
The upsampling layers in GANs introduce characteristic patterns in the frequency domain. These are invisible in pixel space but show up clearly in Fourier or wavelet transforms.

Statistical Irregularities
Real images have certain statistical properties – the distribution of gradients, the relationship between color channels, the fractal dimension of edges. GAN-generated images deviate from these distributions in measurable ways.

Attention Misalignment
Deepfakes often struggle with fine-grained spatial alignment – eyes that don't quite look in the same direction, teeth that don't align properly, subtle asymmetries that shouldn't exist.

Noise Patterns
The noise in real images comes from the camera sensor and follows a specific distribution. Deepfakes have different noise characteristics – often too smooth or too patterned.

DeepScan's ensemble approach targets all of these weaknesses simultaneously. Each model focuses on a different type of artifact. The ensemble decision is far more robust than any individual detector.


Why Traditional Detection Fails

Most deepfake detectors on the market today are single-model classifiers trained on a specific dataset. They work well on the data they were trained on but fail in the real world because:

Dataset Bias
The model learns patterns specific to the training data (e.g., a particular GAN architecture or a particular video compression level). When faced with a different GAN or different compression, performance plummets.

Overfitting
The model memorizes the training data rather than learning generalizable features. This leads to high accuracy on the test set but poor performance on truly novel samples.

Single Point of Failure
If the model has a blind spot – a particular type of artifact it doesn't detect – an attacker can exploit it. A single model is only as good as its weakest feature.

Lack of Explainability
Most detectors are black boxes. You get a number (e.g., "87% confidence") but no explanation of why the model made that decision. This makes it hard to trust the output and harder to improve the system.

DeepScan addresses all these issues through its ensemble architecture, multi-modal feature extraction, and visual error maps that explain every decision.


A Word on the State of Things

Let's be honest: the broader ecosystem around deepfake detection is a mess.

Policy and regulation – The EU AI Act is a bureaucratic monster that slows down research without addressing the actual problem. Lawmakers understand neither the technology nor the threat landscape. They write laws that sound good in press releases but do nothing to stop the spread of disinformation.

Tech platforms – The major platforms have spent billions on content moderation but have failed to deploy effective deepfake detection. Why? Because detection is hard, and it's easier to claim you're doing something than to actually do it. The incentives are misaligned: platforms profit from engagement, not from truth.

Influencers and media – The average influencer has zero technical literacy. They spread deepfakes as "proof" of whatever conspiracy theory is trending, then deny responsibility when confronted. The media is no better – they run sensationalist stories about deepfakes without understanding the technology, creating panic while simultaneously spreading misinformation.

The research community – Most deepfake detection papers are academic exercises that don't transfer to the real world. The datasets are toy problems. The metrics are misleading. The findings don't replicate. It's a field full of noise, with very little signal.

I'm a solo researcher. I built this system because I needed it – not because I expected to make money or get recognition. The reality is that as a solo researcher, further development doesn't make economic sense. The effort required to keep up with new GAN architectures, new datasets, new attack strategies – it's a full-time job for a team, not a side project for one person.

So here it is: my work, my code, my approach. Use it, improve it, or ignore it. I don't care. But don't come to me with questions about how to train your own models – that's your problem. I've shown what's possible. What you do with it is up to you.


Quick Start

Desktop: python play.py
Web API: python api.py


Test Material

Two playlists with extensive test samples:


FAQ – Frequently Asked Questions

What models are used internally?
DeepScan uses an ensemble of models. The exact composition is not disclosed to prevent attackers from reverse-engineering the detection system. If you want to know more, read the code – it's all there. I'm not going to explain it to you.

Can I use this for commercial purposes?
Yes, the code is MIT licensed. You can use, modify, and distribute it freely. The license only applies to the source code – not to any pre-trained models. If you make money with it, good for you. I don't expect a cut.

Where are the pre-trained models?
There are no pre-trained models included in this repository. You need to train your own models or acquire them from a third party. The code provides the framework – the models are your responsibility. If you can't figure out how to train a model, this project is not for you.

How do I train my own models?
The training pipeline is not part of this repository. You need to implement your own training infrastructure. The analysis code assumes you have models that follow the expected API (predict() and predict_proba() for the video model, forward() for the autoencoder). If you don't know what that means, stop reading and go back to school.

Can I use the video analysis without a model?
No. The video analysis requires an XGBoost model (or any model that supports the scikit-learn API with feature_names_in_). The code expects a specific interface – if you can't provide that, the system won't work. This is not a toy for beginners.

Can I use the image analysis without a model?
No. The image analysis requires an autoencoder model (PyTorch) with the architecture defined in api.py. The architecture is documented in the code – if you can't understand it, you shouldn't be using this system.

Why is the web API exposing error maps?
Error maps are visual explanations of the model's decision. They show which regions of the image contributed to the anomaly score. This is useful for human verification and forensic analysis. If you don't need them, you can turn them off.

Is this system foolproof?
No detection system is 100% accurate. DeepScan is a tool – not a silver bullet. It should be used as part of a broader verification strategy, not as a standalone truth machine. If someone claims 99.9% accuracy, they're lying or delusional. Trust no one.

What formats are supported?
Video: .mp4, .avi, .mov. Images: .jpg, .jpeg, .png, .bmp, .tiff. If your format isn't supported, convert it yourself. I'm not adding support for obscure formats.

Can this detect all types of deepfakes?
The system detects facial manipulation artifacts. It is designed for face-based deepfakes – not for other types of manipulation (e.g., object insertion, scene manipulation). If you're analyzing something else, you're on your own.

Is the web API production-ready?
The Flask API is a proof of concept. It is not optimized for high throughput, security, or scalability. If you want to deploy it in production, you will need to add authentication, rate limiting, input validation, and possibly a more robust server (e.g., Gunicorn, Waitress). If you deploy it as-is and it gets hacked, that's your problem.

Can I use this as a real-time detector?
The video analysis processes frames sequentially. Performance depends on your hardware and the model size. On a modern GPU, the autoencoder can run in near real-time. The video analysis (optical flow + XGBoost) is CPU-bound but can process 10-30 FPS on a decent machine. If it's too slow, buy better hardware. I'm not optimizing for your aging laptop.

Is this a replacement for professional forensic tools?
No. DeepScan is a research prototype and a demonstration of how ensemble methods can improve deepfake detection. It is not a certified forensic tool. Use it with caution and always cross-check results with other methods. If you need court-admissible evidence, hire a professional.


Contact

Serious inquiries only.

ProtonMail: blende_32@protonmail.com
Threema: BA46EWMP

Before contacting me:

  • Provide full name and institution
  • State your concrete purpose
  • Don't ask for code or access – it will be ignored
  • No beggars, no influencers, no hipsters
  • If you're not a professional, don't waste my time

Research Context & Further Reading

The problem of deepfake detection is actively researched across multiple disciplines: computer vision, machine learning, digital forensics, and media psychology. Some key areas of investigation:

Temporal Artifact Detection
Optical flow analysis (as used in DeepScan) is a well-established method. Other temporal approaches include analysis of facial micro-expressions, heartbeat detection via subtle color changes, and analysis of eye blinking patterns.

Frequency-Domain Analysis
Deepfakes often show characteristic patterns in the frequency domain. Fourier and wavelet transforms can reveal these artifacts.

Statistical Forensics
Detection based on statistical properties of images (e.g., noise distribution, color channel correlations, gradient histograms).

Chain-of-Custody Verification
Cryptographic signatures and digital watermarking to verify the provenance of a video.

Human-in-the-Loop Systems
Combining automated detection with human judgment. Error maps (as generated by DeepScan) are a step in this direction.

Adversarial Robustness
Training detectors that are robust to adversarial attacks – i.e., images specifically crafted to fool the detector.

Generalization & Domain Shift
Building detectors that work across different GAN architectures, video compression levels, and recording conditions.

DeepScan sits at the intersection of several of these approaches: it uses optical flow (temporal), ensemble models (statistical), and error maps (explainability).


Important Note

This repository does not contain pre-trained models.
The detection works only with your own or externally obtained models.


License

MIT

About

Deepfake detection suite with desktop GUI (PyQt5) and web API (Flask). Analyzes videos using optical flow + XGBoost and images using autoencoder with CBAM attention. Generates PDF/HTML reports with error maps. Models not included.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages