# AI-generated image detection **(Work In Progress)** - [ ] Refactor code - [ ] Review dependencies - [ ] Containerize (Docker) - [ ] Update documentation ## AI-Generated Image detection This part handles the detection of AI-generated images. The current code contains two classifiers to detect AI-generated images from two types of architectures: - GANs ## Model weights ### 1. CNN Detection Run the `download_weights_CNN.sh` script: ```commandline bash download_weights_CNN.sh ``` Note: you need `wget` installed on your system (it is by default for most Linux systems). ### 2. Diffusion **TODO** ## Run the models Make sure you have the weights available before doing so. **TODO: environments** ### 1. CNN Detection ```commandline python CNN_model_classifier.py ``` Available options: - `-f / --file` (default=`'examples_realfakedir'`) - `-m / --model_path` (default=`'weights/blur_jpg_prob0.5.pth'`) - `-c / --crop` (default=`None`): Specify crop size (int) by default, do not crop. - `--use_cpu`: use cpu (by default uses GPU) -> **TODO: remove (obsolete)** Example usage: ```commandline python CNN_model_classifier.py -f examples/real.png -m weights/blur_jpg_prob0.5.pth ``` ### 2. Diffusion detection **TODO** ## References Based on: - https://github.com/hoangthuc701/GenAI-image-detection - https://github.com/ptmaimai106/DetectGenerateImageByRealImageOnly