What inspires us

We chose this topic because AI-generated images are becoming increasingly common and relevant in our daily lives, especially on social media and online marketplaces. As these images become more realistic, it can be difficult to determine whether what we see online is authentic. This can contribute to misinformation, scams, and a loss of trust in digital content. We were inspired to build AI Image Detector as a practical and accessible tool that helps users identify potentially AI-generated images and make more informed decisions about the content they encounter online.

What it does

AI Image Detector analyses an uploaded image and estimates whether it is AI-generated or authentic. It presents the prediction with a confidence score through a simple interface, helping users make a quick initial assessment without requiring technical knowledge.

How we built it

We built AI Image Detector using three image datasets: CIFAKE, SID_Set and Tiny_GenImage, which contained both real and AI-generated images. We cleaned, combined, and preprocessed the datasets into a consistent format (real and fake images, 80%train 20%test) before using them to train our image-classification model. The trained model learns visual patterns that help distinguish AI-generated images from authentic ones. Finally, we integrated it into a web application where users can upload an image and receive a prediction with a confidence score.

Development Tools Used Our project was primarily developed using Visual Studio Code, where we wrote and managed our code in Python. Because training the model required more computational power than our local devices could provide, we rented a cloud GPU from RunPod. We used Jupyter Notebook within the RunPod environment to preprocess the datasets, train the model, and evaluate its performance.

Assets Used The main assets used in our project were three image datasets: CIFAKE, SID_Set and Tiny_GenImage. They contained real and AI-generated images that we combined and preprocessed to train and evaluate our model. We also used sample images to demonstrate the model’s predictions and the application’s interface.

Libraries Used

  • PyTorch for building and training the model
  • NumPy and Pandas for processing and organizing data
  • OpenCV for loading, resizing, and transforming images
  • Scikit-learn for evaluation metrics such as accuracy, precision, recall, and the confusion matrix
  • Matplotlib for charts and model-performance visualizations
  • Gradio for connecting the model to the application interface

Challenges we ran into

One major challenge was the high computational power required to train our model. Our local devices were not powerful enough to process the two large image datasets efficiently, so we rented a cloud GPU from RunPod. Setting up the environment, transferring the datasets, and managing GPU usage added complexity and cost to the training process. However, it allowed us to train and test our model much faster than we could using our own hardware.

Besides that, our first model CIFAKE-only model scored 98% on CIFAKE tiny 32x32 test set but confidently mislabelled some of the photorealistic ai-generated images. By adding more datasets such as SID_Set and Tiny_GenImage and rebalancing them fixed this.

We then realised that our EfficientNet model still misses photorealistic images from brand-new ai generators. This pushed us to train a CLIP-based detector. It did generalise better to unseen generators but it over-flagaged real images as ai-generated images as ai-generated. We ran out of time to calibrate the model so we have to make the honest call to pick the more reliable EfficientNet model and keep the CLIP model as an experimental documentation

What we learned

We learned that model performance depends heavily on the quality and diversity of its training data. We also learned that accuracy on a test dataset does not always translate directly to unfamiliar images from new generators or social-media platforms.

What's next for AI Image Detector

We realised that our current model may classify an image as real when only a specific part of it has been modified using AI. Our next step is to improve the detector so that it can identify localised AI edits, not just images that were generated entirely by AI. In the future, we hope to highlight the modified regions and provide users with a clearer explanation of where AI manipulation may have occurred.

Built With

Share this project:

Updates