한국어 버전의 설명은 여기를 참고하시기 바랍니다.
A Conditional Generative Adversarial Network (CGAN) is a generative model aimed at creating new data that satisfies specific conditions.
CGAN is an extension of the vanilla GAN, with the addition of conditions during training.
In the case of MNIST, labels from 0 to 9 are provided as conditions, and CGAN learns to generate data corresponding to each label.
The sequential changes in results during the learning process can be visualized as a GIF file.
Additionally, to verify the quality of the generated data, the Fréchet Inception Distance (FID) score can be used.
For more information on CGAN, please refer to the Conditional Generative Adversarial Network (CGAN) article.
A CGAN using nn.Linear is implemented.
- Base dataset for tutorial is MNIST.
- Custom datasets can also be used by setting the path in the
config/config.yaml. However, implementing a custom dataloader may require additional coding work insrc/utils/data_utils.py.
- CPU, GPU, multi-GPU (DDP), MPS (for Mac and torch>=1.12.0)
python3 src/run/train.py --config config/config.yaml --mode trainThis repository is structured as follows.
├── configs <- Folder for storing config files
│ └── *.yaml
│
└── src
├── models
| └── cgan.py <- CGAN model file
|
├── run
| ├── cal_fid.py <- Codes for calculating FID score
| ├── train.py <- Training execution file
| └── validation.py <- Trained model evaulation execution file
|
├── tools
| ├── pytorch_fid <- Codes for calculating FID score
| | ├── fid_score.py
| | └── inception.py
| |
| ├── model_manager.py
| └── training_logger.py <- Training logger class file
|
├── trainer
| ├── build.py <- Codes for initializing dataset, dataloader, etc.
| └── trainer.py <- Class for training, evaluating, and calculating FID score
|
└── uitls
├── __init__.py <- File for initializing the logger, versioning, etc.
├── data_utils.py <- File defining the custom dataset dataloader
├── filesys_utils.py
└── training_utils.py
Please follow the steps below to train the CGAN.

