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
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
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
@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}}
}