Spaces:
Running
Running
📦API integration note
Overview
This system integrates three image forensics methods—ELA, FFT, and Metadata analysis—into a single detection pipeline to determine whether an image is AI-generated, manipulated, or authentic.
🔍 Detection Modules
1. ELA (Error Level Analysis)
- Purpose: Detects tampering or editing by analyzing compression error levels.
- Accuracy: ✅ Most accurate method
- Performance: ❗ Slowest method
- Output:
True
(edited) orFalse
(authentic)
2. FFT (Fast Fourier Transform)
- Purpose: Identifies high-frequency patterns typical of AI-generated images.
- Accuracy: ⚠️ Moderately accurate
- Performance: ❗ Moderate to slow
- Output:
True
(likely AI-generated) orFalse
(authentic)
3. Metadata Analysis
Purpose: Detects traces of AI tools or editors in image metadata or binary content.
Accuracy: ⚠️ Fast but weaker signal
Performance: 🚀 Fastest method
Output: One of:
"ai_generated"
– AI tool or generator identified"edited"
– Edited using known software"undetermined"
– No signature found
🧩 Integration Plan
➕ Combine all three APIs into one unified endpoint:
POST /api/detect-image
Input:
image
: Image file (binary, any format supported by Pillow)
Output:
{
"ela_result": true,
"fft_result": false,
"metadata_result": "ai_generated",
"final_decision": "ai_generated"
}
NOTE:Optionally recommending a default logic (e.g., trust ELA > FFT > Metadata).
Result implementation
ela_result |
fft_result |
metadata_result |
Suggested Final Decision | Notes |
---|---|---|---|---|
true |
true |
"ai_generated" |
ai_generated |
Strong evidence from all three modules |
true |
false |
"edited" |
edited |
ELA confirms editing, no AI signals |
true |
false |
"undetermined" |
edited |
ELA indicates manipulation |
false |
true |
"ai_generated" |
ai_generated |
No edits, but strong AI frequency & metadata signature |
false |
true |
"undetermined" |
possibly_ai_generated |
Weak metadata, but FFT indicates possible AI generation |
false |
false |
"ai_generated" |
ai_generated |
Metadata alone shows AI use |
false |
false |
"edited" |
possibly_edited |
Weak signal—metadata shows editing but no structural or frequency signs |
false |
false |
"undetermined" |
authentic |
No detectable manipulation or AI indicators |
Decision Logic:
- Use ELA as the primary indicator for manipulation.
- Supplement with FFT and Metadata to improve reliability.
- Combine using a simple rule-based or voting system.
⚙️ Performance Consideration
Method | Speed | Strength |
---|---|---|
ELA | ❗ Slow | ✅ Highly accurate |
FFT | ⚠️ Moderate | ⚠️ Somewhat reliable |
Metadata | 🚀 Fast | ⚠️ Low confidence |
For high-throughput systems, consider running Metadata first and conditionally applying ELA/FFT if suspicious.