ArthurConmy / L-BRGM

Implementation of the L-BRGM model from our paper https://arxiv.org/abs/2110.03814 (IEEE ICASSP 2022)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

         

diagram

StyleGAN-induced data-driven regularization for inverse problems

Arthur Conmy, Subhadip Mukherjee, and Carola-Bibiane Schönlieb

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.

Requirements

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 model ffhq.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

Usage

For further options, call python3 run.py --help.

Super-resolution

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

Inpainting

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

About

Implementation of the L-BRGM model from our paper https://arxiv.org/abs/2110.03814 (IEEE ICASSP 2022)


Languages

Language:Python 89.7%Language:Cuda 7.1%Language:C++ 3.2%Language:Makefile 0.0%Language:Shell 0.0%