• Stars
    star
    223
  • Rank 178,458 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 4 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A deep learning model to age faces in the wild, currently runs at 60+ fps on GPUs

Fast-AgingGAN

This repository holds code for a face aging deep learning model. It is based on the CycleGAN, where we translate young faces to old and vice versa.

Samples

Top row is input image, bottom row is aged output from the GAN. Sample Second-Sample

Timing

The model executes at 66fps on a GTX1080 with an image size of 512x512. Because of the way it is trained, a face detection pipeline is not needed. As long as the image of spatial dims 512x512 contains a face of size 256x256, this will work fine.

Demo

To try out the pretrained model on your images, use the following command:

python infer.py --image_dir 'path/to/your/image/directory'

Training

To train your own model on CACD or UTK faces datasets, you can use the provided preprocessing scripts in the preprocessing directory to prepare the dataset. If you are going to use CACD, use the following command:

python preprocessing/preprocess_cacd.py --image_dir '/path/to/cacd/images' --metadata '/path/to/the/cacd/metadata/file' --output_dir 'path/to/save/processed/data'

If using UTK faces, use the following:

python preprocessing/preprocess_utk.py --data_dir '/path/to/cacd/images' --output_dir 'path/to/save/processed/data'

Once the dataset is processed, you should go into configs/aging_gan.yaml and modify the paths to point to the processed dataset you just created. Change any other hyperparameters if you wish, then run training with:

python main.py

Tensorboard

While training is running, you can observe the losses and the gan generated images in tensorboard, just point it to the 'lightning_logs' directory like so:

tensorboard --logdir=lightning_logs --bind_all