This repository is an implementation of the L-BRGM model introduced in our paper. It builds off the implementation of BRGM here, which in turn is built on top of the StyleGAN2-ADA implementation in PyTorch here.
Currently, the code supports super-resolution and inpainting of faces formatted to the FFHQ dataset standard.
Feel free to create a GitHub issue, or get in contact with the primary author with any issues.
There is a colab demo of the project that's available here.
Our method, L-BRGM, like the BRGM method, builds on the StyleGAN-ADA Pytorch codebase, so our requirements are the same as for StyleGAN2 Pytorch:
- 64-bit Python 3.7 and PyTorch 1.7.1. See https://pytorch.org/ for PyTorch install instructions.
- CUDA toolkit 11.0 or later. Use at least version 11.1 if running on RTX 3090. If version 11 is not available, the implementation should still work.
- Run
make downloadNet
. This will download the pre-trained modelffhq.pkl
(available here) into the main directory.
Currently untested:
python3 -m venv lbrgm
source lbrgm/bin/activate
pip3 install torch==1.10.1+cu113 torchvision==0.11.2+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
pip3 install click requests tqdm pyspng ninja imageio-ffmpeg==0.4.3 imageio scikit-image opencv-python pyro-ppl lpips matplotlib
For further options, call python3 run.py --help
.
To run a superresolution experiment, run
python3 run.py --device=cuda --outpath=MY_OUTPATH --fpaths=faces/superres/truelow0.png --fpath-corrupted=True --reconstruction-type=superres --input-dim=64 --model=LBRGM
python3 run.py --device=cuda --outpath=my_outpath --fpaths=faces/inpaint/ffhq-1659.png --fpath-corrupted=False --reconstruction-type=inpaint --model=LBRGM --mask=masks/1024x1024/0.png