Skip to content

myoons/CycleGAN-Gender-Changer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gender Changer w/ CycleGAN 👫

Version Documentation Maintenance Motivation: Fun



👤 Author : Myoons



🌈 Motivation : To give pleasure to friends

FUN is the best! It's always thrilling.



📝 Dataset : Korean Celebrities

Since the purpose of the project was to give pleasure to my friends, I needed a model that was appropriate to Koreans. So I collected Korean Celebrities Images as Dataset. I crawled images with Selenium and used Face Recognition to crop the face in the images.

Man : 3667 Images

Woman : 4272 Images

Dataset Link



🔧 Training

1. Install Repository

You can install this repository using git clone

git clone https://github.com/myoons/CycleGAN-Gender-Changer.git

2. Setup Dataset

Download the dataset from Google Drive
Then build the dataset by setting up the following the directory structure.

├── datasets
|   ├── <dataset_name>         # i.e. genderchange
|   |   ├── train              # Training
|   |   |   ├── A              # Contains domain A images (i.e. Man)
|   |   |   └── B              # Contains domain B images (i.e. Woman)
|   |   └── test               # Testing
|   |   |   ├── A              # Contains domain A images (i.e. Man)
|   |   |   └── B              # Contains domain B images (i.e. Woman)

3. Train!

python train.py --dataroot datasets/<dataset_name> --cuda

This command will start a training session using the images under the dataroot/train directory with the hyperparameters that showed best results according to CycleGAN authors.

If you don't own a GPU remove the --cuda option, although I advise you to get one!



📟 Tensorboard

tensorboard --logdir ./logs

You can watch your experiments' progress by runing tensorboard



🚩 Major Flags

1. --n_epochs : Number of epochs in training

* Default : 400
* Type : Int

2. --batchSize : Size of Batch

* Default : 10
* Type : Int

3. --size : Size of Image Crop (Squre Assumed)

* Default : 256
* Type : Int

4. --dataroot : Root Directory of Dataset

* Default : Input as Arugment
* Type : Str

5. --input_nc / --output_nc : Number of channels of input / output data

* Default : 3
* Type : Int



📁 Directories

1. data_utils : Crawl & Pre-process dataset

* Foreign_Crawling : Crawling foreign person images
* Format_Change : PNG2JPG & File Renaming
* Korean_Crawling : Crawling Korean Celebrities images
* chromedriver : Selenium Chrome Driver
* face_detector : Croping face from images

2. models : Discriminator & Generator

* discriminator : Discriminator model
* generator : Generator Model

3. utils : Utils for training

* utils : training utils



📈 Learning Graph (Tensorboard)

1. Loss_D

LossD


2. Loss_G

LossG


3. Loss_G_GAN

LossGGan


4. Loss_G_Identity

LossGIdentitiy


5. Loss_G_Cycle

LossGCycle



🔥 Results

1. Man2Woman

Man2Woman


2. Woman2Man

Woman2Man



🔗 References

1. Paper
2. Base Code
3. Face Recognition
4. Project Description
5. CycleGAN Home Page
6. CycleGAN Description Video

About

Changes the gender of face using CycleGAN

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published