guidopetri / cyclegan

Project for NYU Courant's Computer Vision course.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CycleGAN for Human to Anime Face Generation

Overview

This repository contains a PyTorch reimplementation of CycleGAN, and was used to transform human faces into anime faces.

Installation

Clone and install

With pip:

$ git clone https://github.com/charlesoblack/cyclegan
$ cd cyclegan/
$ pip3 install -r requirements.txt

With conda:

$ git clone https://github.com/charlesoblack/cyclegan
$ cd cyclegan/
$ conda env create -f environment.yml
$ conda activate cyclegan

Dataset

The datasets used by this project consisted of human faces and anime faces. The human faces come from the Real and Fake Face Detection dataset(only the real faces were used). The anime faces were compiled by Mckinsey666 and can be found here.

Setup data directory

The dataset directory should be structured as follows:

├── datasets                   
|   ├── <dataset_name>         # i.e. human2anime
|   |   ├── train              # Training
|   |   |   ├── A              # Contains domain A images (i.e. human faces)
|   |   |   └── B              # Contains domain B images (i.e. anime faces)
|   |   └── test               # Testing
|   |   |   ├── A              # Contains domain A images (i.e. human faces)
|   |   |   └── B              # Contains domain B images (i.e. anime faces)

Train Example

$ cd src/
$ python3 train.py --dataset human2anime --name experiment1

Loading pre-trained weights or resuming training

If you want to load pre-trained weights or resume from a checkpoint, simply add the epoch to resume from:

# Example: human2anime dataset, experiment1 for epoch 100
$ python3 train.py --dataset human2anime --name experiment1 --starting-epoch 100

Test Example

$ cd src/
$ python3 test.py --dataset human2anime --name experiment1

About

Project for NYU Courant's Computer Vision course.


Languages

Language:Jupyter Notebook 94.8%Language:Python 5.2%