Skip to content

Khelendrameena/GAN_Ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 

Repository files navigation

GAN_Ai

GAN_Ai is a lightweight Python project demonstrating Generative Adversarial Networks (GANs) for image generation and experimentation. It provides training scripts, model checkpoints, and utilities to train, evaluate, and sample from GAN models. The repository is intended for researchers, students, and hobbyists who want a simple, well-documented starting point for GAN experiments.

Features

  • Simple, modular GAN implementation in Python
  • Training script with configurable hyperparameters
  • Utilities for dataset preparation, logging, and checkpointing
  • Sampling script to generate images from saved checkpoints
  • Example configuration and tips for experimentation

Repository structure

  • data/ - datasets or dataset download utilities
  • models/ - model definitions (Generator, Discriminator)
  • scripts/ - training, sampling, and evaluation scripts
  • checkpoints/ - saved model weights and training logs
  • notebooks/ - Jupyter notebooks for exploration and visualization
  • requirements.txt - Python dependencies
  • README.md - this file

Note: adjust paths above if your repository uses a different layout.

Requirements

  • Python 3.8+
  • PyTorch (or TensorFlow) depending on the implementation
  • torchvision (if using common image datasets)
  • numpy, matplotlib, tqdm

Install dependencies (if a requirements.txt is present):

pip install -r requirements.txt

Or install common packages manually:

pip install torch torchvision numpy matplotlib tqdm

Quick Start

  1. Prepare dataset
  • Place images in data/<dataset-name>/ with subfolders per class if required, or implement a dataset loader in scripts/data_loader.py.
  1. Train a model

python scripts/train.py --config configs/default.yaml --dataset data/

Common arguments:

  • --config: path to YAML/JSON config with hyperparameters
  • --epochs: number of training epochs
  • --batch-size: training batch size
  • --lr: learning rate
  • --device: cpu or cuda
  1. Generate samples

python scripts/generate.py --checkpoint checkpoints/latest.pt --output samples/

  1. Evaluate or visualize results
  • Use notebooks in notebooks/ for interactive analysis
  • Plot losses and sample grids saved by the training script

Configuration

Configurations are typically stored in configs/ as YAML or JSON. Example fields:

  • model: generator/discriminator architecture and hyperparameters
  • optimizer: type, learning rate, betas
  • training: batch size, epochs, checkpoint interval
  • dataset: path, image size, transforms

Checkpoints & Resuming

  • Training saves checkpoints to checkpoints/ by default. Use --resume or --checkpoint to resume training or sample from a saved model.

Tips for Better Results

  • Start with smaller models and datasets to verify your pipeline
  • Use learning rate schedulers and gradient penalty for improved stability
  • Normalize images to [-1, 1] if using Tanh in generator output
  • Monitor FID or IS scores for quantitative evaluation

Contributing

Contributions are welcome. Please open an issue to discuss major changes or submit a pull request with:

  • a clear description of the change
  • tests or example usage when applicable
  • updates to documentation if behavior changes

License

Specify a license in a LICENSE file (e.g., MIT). If you have a preferred license, add it to the repository.

Acknowledgements

This project is inspired by many GAN tutorials and research papers. Credit to authors of the original GAN, DCGAN, WGAN, and others for ideas and best practices.

Contact

For questions or help, open an issue or contact the repository owner.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages