File size: 4,895 Bytes
732a082
 
 
 
 
 
 
d5a60ed
732a082
 
a6692c2
 
d5a60ed
732a082
043abbf
 
d5a60ed
732a082
ddb7181
d5a60ed
 
 
 
 
ddb7181
d5a60ed
 
 
 
 
 
732a082
d5a60ed
732a082
 
 
ddb7181
 
 
 
 
 
 
732a082
d5a60ed
 
732a082
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d5a60ed
732a082
 
 
 
 
 
 
d5a60ed
 
 
 
 
 
 
 
 
043abbf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---

license: apache-2.0
tags:
- deepfake-detection
- computer-vision
- pytorch
- image-classification
- audio-visual-sync
---


![RealityGuardAI Banner](realityguard_banner.jpg)

# ๐Ÿ›ก๏ธ RealityGuardAI: Complete Deepfake Detection Architecture

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.22282866.svg)](https://doi.org/10.5281/zenodo.22282866)

RealityGuardAI is an ultra-fast, highly optimized AI engine specifically designed to detect visual artifacts, behavioral anomalies, and audio-visual desynchronization commonly found in AI-generated Deepfake videos and images.

This Model Repository specifically hosts the **Lightweight Artifact CNN** weights, which act as the core deep learning visual detection module of the larger RealityGuardAI pipeline.

## ๐Ÿ—๏ธ Full Pipeline Architecture

![RealityGuardAI Architecture](architecture.jpg)

This CNN operates at **Stage 7.3** of our massive multimodal pipeline. To view, run, and experiment with the **entire pipeline** (including Lip-Sync Detection, Blink Analysis, Handcrafted Feature Extraction, and FastAPI integrations), please visit the official GitHub repository:

๐Ÿ‘‰ **[Satyam-123336/DeepFake-Detection on GitHub](https://github.com/Satyam-123336/DeepFake-Detection)**

---

## ๐Ÿง  Model Details (Lightweight Artifact CNN)
- **Architecture:** 3-Layer Sequential CNN with Adaptive Average Pooling and a 2-Layer MLP Head.
- **Parameters:** ~100KB (Highly optimized for edge-device CPU inference).
- **Task:** Binary Classification (0 = Real, 1 = Fake).
- **Format:** PyTorch State Dictionary (`.pt`).

## ๐ŸŽฏ Intended Use & Capabilities
This Model Repository hosts the weights specifically for the deep learning component (Stage 7.3) of RealityGuardAI. 

While the full pipeline uses classical OpenCV algorithms to detect lighting asymmetry and texture spread (Stage 7.2), this PyTorch CNN model is specifically designed to analyze raw facial crops to detect:
- **Generative AI artifacts** (GAN/Diffusion traces and upscaling noise)
- **Deep pixel-level blending inconsistencies** (where a fake face is stitched onto a real head)
- **Structural anomalies** generated by deepfake rendering engines

## ๐Ÿ’ป How to Use
You can easily integrate this CNN into your own PyTorch projects using the `huggingface_hub` library. It will automatically download the weights if they are missing locally.

```python

import torch

from huggingface_hub import hf_hub_download

from torch import nn



# 1. Define the Lightweight Architecture

class LightweightArtifactCNN(nn.Module):

    def __init__(self, num_classes: int = 2):

        super().__init__()

        self.features = nn.Sequential(

            nn.Conv2d(3, 16, kernel_size=3, stride=1, padding=1),

            nn.ReLU(inplace=True),

            nn.MaxPool2d(2),

            nn.Conv2d(16, 32, kernel_size=3, stride=1, padding=1),

            nn.ReLU(inplace=True),

            nn.MaxPool2d(2),

            nn.Conv2d(32, 64, kernel_size=3, stride=1, padding=1),

            nn.ReLU(inplace=True),

            nn.AdaptiveAvgPool2d((1, 1)),

        )

        self.classifier = nn.Sequential(

            nn.Flatten(),

            nn.Linear(64, 32),

            nn.ReLU(inplace=True),

            nn.Dropout(0.2),

            nn.Linear(32, num_classes),

        )

    def forward(self, x):

        return self.classifier(self.features(x))



# 2. Auto-Download and Load Weights

model = LightweightArtifactCNN()

weight_path = hf_hub_download(repo_id="Satysam-26/RealityGuardAI", filename="lightweight_artifact_cnn_1000_fresh.pt")

model.load_state_dict(torch.load(weight_path, map_location="cpu"))

model.eval()



print("Model successfully loaded and ready for inference!")

```

## ๐ŸŒฑ Environmental Impact
Unlike massive billion-parameter transformer models, the RealityGuardAI CNN is purposefully designed to be executed entirely on standard CPUs.
- **Hardware Type:** CPU-Optimized
- **Carbon Emitted:** Negligible compared to standard GPU-bound Video AI systems.

## โš ๏ธ Limitations & Bias
- **Resolution Sensitivity:** The CNN is optimized for well-lit, clearly visible facial crops. Heavy compression artifacts (like 144p WhatsApp videos) may increase false-positive rates.
- **Audio-Visual Dependency:** For full robustness, this visual model must be fused with our behavioral and lip-sync models found in the main GitHub repository.

## ๐Ÿ“š Citation

If you use this architecture or model in your research, please cite it using the following DOI:

```bibtex

@software{realityguardai_2026,

  author       = {Satyam},

  title        = {RealityGuardAI: A Multi-Signal and Explainable Deepfake Detection Engine},

  year         = 2026,

  publisher    = {Zenodo},

  doi          = {10.5281/zenodo.22282866},

  url          = {https://doi.org/10.5281/zenodo.22282866}

}

```