TrueLens-Forensics / README.md
abhisonu01's picture
Upload README.md with huggingface_hub
8ee42ef verified
---
title: TrueLens Forensics
emoji: πŸ‘οΈ
colorFrom: gray
colorTo: gray
sdk: docker
app_file: app.py
pinned: false
---
# TrueLens Forensic Suite v1.0
## Advanced Multimedia Authenticity Verification System
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Python: 3.10+](https://img.shields.io/badge/Python-3.10+-green.svg)](https://www.python.org/)
[![Framework: Flask](https://img.shields.io/badge/Framework-Flask-lightgrey.svg)](https://flask.palletsprojects.com/)
**TrueLens** is a professional-grade forensic suite designed to detect AI-generated synthetic media and deepfakes with high precision. By combining state-of-the-art Neural Networks (SigLIP2) with classical digital forensic signals (ELA, FFT, DCT), TrueLens provides a multi-layered defense against generative misinformation.
---
## πŸ›οΈ System Architecture
TrueLens employs a **Hybrid Forensic-Neural Ensemble** (HFNE) architecture:
### 1. Neural Analysis Layer
* **Primary Classifier:** SigLIP2 (Vision Transformer) fine-tuned for synthetic artifact detection.
* **Strategy:** Multi-crop Test-Time Augmentation (TTA) focusing on facial biometrics, central composition, and global structure.
### 2. Forensic Signal Layer (Classical)
* **DCT Block Analysis:** Detects inconsistent JPEG grid alignments and compression quantization typical of authentic camera hardware.
* **ELA (Error Level Analysis):** Identifies non-uniform compression levels across different regions of an image.
* **FFT (Fast Fourier Transform):** Scans the frequency spectrum for high-frequency checkerboard artifacts unique to GANs and Diffusion models.
* **Noise Consistency:** Analyzes pixel-level sensor noise variance to detect synthetic patches.
* **Edge Sharpness:** Monitors gradient uniformity to catch unnaturally sharp or blurred synthetic edges.
### 3. Consensus Fusion Logic
A weighted Bayesian logic gate synthesizes the output of all layers. It includes an **Uncertainty Quantification** engine that flags ambiguous samples rather than providing false positives, ensuring the system's "Forensic Integrity."
---
## πŸš€ Performance Benchmarks
Evaluated against a controlled dataset of 66 high-resolution samples (Pexels realistic photos vs. SDXL/Midjourney synthetic generations):
| Metric | Local Engine (CPU) |
|:---|:---:|
| **Accuracy** | **92.4%** |
| **Precision** | **0.94** |
| **Recall** | **0.91** |
| **F1-Score** | **0.92** |
| **Avg. Latency** | **~2.2s** |
---
## πŸ› οΈ Installation & Setup
### Prerequisites
* Python 3.10 or higher
* pip (Python package manager)
### Quick Start
1. **Clone the repository:**
```bash
git clone https://github.com/abhiisonu/TrueLens.git
cd TrueLens
```
2. **Install dependencies:**
```bash
pip install -r requirements.txt
```
3. **Initialize the engine:**
```bash
python app.py
```
*Note: On first run, it will download approximately 800MB of neural weights.*
4. **Access the Workbench:**
Open `http://localhost:5006` in your browser.
---
## πŸ“Š Forensic Evaluation
You can run the batch evaluator to verify the engine's performance on your own datasets:
```bash
python evaluate.py --fake-dir "path/to/fakes" --real-dir "path/to/reals"
```
---
## βš–οΈ Privacy & Disclosure
* **Privacy first:** TrueLens processes all inference on-device.
* **Zero-Persistence:** Uploaded samples are purged from memory and disk immediately after inference completion.
* **Disclosure:** This tool is an academic project designed for forensic research. While highly accurate, forensic signals can be bypassed by advanced adversarial techniques (anti-forensics).
---
## πŸ“œ Credits & License
Developed as a Minor Project for Forensic Research.
Licensed under the [MIT License](LICENSE).
---
*Β© 2026 TrueLens Forensic Lab. All rights reserved.*