A production-grade forensic image analysis system that combines deep neural networks with classical signal processing to detect image tampering and AI-generated content.
- Error Level Analysis (ELA) — Detects JPEG compression inconsistencies from editing
- AI Generation Detection — GAN spectral analysis, channel correlation, and gradient pattern detection
- CNN Classifier — ConvNeXt-based binary classifier trained on ELA-preprocessed images
- Noise Analysis — Wiener filtering and statistical noise pattern analysis
- EXIF Metadata — Extracts and flags suspicious intrinsic file properties
- Copy-Move Detection — ORB feature matching to find cloned image regions
| Category | Description |
|---|---|
| Authentic | No significant manipulation or AI generation patterns detected |
| Tampered | Evidence of post-capture modification (splicing, cloning, retouching) |
| AI Generated | Image likely produced by generative AI (GANs, diffusion models) |
PixelGuard2/
├── app.py # Flask REST API (auth, analysis, history)
├── analysis/ # Forensic analysis modules
│ ├── ela.py # Error Level Analysis
│ ├── deepfake.py # AI generation detection (spectral/statistical)
│ ├── cnn_classifier.py # ConvNeXt CNN binary classifier
│ ├── forensics.py # Frequency, noise, and copy-move analysis
│ └── metadata_analysis.py # EXIF metadata extraction
├── models/
│ └── database.py # SQLAlchemy models (User, AnalysisRecord)
├── training/
│ └── train_model.py # Model training script
├── frontend/ # React + Vite + Tailwind + Shadcn UI
│ └── src/
│ ├── main.tsx # Entry point + auth routing
│ ├── layouts/ # DashboardLayout (sidebar)
│ └── pages/ # Dashboard, Analyze, History, Settings
├── model_tampering.keras # Pre-trained tampering detection model
└── model_deepfake.keras # Pre-trained AI detection model
- Python 3.10–3.12 (TensorFlow requirement)
- Node.js 18+
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # Linux/Mac
pip install -r requirements.txt
python app.pycd frontend
npm install
npm run devnpm run dev # Runs Flask + Vite concurrentlyThe app runs on http://localhost:5173 (frontend) proxied to http://localhost:5002 (API).
Train your own models using the included training script:
# Prepare dataset structure:
# dataset/
# authentic/ ← original images
# manipulated/ ← tampered or AI-generated images
# Train tampering model
python training/train_model.py \
--dataset path/to/dataset \
--output model_tampering.keras \
--type tampering \
--epochs 20
# Train AI detection model
python training/train_model.py \
--dataset path/to/dataset \
--output model_deepfake.keras \
--type ai_detection \
--epochs 20 \
--fine-tuneIf models are not present, the system falls back to mathematical heuristics (ELA variance, spectral analysis).
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/auth/signup |
Create account |
| POST | /api/v1/auth/login |
Login |
| POST | /api/v1/auth/logout |
Logout |
| GET | /api/v1/auth/me |
Current user |
| GET | /api/v1/dashboard/stats |
Dashboard statistics |
| POST | /api/v1/analyze |
Upload & analyze image |
| GET | /api/v1/history |
Paginated analysis history |
- Backend: Flask, SQLAlchemy, TensorFlow/Keras, NumPy, SciPy, Pillow
- Frontend: React 19, TypeScript, Vite 6, Tailwind CSS v4, Shadcn UI
- Database: SQLite
- Models: ConvNeXt-based binary classifiers (transfer learning)
MIT