A production-grade forensic image analysis platform for detecting AI-generated images. Features multi-model ensemble detection, CLIP semantic analysis, manipulation detection with heatmap visualization, OCR-based text forensics, generator fingerprinting, and comprehensive metadata forensics.
- Ensemble Analysis: Multiple AI detection models with uncertainty quantification
- CLIP Semantic Analysis: Content type classification (photo vs CGI/illustration)
- Calibrated Probabilities: Confidence intervals and model agreement metrics
- Two-Axis Output: AI likelihood + evidential quality scoring
- Diffusion Fingerprint Detection: Identifies diffusion model artifacts in frequency domain
- Generation Pathway Classification: T2I vs I2I vs Real Photo with evidence-based gating
- Enhanced I2I Detection: Perfect square detection, noise uniformity variation, model disagreement analysis
- JPEG Forensics: Double compression detection, quantization fingerprinting
- Manipulation Detection: Copy-move, splice, edge matte, blur/noise mismatch
- Evidence Fusion: Weighted combination of multiple forensic signals
- OCR Detection: EasyOCR-based text extraction with optimized parameters
- Multi-language OCR: 7 languages supported (EN, TR, ES, DE, FR, IT, PT)
- Image Preprocessing: Auto contrast/sharpness enhancement, upscaling for small images
- Gibberish Detection: Identifies nonsensical AI-generated text on signs/labels
- AI Text Artifacts: Detects malformed characters, unusual casing, invalid words
- Gibberish Boost: High gibberish ratio increases AI probability (+5% to +15%)
- AI Tool Identification: Statistical analysis to identify likely generator
- Supported Generators: Midjourney V5/V6, DALL-E 3, Stable Diffusion XL, Flux, Grok/Aurora, Firefly, Ideogram, Gemini Imagen, ChatGPT/DALL-E
- Dimension Matching: Known AI output dimensions (1024x1024, 784x1168, etc.) boost detection
- Spectrum/Noise/Color Analysis: Frequency rolloff, noise uniformity, color signatures
- Confidence Scoring: Match confidence with feature breakdown
- Heatmap Overlays: Visual representation of detected anomalies
- Global Edit Mode: Shows processing intensity for filters/color grading
- Local Manipulation Mode: Highlights boundary-corroborated suspicious regions
- T2I Artifacts Mode: Visualizes AI generation artifacts (diffusion signatures)
- Deterministic Generation: SHA256 hashes for integrity verification
- 3-Way Edit Taxonomy:
none_detected,global_postprocess,local_manipulation,generator_artifacts - Boundary Corroboration: Local manipulation requires edge_matte/copy_move/inpainting evidence β₯0.60
- False Positive Prevention: Noise inconsistency alone does NOT trigger composite labels
- AI Generation Artifacts: Distinguishes AI texture artifacts from true manipulation
- Prompt Recovery: Extracts exact prompts from AI tool metadata (Midjourney, DALL-E, etc.)
- Prompt Reconstruction: Infers plausible prompts from visual content analysis
- BLIP Captioning: AI-powered image description for prompt inference
- Clear Distinction: "RECOVERED" (exact) vs "RECONSTRUCTED" (hypothesis)
- GPS Verification: Location data with confidence scoring
- Provenance Scoring: EXIF/GPS evidence weighting for authenticity
- Platform Detection: Instagram, WhatsApp re-encoding detection
- Old Timestamp Bonus: Pre-2020 images get authenticity boost
- EXIF/XMP/IPTC Extraction: Comprehensive metadata analysis
- Camera Evidence: CFA artifacts, PRNU proxy, camera settings
- AI Software Detection: 20+ AI tool signatures (Midjourney, DALL-E, Stable Diffusion, etc.)
- Bilingual Support: Turkish (TR) and English (EN)
- Dynamic Language Switching: Real-time UI translation
- Localized Verdicts: Evidence-based verdict text in both languages
ai-image-detector/
βββ backend/
β βββ main.py # FastAPI application
β βββ forensic/
β β βββ ai_detector.py # Multi-model ensemble
β β βββ content_type.py # CLIP-based content classification
β β βββ diffusion_fingerprint.py # Diffusion model detection
β β βββ pathway_classifier.py # T2I/I2I/Real classification
β β βββ manipulation.py # Manipulation detection
β β βββ edit_assessment.py # Edit type taxonomy
β β βββ visualization.py # Heatmap generation
β β βββ verdict_generator.py # Evidence-based verdicts
β β βββ text_forensics.py # OCR + AI text artifact detection
β β βββ generator_fingerprint.py # AI tool identification
β β βββ prompt_analysis.py # Unified prompt recovery/reconstruction
β β βββ prompt_recovery.py # Metadata-based prompt extraction
β β βββ content_extraction.py # BLIP captioning
β β βββ provenance_score.py # EXIF/GPS evidence scoring
β β βββ evidence_fusion.py # Weighted evidence combination
β β βββ metadata.py # EXIF/XMP/IPTC extraction
β β βββ jpeg_forensics.py # JPEG analysis
β β βββ statistics.py # Calibration & uncertainty
β β βββ config.py # Feature flags
β βββ requirements.txt
βββ index.html # Frontend UI
βββ script.js # Analysis display logic
βββ style.css # Modern dark theme
βββ language-manager.js # i18n support
βββ docker-compose.yml
- Python 3.8+
- 4GB+ RAM (8GB recommended for full model ensemble)
- CUDA-capable GPU (optional, for faster inference)
# Clone repository
git clone https://github.com/wearetheartmakers/ai-image-detector.git
cd ai-image-detector
# Setup virtual environment
./setup_venv.sh # macOS/Linux
# or
setup_venv.bat # Windows
# Start backend
./run_backend_venv.sh # Terminal 1
# Start frontend (separate terminal)
./run_frontend.sh # Terminal 2- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
Analyze an image for AI generation and manipulation.
Request:
curl -X POST "http://localhost:8000/analyze?file_chain=original" \
-F "file=@image.jpg"Key Response Fields:
{
"success": true,
"report_id": "abc123",
"evidence_level": "STRONG_AI_EVIDENCE",
"ai_probability": 78,
"confidence": 65,
"verdict_text": {
"verdict_key": "AI_T2I_HIGH",
"title_en": "AI Generated (T2I)",
"subtitle_en": "High confidence text-to-image generation"
},
"pathway": {
"pred": "t2i",
"confidence": "high",
"evidence": {
"diffusion_score": 0.82,
"camera_evidence_score": 0.08
}
},
"text_forensics": {
"has_text": true,
"text_count": 5,
"ai_text_score": 0.72,
"verdict": "likely_ai",
"ai_text_evidence": ["'KOEMO': Gibberish/nonsensical text"]
},
"generator_fingerprint": {
"top_match": {
"name": "Grok Aurora",
"family": "grok",
"confidence": 0.65
}
},
"prompt_analysis": {
"source": "RECONSTRUCTED_MEDIUM",
"has_reconstructed": true,
"reconstructed": {
"short_en": "European street scene, parked cars, sunny day",
"confidence": "medium"
}
}
}# Core Features
ENABLE_AI_DETECTION = True
ENABLE_JPEG_FORENSICS = True
ENABLE_MANIPULATION_MODULES = True
# Advanced Features
ENABLE_PATHWAY_CLASSIFIER = True
ENABLE_DIFFUSION_FINGERPRINT = True
ENABLE_TEXT_FORENSICS = True # OCR + AI text artifacts
ENABLE_GENERATOR_FINGERPRINT = True # AI tool identification
ENABLE_PROMPT_RECOVERY = True # Metadata prompt extraction
ENABLE_BLIP_CAPTIONING = True # Visual prompt inference
# Output Features
ENABLE_TWO_AXIS_OUTPUT = True
ENABLE_VERDICT_TEXT = True
ENABLE_GENERATIVE_HEATMAP = True| Parameter | Value | Description |
|---|---|---|
diffusion_high_threshold |
0.70 | High confidence diffusion detection |
camera_evidence_threshold |
0.35 | Min camera evidence for "Photo" verdict |
boundary_corroboration_threshold |
0.60 | Min score for local manipulation |
pAI_threshold |
0.40 | Min AI probability for "Likely AI" verdict |
gibberish_ratio_threshold |
0.50 | High gibberish = likely AI text |
generator_match_threshold |
0.50 | Medium confidence generator match |
| Content Type | Detection Rate | Notes |
|---|---|---|
| T2I (Midjourney, DALL-E, SD) | 85-95% | High diffusion fingerprint |
| Photoreal AI (Grok, Gemini) | 75-90% | CLIP photoreal hints |
| Real Photos | 90-95% | Camera evidence + low diffusion |
| AI Text Artifacts | 70-85% | Gibberish on signs/labels |
| Composites/Splices | 80-90% | Boundary corroboration required |
This tool provides probabilistic analysis, not definitive proof.
- Results are NOT 100% accurate
- "Definitive" verdicts require cryptographic proof (C2PA) or AI software signatures
- False positives/negatives are possible
- Professional verification recommended for critical decisions
- AI detection technology evolves rapidly; regular updates required
# Build and run
docker-compose up -d
# Or manually
docker build -t ai-detector ./backend
docker run -p 8000:8000 ai-detector- 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
See CONTRIBUTING.md for detailed guidelines.
This project is licensed under the WATAM License - WeAreTheArtMakers.com
- HuggingFace - Transformers & CLIP models
- FastAPI - Modern Python web framework
- OpenAI CLIP - Vision-language model
- EasyOCR - OCR engine
- Lucide Icons - Beautiful icon set
β Star this repo if you find it useful!
Made with β€οΈ by WATAM