Skip to content

david-svitov/baldgan

Repository files navigation

BaldGAN

example 1 example 2 example 3

This repository contains:

  • The source code for training the GAN model making people bald
  • Data with bald people for training a neural network
  • Pretrained neural network weights

Training data

dataset example

Data consists of two parts:

  • Bald people
  • Wigs
Dataset Image count
Bald people 3 698
Wigs 48

Bald people: google disk

Bald people preprocessed for GAN: google disk

Wigs: google disk

Bald people were obtained from:

  • CelebA with manual filtration
  • Collected manually from pinterest.com

Training

Pretrained model: google disk

The project is based on code from the keras-gan repository.

As a face detector, RetinaFace is used.

Project structure:

  • train.py - network training script
  • test.py - network inference script
  • data_loader_alpha_sintes.py - data generator
  • dataset_prepare.ipynb - notebook for data preparation (or just download the prepared)

To start training:

$ CUDA_VISIBLE_DEVICES=1 python3 pix2pix_InsNorm.py

To achieve the best result, it is better to pretrain the generator without a discriminator.

Features of the used model:

  • Two discriminators: for the whole face and the area under the hair
  • Using perceptual loss
  • InstanceNormalization

Citation

@misc{david-svitov-2020-baldgan,
  author = {David Svitov},
  title = {BaldGAN: Generative model for hair removal from photo},
  year = {2020},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/david-svitov/baldgan}}
}

About

GAN model making people bald

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published