Imagine receiving a self-portrait from the renowned Dutch Post-Impressionist painter Vincent van Gogh. Seems impossible, right? In recent years, Microsoft researchers have developed the CycleGAN model, specifically designed for unpaired image-to-image translation. This powerful model has a wide range of applications, from enhancing photographs to transforming seasons or styles. With CycleGAN, you can translate any image to another domain, regardless of whether they are paired.
To build the CycleGAN Model in PyTorch for translating animal image to other domain irrespective of the pairing between two images.
The dataset includes images of horses in domain A and zebras in domain B, divided into train and test sets.
- Language:
Python
- Libraries:
torch
,torchvision
,numpy
,pillow
- Introduction to CycleGAN
- Introduction to ResNet
- Loss function in CycleGAN
- Building Model on PyTorch
- Model training
- data: Contains the horse2zebra dataset, split into train and test sets with domain A as Horse and domain B as Zebra.
- images: Contains translated images from domain A to B.
- saved_model: Placeholder for saving trained models.
- cyclegan.py: The main script for training the CycleGAN model.
- datasets.py: Contains code for data loading and preprocessing.
- models.py: Defines the CycleGAN model architecture.
- utils.py: Utility functions used in training.
- requirements.txt: Lists all the required libraries with their respective versions. Install them using
pip install -r requirements.txt
.