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 tests
cd backend
pytest tests/ --cov=app --cov-report=html
# Frontend tests
cd frontend
npm test# Backend linting
cd backend
black app/ # Format code
flake8 app/ # Lint
mypy app/ # Type check
# Frontend linting
cd 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