CoolFace
Apppublic

ymcmy/AI_Generated_Image_Detector

sourceHugging Facemitupdated 2y agoView on Hugging Face
9likes
App README

Mode Description

Images are first divided into patches and classified as rich texture or poor texture. The azimuthal integral is then calculated for each patch with positional embedding applied. See train.py for subsequent classifier architecture. The four datasets I trained on:

  • AI Recognition Dataset: https://www.kaggle.com/datasets/superpotato9/dalle-recognition-dataset
  • AI ArtBench: https://www.kaggle.com/datasets/ravidussilva/real-ai-art
  • Dalle-3 Images: https://huggingface.co/datasets/ehristoforu/dalle-3-images
  • 130k Images--Universal Image Embeddings: https://www.kaggle.com/datasets/rhtsingh/130k-images-512x512-universal-image-embeddings

I sampled approximated 50,000 real and 50,000 AI generated images. I was able to achieve 97.5% validation accuracy

Training Suggestion

First run preprocess.py and save the preprocessed data as .h5 files in disk. Then run train.py for model training. Preprocessing takes a long time (probably longer than training). It's not a good idea to preprocess while you train, because preprocessing will max out the CPU and leave the GPU idle.

Thanks

The model design is inspired by https://arxiv.org/abs/2311.12397 and https://arxiv.org/abs/2003.01826. Used code from https://github.com/hridayK/Detection-of-AI-generated-images and https://github.com/cc-hpc-itwm/UpConv