This repository contains the implementation of a Deep Convolutional Generative Adversarial Network (DCGAN) for generating images of cats. The project consists of three main components:
- DCGAN Notebook: The main implementation of the DCGAN architecture.
- Preprocessing Script: A Python script for preprocessing the cat image dataset.
- Trained Model: An H5 file containing the trained generator model.
The goal of this project is to generate realistic images of cats using a DCGAN. The project demonstrates the power of generative models and serves as a proof of concept for generative AI.
- Clone this repository:
git clone https://github.com/your-username/cat-dcgan.git cd cat-dcgan
- Ensure you have a dataset of cat images larger than 128x128 pixels.
- Run the preprocessing script to prepare the dataset:
python preprocessing_cat_dataset.py --data_dir path/to/your/dataset
- Train the DCGAN by running the Jupyter notebook
DCGAN.ipynb
or the equivalent Python script.
After training, you can use the trained model to generate cat images. Load the model from the cat_generator_model-250epochs.h5
file and use it to generate new images.
- DCGAN.ipynb: The main implementation of the DCGAN architecture.
- preprocessing_cat_dataset.py: Script for preprocessing the cat image dataset.
- cat_generator_model-250epochs.h5: Trained generator model saved after 250 epochs.
The notebook contains the following sections:
- Generator Architecture: Defines the architecture of the generator model.
- Discriminator Architecture: Defines the architecture of the discriminator model.
- Loss Functions: Defines the loss functions for the generator and discriminator.
- Training Loop: Contains the training loop for training the DCGAN.
- Data Preprocessing: Prepares the cat image dataset for training.
- Model Training: Trains the DCGAN and saves the generator model.
The preprocessing script resizes and augments the images to prepare them for training. It also generates a DataFrame for use with the Keras ImageDataGenerator.
The trained generator model can be loaded and used to generate new images of cats.
This project was inspired by the original DCGAN paper by Radford, Metz, and Chintala. Special thanks to the TensorFlow and Keras teams for their excellent libraries.