AI-Powered Media Verification Platform combining Cryptography + Machine Learning
SPKIA determines whether media content is authentic, AI-generated, or tampered with using multiple verification methods:
- ✅ C2PA Verification - Cryptographic content credentials
- ✅ Sensor-PKI - Camera sensor-level digital signatures
- 🤖 ML Detection - ResNeXt+LSTM deepfake detection + Enhanced AI detection
- 🔍 Forensic Analysis - Compression artifacts, temporal consistency, metadata analysis
- Cryptographic Verification: C2PA credentials and Sensor-PKI signatures
- ML Ensemble Detection:
- ResNeXt-50 + LSTM deepfake detector (97.7% accuracy on FaceForensics++)
- Compression artifact analysis
- Video temporal consistency analysis
- PRNU camera fingerprinting
- Metadata forensics
- Smart Confidence Scoring: Adaptive ensemble weighting based on detection certainty
- Detailed Results: Clear verdicts with percentage confidence and specific artifacts found
- 🔒 No persistent content storage (ephemeral processing only)
- ⏰ 24-hour automatic job deletion
- 🚫 No user tracking or profiling
- 🔐 TLS encryption in transit
- 🗑️ Explicit "Delete Now" option
- ⚡ Fast processing: 10-20 seconds per image, 20-40 seconds per video
- 📊 Batch processing support (up to 10 files)
- 🔄 Async processing with job queue
- 📈 Horizontal scalability ready
┌─────────────────────┐
│ React Frontend │ • Drag & drop upload
│ (Vite + Tailwind) │ • Real-time results
└──────────┬──────────┘ • Detailed breakdown
│
┌──────────▼──────────┐
│ Nginx Proxy │ • Reverse proxy
│ (Alpine Linux) │ • Static file serving
└──────────┬──────────┘ • TLS termination
│
┌──────────▼──────────┐
│ FastAPI Backend │ • REST API
│ (Python 3.11) │ • Job orchestration
└──────────┬──────────┘ • Async processing
│
┌──────────▼────────────────────────────────────┐
│ Verification Pipeline (6 parallel detectors) │
│ ┌─────────────────────────────────────────┐ │
│ │ 1. C2PA Verification │ │
│ │ • Content credentials validation │ │
│ │ • Trust chain verification │ │
│ ├─────────────────────────────────────────┤ │
│ │ 2. Sensor-PKI Verification │ │
│ │ • COSE signature validation │ │
│ │ • Manufacturer certificate chain │ │
│ ├─────────────────────────────────────────┤ │
│ │ 3. ML Detection Ensemble │ │
│ │ • ResNeXt-50 + LSTM (deepfakes) │ │
│ │ • Compression artifact analysis │ │
│ │ • Video temporal consistency │ │
│ │ • PRNU camera fingerprinting │ │
│ │ • Metadata forensics (EXIF/XMP) │ │
│ ├─────────────────────────────────────────┤ │
│ │ 4. Smart Ensemble Decision │ │
│ │ • Adaptive weight adjustment │ │
│ │ • Confidence calculation │ │
│ │ • Final verdict generation │ │
│ └─────────────────────────────────────────┘ │
└───────────────────────────────────────────────┘
│
┌──────────▼──────────┐
│ MongoDB + Redis │ • Ephemeral storage
│ (Docker volumes) │ • 24h TTL indexes
└─────────────────────┘ • Job queue
- Docker 20.10+ & Docker Compose 2.0+
- 8GB+ RAM (for ML models)
- 20GB+ disk space (models + dependencies)
- Linux/macOS/Windows (WSL2 recommended on Windows)
git clone https://github.com/monuit/SPKIA.git
cd SPKIA
cp .env.example .envEdit .env with your settings:
# Backend Configuration
MONGODB_URL=mongodb://mongo:27017
REDIS_URL=redis://redis:6379
SECRET_KEY=your-secret-key-here-min-32-chars
# Frontend Configuration
VITE_API_BASE_URL= # Empty for relative URLs (nginx proxy)# ML Model Configuration
CNN_MODEL_VERSION=v1.0
PRNU_MODEL_VERSION=v1.0
# Security
ALLOWED_ORIGINS=http://localhost,http://localhost:3000
MAX_UPLOAD_SIZE=100 # MB# Build and start all containers
docker-compose up -d
# Check status
docker-compose ps
# View logs
docker-compose logs -f- Frontend: http://localhost
- API: http://localhost/api
- API Docs: http://localhost/api/docs
- Health Check: http://localhost/api/health
# Upload an image for verification
curl -X POST http://localhost/api/verify \
-F "file=@test-image.jpg"# Response:# {# "job_id": "abc123...",# "status": "pending"# }# Get results
curl http://localhost/api/verify/abc123...POST/api/verify
curl -X POST http://localhost/api/verify \
-H "Content-Type: multipart/form-data" \
-F "file=@image.jpg"Response:
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "pending",
"message": "Verification job created"
}GET/api/verify/{job_id}
curl http://localhost/api/verify/550e8400-e29b-41d4-a716-446655440000Response (Authentic Photo):
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"label": "authentic_camera",
"confidence": 0.87,
"reasons": [
"✓ HIGH CONFIDENCE AUTHENTIC (87%)",
"Compression analysis: Natural photo characteristics (82%)",
"Camera fingerprint: Matches real camera patterns (81%)",
"Metadata: Canon EOS 5D Mark IV detected",
"Deepfake detection: Likely authentic (85% confidence)"
],
"details": {
"c2pa": {
"valid": false,
"error": "No C2PA manifest found"
},
"sensor_pki": {
"valid": false,
"error": "No sensor PKI signature found"
},
"ml_detection": {
"ai_probability": 0.13,
"cnn_score": 0.15,
"prnu_score": 0.19,
"metadata_anomaly_score": 0.05,
"compression_score": 0.18,
"ensemble_confidence": 0.87,
"detected_generator": null,
"artifacts_found": [
"✓ HIGH CONFIDENCE AUTHENTIC (87%)",
"Deepfake detection: Likely authentic (85% confidence)",
"Compression analysis: Natural photo characteristics (82%)",
"Camera fingerprint: Matches real camera patterns (81%)"
]
}
},
"created_at": "2025-10-02T10:30:00Z",
"completed_at": "2025-10-02T10:30:15Z",
"processing_time_ms": 15234
}Response (AI-Generated Detection):
{
"job_id": "660f9511-f39c-52e5-b827-557766551111",
"status": "completed",
"label": "likely_ai_generated",
"confidence": 0.78,
"reasons": [
"⚠️ LIKELY AI-GENERATED (78%)",
"Compression analysis: AI-generated characteristics detected (82%)",
"Camera fingerprint: Inconsistent with real sensors (73%)",
"Metadata: Missing camera metadata",
"No cryptographic proofs found"
],
"details": {
"ml_detection": {
"ai_probability": 0.78,
"ensemble_confidence": 0.78,
"artifacts_found": [
"⚠️ LIKELY AI-GENERATED (78%)",
"Compression analysis: AI-generated characteristics detected (82%)",
"Camera fingerprint: Inconsistent with real sensors (73%)",
"Missing camera metadata: Make, Model, LensModel"
]
}
}
}DELETE/api/verify/{job_id}
curl -X DELETE http://localhost/api/verify/550e8400-e29b-41d4-a716-446655440000SPKIA uses a sophisticated ensemble of 6 detection methods:
- Architecture: ResNeXt-50 (32x4d) backbone + Bidirectional LSTM (2 layers)
- Training: FaceForensics++ dataset (97.7% accuracy)
- Features: Temporal sequence analysis across 20 frames
- Detection: Face-based deepfake artifacts, GAN signatures
Analyzes image quality characteristics:
- Smoothness: AI images have unnaturally smooth regions
- Edge Analysis: Detects perfect, crisp edges vs. natural blur
- Noise: Real photos have sensor noise, AI images are too clean
- Symmetry: Identifies unnatural symmetry patterns
For video files only:
- Color Consistency: Detects lighting/color shifts between frames
- Motion Analysis: Optical flow analysis for unnatural motion patterns
- Frame Coherence: Checks for temporal artifacts and jitter
- Method: Photo Response Non-Uniformity pattern analysis
- Detection: Unique sensor noise fingerprints from manufacturing
- Database: Synthetic patterns for common camera models
- AI Signatures: Detects Midjourney, DALL-E, Stable Diffusion, etc.
- EXIF Analysis: Checks for missing/inconsistent camera metadata
- Consistency: Validates make/model pairs, datetime fields
- Adaptive Weighting: Boosts reliable detectors when primary is uncertain
- Confidence Scoring: Requires both agreement AND deviation from neutral
- Threshold-based Verdicts:
> 0.7→ HIGH CONFIDENCE AI-GENERATED0.55-0.7→ LIKELY AI-GENERATED0.3-0.45→ LIKELY AUTHENTIC< 0.3→ HIGH CONFIDENCE AUTHENTIC
Without labeled test set (estimated):
- Real camera photos with EXIF: 85-90% accuracy
- AI-generated images (Midjourney/DALL-E/SD): 75-85% accuracy
- Deepfake videos: 70-80% accuracy
- Screenshots/downloads: 60-70% accuracy (missing metadata)
See ENHANCED_DETECTION.md for technical details.
SPKIA/
├── backend/ # Python FastAPI backend
│ ├── app/
│ │ ├── main.py # FastAPI application entry
│ │ ├── config.py # Environment configuration
│ │ ├── database.py # MongoDB connection
│ │ ├── models/
│ │ │ └── database.py # Pydantic models
│ │ ├── api/
│ │ │ └── routes.py # REST API endpoints
│ │ ├── services/
│ │ │ ├── verification.py # Pipeline orchestration
│ │ │ ├── c2pa_verifier.py # C2PA verification
│ │ │ ├── sensor_pki_verifier.py
│ │ │ ├── ml_detector.py # ML ensemble
│ │ │ ├── deepfake_detector.py # ResNeXt+LSTM
│ │ │ └── enhanced_detection.py # Compression/video analysis
│ │ └── utils/
│ ├── requirements.txt # Python dependencies
│ ├── Dockerfile # Backend container
│ └── .env.example
├── frontend/ # React + TypeScript frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ ├── services/
│ │ │ └── api.ts # API client (Axios)
│ │ ├── App.tsx # Root component
│ │ └── main.tsx
│ ├── package.json
│ ├── vite.config.ts
│ ├── tailwind.config.js
│ └── Dockerfile # Frontend container
├── nginx/
│ └── nginx.conf # Nginx reverse proxy config
├── models/ # ML model weights (not in git)
├── trust_anchors/ # C2PA trust certificates
├── sensor_pki_anchors/ # Sensor-PKI certificates
├── docker-compose.yml # Multi-container orchestration
├── .env.example # Environment template
├── README.md # This file
├── ENHANCED_DETECTION.md # ML detection technical docs
├── RESNEXT_LSTM_INTEGRATION.md # Deepfake detector docs
└── DEPLOYMENT.md # Production deployment guide
# Backend testscd backend
pytest tests/ --cov=app --cov-report=html
# Frontend testscd frontend
npm test# Backend lintingcd backend
black app/ # Format code
flake8 app/ # Lint
mypy app/ # Type check# Frontend lintingcd frontend
npm run lint # ESLint
npm run type-check # TypeScript- Train model on benchmark dataset
- Export to PyTorch (.pth) format
- Place in
backend/app/models/directory - Update
ml_detector.pyto load new model - Adjust ensemble weights in
MLDetector.__init__() - Update
ENHANCED_DETECTION.mdwith model details
- Set strong
SECRET_KEYin.env - Configure TLS certificates (Let's Encrypt)
- Set up MongoDB with authentication
- Configure Redis password
- Set
ALLOWED_ORIGINSto your domain - Enable rate limiting (Nginx)
- Set up monitoring (Prometheus/Grafana)
- Configure backups (MongoDB)
- Review security headers (nginx.conf)
- Set up log aggregation (ELK/Loki)
# Build production images
docker-compose -f docker-compose.prod.yml build
# Start with resource limits
docker-compose -f docker-compose.prod.yml up -d
# Scale backend for high load
docker-compose -f docker-compose.prod.yml up -d --scale backend=3See DEPLOYMENT.md for Kubernetes manifests and Helm charts.
Minimum (Single Instance):
- CPU: 4 cores
- RAM: 8GB
- Disk: 20GB
- Network: 100 Mbps
Recommended (Production):
- CPU: 8+ cores
- RAM: 16GB+
- Disk: 50GB SSD
- Network: 1 Gbps
Horizontal Scaling:
- Backend: Scale up to N instances (stateless)
- Frontend: Served as static files (CDN-friendly)
- MongoDB: Replica set (3+ nodes)
- Redis: Cluster mode (6+ nodes)
Performance Targets:
- Image processing: 10-20 seconds
- Video processing: 20-40 seconds
- Concurrent jobs: 50-100 per backend instance
- API latency: < 100ms (non-processing endpoints)
In Scope:
- Media tampering detection
- AI-generated content identification
- Deepfake detection
- Metadata manipulation
Out of Scope:
- Preventing screenshot/re-capture attacks
- Protecting against state-level adversaries
- Blockchain-based immutability (future work)
- ✅ Content never stored permanently
- ✅ 24-hour automatic deletion
- ✅ TLS encryption in transit
- ✅ Input validation & sanitization
- ✅ Rate limiting on API endpoints
- ✅ CORS configured for trusted origins
- ✅ No user authentication (privacy-first)
- ✅ Secure secrets management
See PRIVACY.md for details.
We welcome contributions! See CONTRIBUTING.md for guidelines.
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
- Python: Black formatter, flake8 linter, type hints required
- TypeScript: ESLint, Prettier, strict mode enabled
- Commits: Conventional Commits format
- Tests: Required for new features (>80% coverage)
MIT License - See LICENSE
- API Documentation - Complete API reference
- Enhanced Detection - ML detection technical details
- ResNeXt+LSTM Integration - Deepfake detector docs
- Deployment Guide - Production deployment
- Privacy Policy - Data handling practices
- Contributing Guide - How to contribute
- C2PA - Content Authenticity Initiative
- FaceForensics++ - Deepfake detection dataset
- karthikurao/Deepfake-Detection - ResNeXt+LSTM implementation inspiration
- OpenCV - Computer vision library
- FastAPI - Modern Python web framework
- React - Frontend library
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
- 📧 Email: support@monuit.com
- 🌐 Website: https://spkia.monuit.com
- Fine-tuned ResNeXt+LSTM weights
- Real PRNU camera fingerprint database
- Blockchain-based provenance tracking
- Multi-language support
- Audio deepfake detection
- Video manipulation detection (frame insertion/deletion)
- Batch upload API (10+ files)
- Webhook notifications
- Real-time video stream verification
- Mobile app (iOS/Android)
- Browser extension
- Public API with rate limiting
If you use SPKIA in research, please cite:
@software{spkia2025,
title={SPKIA: Sensor-PKI Authenticity Platform},
author={Monuit Team},
year={2025},
url={https://github.com/monuit/SPKIA},
version={1.0.0}
}Built with ❤️ by Monuit