Introduction
Traditional deepfake detection methods typically frame the problem as a binary classification task, training models to distinguish between "real" and "fake" samples. However, this approach faces significant hurdles: the constant need for massive, balanced datasets and poor generalization to unseen forgery techniques. As new manipulation methods emerge, binary classifiers often fail to detect them because they have overfitted to the specific artifacts of their training data.
OC-FakeDect addresses these challenges by reframing deepfake detection as an anomaly detection problem. Instead of learning what a "fake" looks like, the model uses a One-Class Variational Autoencoder (OC-VAE) to learn the underlying distribution of "real" human faces. Any image that deviates significantly from this learned "realness" is flagged as a forgery, regardless of the specific technique used to create it.
Methodology
The core of OC-FakeDect is a VAE that maps input images into a probabilistic latent space. The researchers proposed two distinct architectural variations to calculate an "anomaly score":
- OC-FakeDect-1: A standard VAE setup where the anomaly score is the Root Mean Squared Error (RMSE) between the original input image ($X$) and its reconstruction ($X'$).
- OC-FakeDect-2: A more advanced approach that introduces a second encoder after the decoder. It calculates the RMSE between the latent representation of the original image ($\mu(X)$) and the latent representation of the reconstructed image ($\mu(X')$).
The intuition behind OC-FakeDect-2 is that pixel-level comparisons are often sensitive to noise or lighting. By comparing high-level latent features, the model can focus on structural and semantic anomalies. For a real image, the decoder produces a faithful reconstruction, leading to similar latent features. For a fake image, the decoder—trained only on real faces—struggles to reconstruct the "unnatural" features, resulting in a large discrepancy in the latent space.
Experimental Setup
The model was evaluated using the FaceForensics++ (FF++) benchmark, which includes five types of facial manipulations: Deepfakes (DF), FaceSwap (FS), Face2Face (F2F), NeuralTextures (NT), and Deepfake-detection (DFD). The training set consisted of 30,000 real images extracted from YouTube videos. Testing was conducted on balanced sets of 500 real and 500 fake images for each category.
Key Results and Discussion
OC-FakeDect-2 demonstrated superior performance, often outperforming binary classifiers that had the advantage of seeing fake data during training. Notably, it achieved 97.5% accuracy on the NeuralTextures (NT) dataset, surpassing the XceptionNet binary classifier by 18.5%.
As shown in the score distributions, the model effectively separates real and fake images. By setting a threshold at the 80th percentile of the training distribution, the model can reliably identify anomalies. On the DFD subset, the model reached an F1-score of 0.982, indicating high precision and recall.
Visual analysis using GradCAM further supported these results. While real images showed natural, spread-out attention across facial features, fake images resulted in disordered and dispersed activation maps, confirming that the model flags unnatural textures and boundaries.
Conclusion and Future Work
OC-FakeDect proves that learning "realness" is a powerful strategy for robust deepfake detection. By focusing on the manifold of real faces, the model becomes inherently more resilient to "zero-day" forgery techniques. Future research will focus on developing more sophisticated, learnable anomaly scoring metrics and testing the model's performance on more diverse datasets, including images generated entirely by GANs.
Summary updated