shlok926/SentinelForensicsAI
GitHub: shlok926/SentinelForensicsAI
一个结合视频与音频双分支 CNN 融合分析与 Grad-CAM 可解释性可视化的 Deepfake 检测与数字取证平台。
Stars: 5 | Forks: 0
🛡️ SentinelForensicsAI
多模态 Deepfake 检测与可解释 AI 取证工作站
一个企业级、研究级别的 AI 数字媒体取证平台,旨在验证和审计数字内容。它具备多模态验证模块(Video CNN + Audio CNN)以及全面的可解释性层(Grad-CAM),并可扩展至高吞吐量的容器化环境中。
🚀 快速开始 • 🔍 核心功能 • 📖 文档中心 • 🏛️ 平台架构 • 🛡️ 安全路线图
## 🎯 核心功能一览 | 🔍 多模态融合 | 🧠 离线 RAG Agent | 🎯 可解释 AI | 📈 评估指标 | | :--- | :--- | :--- | :--- | | **双分支取证**结合 2D-CNN 人脸裁剪分析与 2D Mel-Spectrogram 音频分类器。 | **离线语义搜索**
约 200 个精选变体,配合余弦相似度匹配。 | **可解释 AI (XAI)**
实时 Grad-CAM 热力图,准确显示伪造点。 | **诊断中心**
交互式 ROC-AUC 曲线、混淆矩阵及数据集审计。 | ## 📋 目录 | | | | :--- | :--- | | **1.** [核心功能](#-key-features-at-a-glance) | **6.** [安全路线图](#-security-roadmap--known-gaps) | | **2.** [架构概览](#%EF%B8%8F-platform-architecture-overview) | **7.** [贡献](#-contributing--feedback) | | **3.** [文档中心](#-documentation-center) | **8.** [显示您的支持](#-show-your-support) | | **4.** [仓库结构](#-project-structure) | **9.** [作者与联系方式](#-author--contact) | | **5.** [快速开始](#-quick-start) | | ## 🏛️ 平台架构概览 ``` graph TD %% Define Styles classDef client fill:#2c3e50,stroke:#34495e,stroke-width:2px,color:#fff; classDef ui fill:#16a085,stroke:#1abc9c,stroke-width:2px,color:#fff; classDef gateway fill:#2980b9,stroke:#3498db,stroke-width:2px,color:#fff; classDef core fill:#d35400,stroke:#e67e22,stroke-width:2px,color:#fff; classDef rag fill:#8e44ad,stroke:#9b59b6,stroke-width:2px,color:#fff; classDef db fill:#27ae60,stroke:#2ecc71,stroke-width:2px,color:#fff; %% Nodes Client[User / Forensic Analyst]:::client subgraph UI [Streamlit Forensic Workstation UI] direction TB Tab1["Analysis Hub: Upload & Grad-CAM Visualization"] Tab2["Dataset & Performance Registry Dashboard"] Tab3["Interactive Forensic RAG Chat Interface"] end class UI ui; subgraph Gateway [FastAPI Gateway & Security Middleware] direction TB RoutePredict["/predict endpoint"] RouteAgent["/agent/query endpoint"] Middleware["Input Validation & Prompt Shield"] end class Gateway gateway; subgraph Core [Multimodal Late Fusion Engine] direction TB subgraph Video [Video Branch] V1["OpenCV Frame & MTCNN Face Cropping"] --> V2["ResNet-18 Deep Feature Extractor"] end subgraph Audio [Audio Branch] A1["Librosa Mel-Spectrogram Extraction"] --> A2["2D CNN Audio Feature Extractor"] end Video --> Fusion["Late Fusion Concatenation Layer"] Audio --> Fusion Fusion --> Classifier["BCE Sigmoid Classifier - Threshold 0.2"] Classifier --> XAI["Grad-CAM Heatmap Visualizer"] end class Core core; subgraph RAG [Offline Forensic RAG Agent] direction TB KB["200+ Curated Offline Knowledge Base Queries"] Vec["TF-IDF Vectorizer & Cosine Similarity"] Fallback["Dynamic File Parser: SQLite / metadata.csv"] Vec --> KB Vec --> Fallback end class RAG rag; subgraph Storage [Data & Storage Layer] direction TB SQLite[("SQLite DB: Users, Prediction Logs, Reports")] Disk[("Local Disk Cache: face_crops/, audio_data/, checkpoints/")] end class Storage db; %% Connections Client -->|Upload Media / Ask Query| UI UI -->|API POST Request| Gateway Gateway -->|Verify & Filter| Middleware Middleware -->|Process Video/Audio| Core Middleware -->|Execute Query| RAG Core -->|Log Results & Read Weights| Storage RAG -->|Query Stats & Metrics| Storage ``` ## 📖 文档中心 要了解平台基础设施的具体部分,请参阅以下子文档: 1. **[系统架构与设计模式 (docs/ARCHITECTURE.md)](docs/ARCHITECTURE.md)**:深入探讨 Bounded Contexts、Bounded Domain schema、Clean Architecture 设计以及 Late Fusion 算法规范。 2. **[安装与本地/Docker 设置 (docs/INSTALLATION.md)](docs/INSTALLATION.md)**:设置虚拟环境、安装 FFmpeg 以及运行带有 Grafana 遥测的 CPU/GPU Docker Swarms 的详细配置指南。 3. **[开发者指南与代码规范 (docs/DEVELOPER_GUIDE.md)](docs/DEVELOPER_GUIDE.md)**:代码格式化规则、自动格式化命令 (`make format`),以及注册新深度学习模型的分步教程。 4. **[生产就绪与安全 (docs/PRODUCTION_READINESS.md)](docs/PRODUCTION_READINESS.md)**:安全验证清单、水平自动扩缩容设计以及长期的项目开发路线图。 ## 📂 项目结构 ``` deepfake-forensics-platform/ ├── app/ # Main Web Application & API Gateways │ ├── routes/ # FastAPI controllers (/predict, /agent, etc.) │ ├── database/ # SQL Connection managers and SQLAlchemy schemas │ ├── schemas/ # Request & Response data validation contracts │ ├── utils/ # Centralized logging, helpers, and crypto functions │ ├── config/ # Pydantic Settings loaders for Dev, Testing, and Production │ └── main.py # ASGI Master Application bootstrap entry point │ ├── ai_engine/ # Deep learning forensics algorithms and pipelines │ ├── video/ # Facial CNN feature extraction routines │ ├── audio/ # Mel Spectrogram analysis operations │ ├── explainability/ # Heatmap generation (Grad-CAM) │ ├── fusion/ # Multimodal classifier fusion algorithms │ ├── preprocessing/ # OpenCV frame slice & Librosa wave decoders │ ├── training/ # Distributed model training parameters │ ├── evaluation/ # Metrics collectors (Precision/Recall, F1) │ └── datasets/ # Benchmark dataset registration schemas │ ├── storage/ # Physical persistence layer │ ├── uploads/ # Temporary user uploads buffer │ └── reports/ # Output PDF/JSON forensic audits │ ├── monitoring/ # Monitoring configurations │ ├── prometheus/ # Scraping configurations for Prometheus server │ └── grafana/ # Dashboards for telemetry │ ├── tests/ # Pytest suites └── Dockerfile # Multi-stage production container ``` ## 🚀 快速开始 ### 选项 A:本地执行 (FastAPI + Streamlit Dashboard) 1. **安装依赖项:** pip install -r requirements.txt 2. **启动后端 API 服务器:** uvicorn app.main:app --host 0.0.0.0 --port 8000 3. **启动交互式 Streamlit 仪表板:** streamlit run app_streamlit.py ### 选项 B:Docker 容器化环境 构建并启动集成了 Prometheus 指标抓取和 Grafana 仪表板的完整 API 平台: ``` docker-compose up --build -d ``` * **FastAPI API 端点:** [http://localhost:8000](http://localhost:8000) * **交互式 Swagger 文档:** [http://localhost:8000/docs](http://localhost:8000/docs) * **Prometheus 控制台:** [http://localhost:9090](http://localhost:9090) * **Grafana 仪表板:** [http://localhost:3000](http://localhost:3000) ## 🛡️ 安全路线图与已知差距 本项目是一个本地化的取证分析工作站。以下安全和运维项目被有意推迟: 1. **临时文件生命周期 (推迟的 P0):** 上传的视频会保存在 `storage/temp_uploads/` 中以进行帧提取。生产环境的安装应安排 cron 作业或配置 FastAPI 后台任务,以清理超过 10 分钟的上传文件。 2. **内存中 GPU 排队 (推迟的 P1):** 重量级 CNN 模型在请求线程中运行推理。对于高并发的扫描任务,应集成像 Celery 或 RQ 这样的任务代理来处理作业队列,并避免 API 事件循环阻塞。 3. **MIME-Type 检查 (推迟的 P1):** 上传文件通过文件扩展名进行验证。对于面向网络的端点,应添加 Python-Magic 检查以直接检查文件头。 4. **Argon2id 升级 (推迟的 P2):** 密码哈希通过 100,000 次迭代的 PBKDF2-HMAC-SHA256 实现。在多用户设置中,应将 `app/utils/crypto.py` 迁移至 `argon2-cffi`,以最大化抵抗暴力破解的能力。 ## 👤 作者与联系方式
👤 Shlok Thorat
让我们在 LinkedIn 上建立联系,携手合作,共同打造出色的成果!
用 🛡️ 打造卓越的数字取证 • 返回顶部
标签:Deepfake检测, Kubernetes, Python, 凭据扫描, 可解释AI, 多模态学习, 数字取证, 无后门, 自动化脚本, 自定义请求头, 请求拦截, 逆向工具