Git Product home page Git Product logo

wavefill's Introduction

WaveFill: A Wavelet-based Generation Network for Image Inpainting (ICCV 2021)

Installation

pip install -r requirements.txt

This code requires the pytorch_wavelets package.

$ git clone https://github.com/fbcotter/pytorch_wavelets
$ cd pytorch_wavelets
$ pip install .

Dataset Preparation

Given the dataset, please prepare the images paths in a folder named by the dataset with the following folder strcuture.

    flist/dataset_name
        ├── train.flist    # Relative or absolute paths of training images
        ├── valid.flist    # Relative or absolute paths of validation images
        └── test.flist     # Relative or absolute paths of testing images

In this work, we use CelebA-HQ (Download availbale here), Places2 (Download availbale here), ParisStreet View (need author's permission to download)

Testing with Pre-trained Models

  1. Download pre-trained models: Places2 | CelebA-HQ | Paris-StreetView
  2. Put the pre-trained model under the checkpoints folder, e.g.
    checkpoints
        ├── celebahq_wavefill
            ├── latest_net_G.pth 
  1. Modify the bash file and run it.
# To specify dataset, name of pretain model and mask type in the bash file.
bash test_wavelet.sh

Training New Models

Pretrained VGG model Download from here, move it to models/. This model is used to calculate training loss.

New models can be trained with the following commands.

  1. Prepare dataset. Use --dataroot option to locate the directory of file lists, e.g. ./flist, and specify the dataset name to train with --dataset_name option. Identify the types and mask ratio using --mask_type and --pconv_level options.

  2. Train.

# To specify your own dataset or settings in the bash file.
bash train_wavelet.sh

There are many options you can specify. Please use python train_wavelet.py --help. The specified options are printed to the console. To specify the number of GPUs to utilize, use --gpu_ids. If you want to use the second and third GPUs for example, use --gpu_ids 1,2.

Testing

Testing is similar to training new models.

python test_wavelet.py --name [name_of_experiment] --dataset_name [dataset_name] --dataroot [path_to_flist]

Use --results_dir to specify the output directory. --how_many will specify the maximum number of images to generate. By default, it loads the latest checkpoint. It can be changed using --which_epoch.

Citation

If you find this code helpful for your research, please cite our papers.

@inproceedings{yu2021wavefill,
  title={WaveFill: A Wavelet-based Generation Network for Image Inpainting},
  author={Yu, Yingchen and Zhan, Fangneng and Lu, Shijian and Pan, Jianxiong and Ma, Feiying and Xie, Xuansong and Miao, Chunyan},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  year={2021}
}

Acknowledgments

This code borrows heavily from SPADE, CoCosNet, PEN-Net and Edge-Connect, we apprecite the authors for sharing their codes. We also thank Cotter for sharing the pytorch_wavelets code.

wavefill's People

Contributors

yingchen001 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.