Distinguish between real and AI-generated images.
The method uses Learned Noise Patterns (LNP) and one-class classification to map real images to a dense subspace, allowing detection of generated images as outliers. This approach achieves good detection accuracy while using much less training data compared to previous methods.
- Denoising network for LNP extraction
- Feature extraction from LNP amplitude spectra
- One-class SVM classifier for image authenticity prediction
- Robustness to various image post-processing operations
1 + 2. Clone the repository and create a virtual environment (optional but recommended):
git clone https://github.com/Linear-Fox-Labs/DePixel
cd DePixel
pip install -r requirements.txt
- Adjust
IMAGE_SIZE
inmain.py
to change the input image size - Modify
PLOT_FEATURES
inmain.py
to change the number of features displayed in distribution plots - Fine-tune classifier parameters in
src/classifier.py
for better performance - Modify the config.yaml file to adjust settings.
- Prepare your dataset:
- Place real images in the
data/real_images/
directory - Place test images (real or AI-generated) in the
data/test_images/
directory
- To train the denoising network:
python training/train.py
This will train the model using the real images and save the trained model as denoising_network.pth.
- Console output with processing details and classification results
- Feature distribution plots saved as PNG files in the project directory
Real Image Dog1.jpg | Ai-Generated Image Dog2.jpg |
-
DePixel based on: Xiuli Bi, Bo Liu, et al. for their research paper "Detecting Generated Images by Real Images Only" https://arxiv.org/abs/2311.00962
-
DePixel Authors: Nathan Fargo at Linear Fox Labs.