Swin-FFT AI Image Detector
AI-generated image detector with frequency spectrum analysis
2 min readupdated
The model determines whether an image was created by artificial intelligence or is a real photograph. It is based on the Swin architecture, supplemented by a second branch for analyzing images in the frequency domain (FFT, a method of breaking down an image by brightness variation frequencies). The model analyzes both visual features via the base umm-maybe/AI-image-detector model and hidden patterns in the frequency spectrum that image generators often leave behind. The tool is suitable for developers and researchers who need to verify content authenticity based on the ArtiFact dataset.
Key features
- Dual architecture: combines a Swin backbone for RGB images and a convolutional CNN branch for frequency spectrum analysis via FFT.
- Scale-based training: fine-tuned on the ArtiFact dataset containing millions of real and synthetic images.
- Probability calibration: outputs a graded confidence score (generation probability) via classifier logits.
- Custom structure: combines 1024 features from Swin and 128 features from the frequency branch into a single 1152-dimensional vector.
What you can do
- Build a verification pipeline: write a custom inference script for the model weights (source code coming soon on GitHub).
- Explore frequency artifacts: study how the convolutional CNN branch processes the log-magnitude of the spectrum after FFT and a Hann window.
- Integrate into moderation systems: use pre-trained weights to analyze and classify media files while accounting for dataset constraints.
Example
The preliminary preprocessing stage includes converting the image to RGB, resizing to 224x224 using bicubic interpolation, and creating a separate grayscale version for the frequency branch without ImageNet normalization.
Read more
DetailsROC AUC: 0.9996
Average precision: 0.9998
Accuracy (threshold 0.5): 99.27%
Requirements: NVIDIA RTX 3060 12GB, 3 training epochs, AdamW optimizer
License: CC BY-NC 4.0










Comments