This repository provides code for this paper: GAN-based Projector for Faster Recovery with Convergence Guarantees in Linear Inverse Problems.
Linux system, a GPU
Create a conda virtual environment and install packages
conda create --name NPGD python=3.4
conda activate NPGD
conda install pytorch=1.2.0 imageio=2.6.1 matplotlib=3.1.1 numpy=1.17.2 scikit-image=0.15.0 scikit-learn=0.21.3 requests=2.22.0 torchvision=0.4.0
Clone this repo
git clone https://github.com/yuqili3/NPGD_linear_inverse_prob.git
cd NPGD_linear_inverse_prob
Download the dataset as well as the test images, we need to crop and resize the faces from the original images.
unzip celebAtest.zip -d data/celebA/testing_images
unzip mnisttest.zip -d data/mnist/
python download_data.py celebA
rm -rf ./data/celebA/celebA_data_raw
rm ./data/celebA/celebA_data.zip
this may take several minutes to download the large file
Train the network projector models.
python MNIST_DCGAN.py --k=100 --epochs=40 --lr=1e-4
python MNIST_invDCGAN_multi_task_loss.py --k=100 --epochs=100 --lr=1e-4 --lamda=0.1 --sigma=1
python CELEBA_DCGAN.py --k=100 --epochs=40 --lr=1.5e-4
python CELEBA_invDCGAN_multi_task_loss.py --k=100 --epochs=100 --lr=1e-4 --lamda=0.1 --sigma=1
Compressed sensing using random Gaussian matrix
python MNIST_projection_using_inv_gen.py --k=100 --task=cs --m=100 --designed=0 --lr=1 --ite=30 --info=1
python CELEBA_projection_using_inv_gen.py --k=100 --task=cs --m=1000 --designed=0 --lr=0.5 --ite=30 --info=1
Image inpainting
python MNIST_projection_using_inv_gen.py --k=100 --task=ip --mask_size=8 --lr=2 --ite=30 --info=1
python CELEBA_projection_using_inv_gen.py --k=100 --task=ip --mask_size=32 --lr=1 --ite=30 --info=1
Image super resolution
python MNIST_projection_using_inv_gen.py --k=100 --task=sr --sr_ratio=2 --lr=6 --ite=30 --info=1
python CELEBA_projection_using_inv_gen.py --k=100 --task=sr --sr_ratio=2 --lr=6 --ite=30 --info=1
Use a designed matrix in compressed sensing
mnist
python design_measurement_matrix.py --dataset=MNIST --k=100
python MNIST_projection_using_inv_gen.py --k=100 --task=cs --m=200 --designed=1 --lr=1 --ite=30 --info=1
celebA
python design_measurement_matrix.py --dataset=CELEBA --k=100
python CELEBA_projection_using_inv_gen.py --k=100 --task=cs --m=1000 --designed=1 --lr=1 --ite=30 --info=1