All Projects → hiepph → cgan-face-generator

hiepph / cgan-face-generator

Licence: other
Face generator from sketches using cGAN (pix2pix) model

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to cgan-face-generator

Pytorch Pix2pix
Pytorch implementation of pix2pix for various datasets.
Stars: ✭ 74 (+42.31%)
Mutual labels:  gan, generative-model, pix2pix
Tensorflow Generative Model Collections
Collection of generative models in Tensorflow
Stars: ✭ 3,785 (+7178.85%)
Mutual labels:  gan, generative-model, cgan
Pytorch Generative Model Collections
Collection of generative models in Pytorch version.
Stars: ✭ 2,296 (+4315.38%)
Mutual labels:  gan, cgan
Munit
Multimodal Unsupervised Image-to-Image Translation
Stars: ✭ 2,404 (+4523.08%)
Mutual labels:  gan, pix2pix
Paddlegan
PaddlePaddle GAN library, including lots of interesting applications like First-Order motion transfer, wav2lip, picture repair, image editing, photo2cartoon, image style transfer, and so on.
Stars: ✭ 4,987 (+9490.38%)
Mutual labels:  gan, pix2pix
Pix2pix Film
An implementation of Pix2Pix in Tensorflow for use with frames from films
Stars: ✭ 162 (+211.54%)
Mutual labels:  gan, pix2pix
Pose2pose
This is a pix2pix demo that learns from pose and translates this into a human. A webcam-enabled application is also provided that translates your pose to the trained pose. Everybody dance now !
Stars: ✭ 182 (+250%)
Mutual labels:  gan, pix2pix
Triple Gan
See Triple-GAN-V2 in PyTorch: https://github.com/taufikxu/Triple-GAN
Stars: ✭ 203 (+290.38%)
Mutual labels:  gan, generative-model
P2pala
Page to PAGE Layout Analysis Tool
Stars: ✭ 147 (+182.69%)
Mutual labels:  gan, pix2pix
coursera-gan-specialization
Programming assignments and quizzes from all courses within the GANs specialization offered by deeplearning.ai
Stars: ✭ 277 (+432.69%)
Mutual labels:  generative-model, pix2pix
MXNet-GAN
MXNet Implementation of DCGAN, Conditional GAN, pix2pix
Stars: ✭ 23 (-55.77%)
Mutual labels:  pix2pix, cgan
pix2pix-tensorflow
A minimal tensorflow implementation of pix2pix (Image-to-Image Translation with Conditional Adversarial Nets - https://phillipi.github.io/pix2pix/).
Stars: ✭ 22 (-57.69%)
Mutual labels:  gan, pix2pix
Cyclegan Vc2
Voice Conversion by CycleGAN (语音克隆/语音转换): CycleGAN-VC2
Stars: ✭ 158 (+203.85%)
Mutual labels:  gan, pix2pix
Deblurgan
Image Deblurring using Generative Adversarial Networks
Stars: ✭ 2,033 (+3809.62%)
Mutual labels:  gan, pix2pix
Dragan
A stable algorithm for GAN training
Stars: ✭ 189 (+263.46%)
Mutual labels:  gan, generative-model
Pix2pixbegan.pytorch
A pytorch implementation of pix2pix + BEGAN (Boundary Equilibrium Generative Adversarial Networks)
Stars: ✭ 148 (+184.62%)
Mutual labels:  gan, pix2pix
Swapnet
Virtual Clothing Try-on with Deep Learning. PyTorch reproduction of SwapNet by Raj et al. 2018. Now with Docker support!
Stars: ✭ 202 (+288.46%)
Mutual labels:  gan, pix2pix
pytorch gan
Spectral Normalization and Projection Discriminator
Stars: ✭ 16 (-69.23%)
Mutual labels:  gan, cgan
Unit
Unsupervised Image-to-Image Translation
Stars: ✭ 1,809 (+3378.85%)
Mutual labels:  gan, pix2pix
Tensorflow Pix2pix
A lightweight pix2pix Tensorflow implementation.
Stars: ✭ 143 (+175%)
Mutual labels:  gan, pix2pix

Face generator using cGAN (Back End)

Blog post

We proposed and had experiment with cGAN model (Paper) for face generating task from sketches.

Data is prepared from CAF dataset, including 8303 images of women's faces.

This repo is the Back End part of integrating Pytorch model with Flask Python web framework. It serves RESTful-API request and return generated image.

overview

Disclosure: The model implementation is written in Pytorch by @junyanz. Check out his project pytorch-CycleGAN-and-pix2pix. We use it for our research and implementation with retained LICENSE.

Requirements

git clone https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix
cd pytorch-CycleGAN-and-pix2pix

Data

Grab data from here: CAF dataset, over 8.000 faces of famous actresses.

We use crawler/face_edges.py to get sketched images (A) from real CAF images (B). And then separate train/validation ratio for each A, B as 80/20.

Script for combining them as trained input:

python datasets/combine_A_and_B.py --fold_A ./datasets/caf/A --fold_B ./datasets/caf/B --fold_AB ./datasets/caf

It now has ./datasets/caf/train and ./datasets/caf/val. You can have sense of each image like example below:

input

Training

  • Script for training:
python train.py --dataroot ./datasets/caf --name caf_pix2pix --model pix2pix --which_model_netG unet_256 --which_direction AtoB --lambda_A 100 --dataset_mode aligned --no_lsgan --norm batch --pool_size 0 --batchSize 12 --save_latest_freq 1000 --niter 15 --niter_decay 15
python -m visdom.server

We trained 30 epochs. It takes about 10 hours on an Nvidia GeForce GTX 960. And just 2.5 hours on 4 GPUs of AWS EC2 p2.8xlarge instances in comparison. Train GAN is always expensive and time-consuming.

A glimpse of training process:

visdom

train

Server integration

  • Back End part is now done in our repo:
git clone https://github.com/hiepph/cgan-face-generator
cd cgan-face-generator
  • Pre-trained model: You can grab here, already included G model's weights latest_net_G.pth and D model's weights latest_net_D.pth:
mv caf_cgan.zip cgan-face-generator
unzip cgan-face-generator
  • Fire up Flask server at port 5000:
python server.py --dataroot ./datasets/gal  --name caf_pix2pix --model test --which_model_netG unet_256 --which_direction AtoB --dataset_mode single --norm batch
  • Check connection:
curl 'localhost:5000/'
  • Now you can test uploading your sketch as form-data with file key, route is POST /gen:
curl -X POST -F "file=@/path/to/sketch.jpg" 'localhost:5000/gen' --output response.png

Or with Postman:

postman

Demo

gal

wonder

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].