Inspiration
AI-generated image detectors can perform well on familiar test data but fail when images are compressed, resized, blurred, noisy, or generated by a different model. We wanted to understand whether a detector that is robust to image transformations is also robust to domain shifts.
Our main finding is simple but important:
Transformation robustness and domain robustness are different problems.
What it does
Our system detects whether an input image is AI-generated or real.
The final solution, Generalisation V2, includes:
- A frozen ResNet18-based binary classifier
- Raw AI probability output,
P(AI) - Command-line inference
- A Streamlit interactive demo
- Robustness testing under real-world image transformations
- Cross-domain evaluation on unseen AI-generated and real images
- Reproducible evaluation results and model checkpoint
The Streamlit demo allows a user to upload an image and immediately see the raw AI probability together with a calibrated demonstration decision.
How we built it
We developed the system in three stages:
Baseline V0
Our first model provided a strong starting point on clean CIFAKE images, but its performance dropped significantly under transformations such as noise, blur, resizing, and compression.
Robust V1
We then focused on transformation robustness. V1 greatly improved performance across corrupted and transformed images.
However, when we evaluated V1 on an external cross-domain benchmark, we discovered that transformation robustness did not automatically translate into domain generalisation.
Generalisation V2
Our final model was selected to address this cross-domain weakness while preserving strong transformation robustness.
Generalisation V2 achieved:
- 96.48% clean CIFAKE accuracy
- 93.96% mean robustness accuracy
- 86.64% worst-case robustness accuracy
- 0.9188 ROC-AUC on our external demonstration benchmark
At the default threshold of 0.50, its REAL-to-AI false-positive rate on the external benchmark was only 2.26%, compared with 94.22% for Robust V1.
For the interactive demo, we additionally use a calibrated threshold of 0.05. This threshold only affects the displayed binary decision and does not modify the model's raw probability output.
Challenges we ran into
One of our biggest challenges was realizing that high robustness on transformed in-domain images could hide poor performance on a different image distribution.
Robust V1 performed very well across CIFAKE transformations, yet produced an extremely high false-positive rate on real images from another dataset.
This forced us to treat robustness as two separate dimensions:
- Robustness to transformations
- Robustness to domain shift
We also had to carefully verify class mappings, false-positive and false-negative definitions, dataset separation, checkpoint compatibility, and evaluation reproducibility.
Accomplishments that we're proud of
We built a complete end-to-end evaluation and inference pipeline rather than reporting only a single accuracy number.
Our final repository contains:
- A frozen Generalisation V2 checkpoint
- Reproducible inference code
- Robustness evaluation results
- Cross-domain validation results
- Error-rate analysis
- Threshold analysis
- An interactive Streamlit demo
We also performed a train/test leakage sanity check and verified that the final model checkpoint loads independently for inference.
What we learned
The most important lesson from this project is that robustness is not one-dimensional.
A detector can be highly resistant to blur, noise, compression, and resizing while still failing badly when the underlying data distribution changes.
For real-world AI-image detection, transformation robustness and domain generalisation therefore need to be evaluated separately.
We also learned that metrics such as ROC-AUC, false-positive rate, and false-negative rate can reveal weaknesses that overall accuracy alone may hide.
What's next
Future work could include:
- Evaluation on additional image-generation families
- Larger and more diverse real-image datasets
- Improved probability calibration across domains
- More advanced architectures and training strategies
- Evaluation against emerging image generators
- A hosted version of the interactive detector
Our current implementation provides a reproducible baseline for studying both transformation robustness and cross-domain generalisation in AI-generated image detection.
Log in or sign up for Devpost to join the conversation.