Skip to content

katiaperchet/ai-art-casa

Repository files navigation

AI_Human

1. AI-Generated Art Detection Project

In this project we attempt to explore the application of deep learning techniques for image classification by making an image classifier that recognizes if a given Art Image is generated by an AI or not.

All models have been trained with Art Images provided by the following dataset from Kaggle:

The project is organized by following the next approach:

  1. Apply CNNs to each Art Style - Classify if image of given Art Style is AI Generated or not.
  2. Apply CNNs to all Art Styles - Classify if image from any Art Style is AI Generated or not.

Results obtained by running all the models are in the following report:

Authors: Katia Melanie Perchet, Franco Nicolas Merenda.

1.1. Dataset: AI-ArtBench

AI-ArtBench is a dataset that contains 180,000+ art images. 60,000 of them are human-drawn art that was directly taken from ArtBench-10 dataset and the rest is generated equally using Latent Diffusion and Standard Diffusion models. The human-drawn art is in 256x256 resolution and images generated using Latent Diffusion and Standard Diffusion has 256x256 and 768x768 resolutions respectively.

Dataset Information:

  1. Folders Organization: AI_<source_model>_<art_style>
    1. source_model: Latent Diffusion (LD), Standard Diffusion (SD)
    2. art_style: Art Nouveau, Baroque, Expressionism, Impressionism, Post impressionism, Realism, Renaissance, Romanticism, Surrealism, Ukiyo-e
  2. Total Images Count from All Art Styles:
    • Train Split : 155,015
    • Test Split : 30,000

1.2. CNN - Models

In this project we have tested different types of CNNs architectures in order to perform good accuracy.

For each Art Style, we tested the following CNNs:

  1. CNN - Defined by authors
Screenshot 2024-07-21 at 2 41 21 PM
  1. VGG16 (Transfer Learning) + Flatten() + Dense(256, "relu") + Dropout(0.5) + Dense(1, "sigmoid")
  2. VGG19 (Transfer Learning) + Flatten() + Dense(256, "relu") + Dropout(0.5) + Dense(1, "sigmoid")

For All Art Styles, we tested the following CNNs:

  1. ResNet50 (Transfer Learning) + Flatten() + Dense(256, "relu") + Dropout(0.5) + Dense(1, "sigmoid")
  2. InceptionV3 (Transfer Learning) + Flatten() + Dense(256, "relu") + Dropout(0.5) + Dense(1, "sigmoid")

2. Setup Environment

2.1 Using poetry

  1. Install Python
  2. Clone Project
git clone https://github.com/katiaperchet/ai-art-casa
  1. Install Poetry - Follow instructions.
  2. Go to the project directory
  3. Install dependencies
poetry install
  1. Run jupyter-notebook to access notebooks and run examples/tests!
poetry run jupyter notebook

2.2 Using pip

  1. Install Python
  2. Clone Project
git clone https://github.com/katiaperchet/ai-art-casa
  1. Go to the project directory
  2. Install dependencies
pip install -r requirements.txt
  1. Run jupyter-notebook to access notebooks and run examples/tests!
poetry run jupyter notebook

2.3 Using miniforge - conda -- MacOS M1/M2 🍎 GPU Support!

Useful Links:

  1. TensorFlow Installation on Mac M1/M2(Apple Silicon) Chip | Quick Setup Guide
  2. TensorFlow Setup on Apple Silicon Mac (M1, M1 Pro, M1 Max)

NOTE: Run your terminal in ARM64 Mode. You can use the following aliases to run as ARM or X86.

alias arm="env /usr/bin/arch -arm64 /bin/zsh --login"
alias intel="env /usr/bin/arch -x86_64 /bin/zsh --login"
  1. Download Miniforge3
git clone https://github.com/katiaperchet/ai-art-casa
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh
chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh
sh ~/Downloads/Miniforge3-MacOSX-arm64.sh
source ~/miniforge3/bin/activate
  1. (Option 1) - Create conda environment with python=3.11 with tensorflow=2.16.2 dependencies:

    i. Create it Step by step

    conda install -c apple tensorflow-deps
    conda create -n tensorflow python=3.11
    # Activate created virtual environment
    conda activate tensorflow

    ii. Install necessary dependencies (Two options):

    pip install tensorflow-macos
    pip install tensorflow-metal
    conda install numpy=1.26.4 pandas matplotlib scikit-learn scipy plotly jupyter seaborn
  2. (Option 2) - Create conda environment from file

conda env create -f conda_macm1_environment.yaml
  1. Run jupyter notebook with GPU support!

Issues

Windows🪟 - Environment Setup Issue

  • If issues with TensorFlow importing:
    • Solution: pip install tensorflow==2.16.1 --force-reinstall

About

Generative AI Images - Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published