Pyramid-VAE-GAN: Transferring Hierarchical Latent Variables for Image Inpainting
Huiyuan Tian, Li Zhang, Shijian Li, Min Yao and Gang Pan
Our contributions made in this paper are summarized as follows:
- To the best of our knowledge, the Pyramid-VAE backbone is used in the domain of image inpainting firstly. Our model augments the details of generated pictures by pyramid structure while improving rationality of structure via VAE.
- We propose a latent variable transfer module for the first time. The long-term correlations in high-level latent variables can be transferred to low-level latent variables with more details, thus it is capable of generating both visually and semantically convincing images.
- Our VAE-GAN hybrid model improves the robustness of the training process and enhances the sharpness of the generated images.
Our work is mainly based on PEN-Net-for-Inpainting.
- Environments:
- Install python3.6
- Install PyTorch (tested on Release 1.7.1)
- Preparation
- Download training/valid/test images file lists and put them into
flistfolder - Download datasets and put them into
datazipfolder - Keep
flist,datazipandPyramid-VAE-GANfolder in the same level directory
- Download training/valid/test images file lists and put them into
- Training: For different datasets, the following commands can be used for training respectively.
# facade
python train.py -c configs/facade.json -n pvg_facade -m square -s 256
# dtd
python train.py -c configs/dtd.json -n pvg_dtd -m square -s 256
# celebahq
python train.py -c configs/celebahq.json -n pvg_celebahq -m square -s 256- Testing: For different datasets, the following commands can be used for testing respectively.
# facade
python test.py -c configs/facade.json -n pvg_facade -m square -s 256
# dtd
python test.py -c configs/dtd.json -n pvg_dtd -m square -s 256
# celebahq
python test.py -c configs/celebahq.json -n pvg_celebahq -m square -s 256- Evaluating:
python eval.py --real_dir [ground truths] --fake_dir [inpainting results] --metric mae psnr ssim fid- Download the pretrained models named
pvg_celebahq_celebahq_square256for CELEBA-HQ and put it underrelease_model/ - DTD and Facade are similar.
If this work is helpful for your research, please consider citing the following BibTeX entry.
@article{tian2023pyramid,
title={Pyramid-VAE-GAN: Transferring hierarchical latent variables for image inpainting},
author={Tian, Huiyuan and Zhang, Li and Li, Shijian and Yao, Min and Pan, Gang},
journal={Computational Visual Media},
pages={1--15},
year={2023},
publisher={Springer}
}



