ConsistencyDeepfakeDetector<T>

Models & Types · AiDotNet.Safety.Image

Detects deepfake/AI-generated images by checking spatial consistency and natural image statistics violations.

Inheritance: ModelBase<T, Vector<T>, Vector<T>> → SafetyModuleBase<T> → ImageSafetyModuleBase<T> → DeepfakeDetectorBase<T> → ConsistencyDeepfakeDetector<T>

For Beginners

Real photos have certain statistical patterns — for example, noise is usually consistent across the image, and edges follow natural gradients. AI-generated images often have subtly wrong noise patterns or edges that look slightly “off”. This detector checks for those inconsistencies.

How It Works

Real images follow natural image statistics (NIS) — predictable relationships between neighboring pixels, consistent noise patterns, and regular edge profiles. AI-generated images often violate these statistics: inconsistent noise levels across regions, unnatural symmetry patterns, and edge artifacts. This detector measures multiple NIS features and flags images with anomalous combinations.

References:

  • NACO: Self-supervised natural consistency for face forgery detection (ECCV 2024, arxiv:2407.10550)
  • Spatio-temporal consistency exploitation for deepfake detection (2025, arxiv:2502.08216)
  • Rich and poor texture analysis for deepfake detection (2023)
  • Generalizable deepfake detection (CVPR 2025, arxiv:2508.06248)

Constructors

Constructor Summary
ConsistencyDeepfakeDetector(double threshold, int gridSize) Initializes a new consistency-based deepfake detector.

Properties

Property Summary
string ModuleName { get; }

Methods

Method Summary
IReadOnlyList<SafetyFinding> EvaluateImage(Tensor<T> image)
double GetDeepfakeScore(Tensor<T> image)