Spaces:
Sleeping
Sleeping
| 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 | |
| [](https://opensource.org/licenses/MIT) | |
| [](https://www.python.org/) | |
| [](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.* | |