AI_Vs_Real/Classifier.ipynb
This project leverages the Vision Transformer (ViT) model for classifying images into different categories. The code includes data preprocessing, model training, evaluation, and testing using the Hugging Face transformers library. The model is fine-tuned using a dataset stored locally, and predictions are made on a separate test dataset.
Before running the code, ensure that the following dependencies are installed:
- TensorFlow: For model training and Keras functionality.
- tqdm: To visualize the progress during training and processing.
- scikit-learn: For Label Encoding and dataset handling.
- transformers: To use pre-trained Vision Transformer (ViT) models from Hugging Face.
- datasets: For loading and processing datasets.
- accelerate: To optimize model training and inference performance.
- PIL (Pillow): For image manipulation and resizing.
- torch and torchvision: For tensor operations and model predictions.
This repository provides code for training a Generative Adversarial Network (GAN) using the FFHQ dataset and uses generated images to train a simple CNN classifier.
- Data: The FFHQ dataset (Flickr-Faces-HQ) is used for training the GAN. This dataset contains high-quality images of human faces.
- Model: A WGAN-GP (Wasserstein GAN with Gradient Penalty) architecture is implemented, consisting of:
- Generator: A neural network that generates synthetic images.
- Discriminator: A neural network that distinguishes between real and generated images.
- Training: The model is trained to generate high-quality images of human faces. The discriminator is trained to correctly classify real vs fake images while the generator tries to fool it.
- Synthetic Data Generation: Once trained, synthetic images generated by the GAN are used to train a CNN classifier to distinguish between real and synthetic images.
GAN/Training.ipynb
The following dependencies are required for the code:
- Python 3.x
- TensorFlow (>=2.0)
- Numpy
- Matplotlib
- OpenCV
- tqdm
- Pillow
- os
- shutil
To install the required packages, you can use the following command:
pip install -r requirements_custom_gan.txt