This folder contains an implementation of an Auxiliary Classifier Generative Adversarial Network (ACGAN) using PyTorch. ACGAN extends the traditional GAN architecture by incorporating class information into both the generator and discriminator, allowing control over the generated samples' characteristics.
ACGANs are capable of generating high-quality images conditioned on specific classes. In addition to generating images, the discriminator in ACGAN also predicts the class labels of the generated images. This allows for more controlled and targeted image synthesis.
To use this implementation, follow these steps:
-
Clone the repository:
git clone https://github.com/UTSAVS26/GAN-models.git cd GAN_models/ACGAN
-
Install dependencies: Make sure you have Python 3 and pip installed. Then install the required dependencies:
pip install -r requirements.txt
This will install PyTorch, torchvision, matplotlib, and numpy.
-
Train the ACGAN: Run the
ACGAN.py
script to train the ACGAN model. This will train the ACGAN on the MNIST dataset and save the trained models (G_acgan.pth
andD_acgan.pth
).python ACGAN.py
-
Generate new images: After training, you can generate new images using the trained generator by running the
test_ACGAN.py
script.python test_ACGAN.py
This script loads the trained generator model and generates a grid of sample images.
ACGAN.py
: Contains the implementation of the ACGAN model, training loop, and saving of trained models.test_ACGAN.py
: Uses the trained generator to generate sample images after training.
Contributions are welcome! If you have ideas for improvements or new features, feel free to open an issue or submit a pull request.