Git Product home page Git Product logo

ctsdg's Introduction

CTSDG

Image Inpainting via Conditional Texture and Structure Dual Generation

Xiefan Guo, Hongyu Yang, Di Huang
In ICCV'2021

Introduction

Generator. Image inpainting is cast into two subtasks, i.e., structure-constrained texture synthesis (left, blue) and texture-guided structure reconstruction (right, red), and the two parallel-coupled streams borrow encoded deep features from each other. The Bi-GFF module and CFA module are stacked at the end of the generator to further refine the results.

Discriminator. The texture branch estimates the generated texture, while the structure branch guides structure reconstruction.

Prerequisites

  • Python >= 3.6
  • PyTorch >= 1.0
  • NVIDIA GPU + CUDA cuDNN

Getting Started

Installation

  • Clone this repo:
git clone https://github.com/Xiefan-Guo/CTSDG.git
cd CTSDG
pip install -r requirements.txt

Datasets

Image Dataset. We evaluate the proposed method on the CelebA, Paris StreetView, and Places2 datasets, which are widely adopted in the literature.

Mask Dataset. Irregular masks are obtained from Irregular Masks and classified based on their hole sizes relative to the entire image with an increment of 10%.

Training

Analogous to PConv by Liu et.al, initial training followed by finetuning are performed.

python train.py \
  --image_root [path to image directory] \
  --mask_root [path mask directory]

python train.py \
  --image_root [path to image directory] \
  --mask_root [path to mask directory] \
  --pre_trained [path to checkpoints] \
  --finetune True

Distributed training support. You can train model in distributed settings.

python -m torch.distributed.launch --nproc_per_node=N_GPU train.py

Testing

To test the model, you run the following code.

python test.py \
  --pre_trained [path to checkpoints] \
  --image_root [path to image directory] \
  --mask_root [path to mask directory] \
  --result_root [path to output directory] \
  --number_eval [number of images to test]

Citation

If any part of our paper and repository is helpful to your work, please generously cite with:

@InProceedings{Guo_2021_ICCV,
    author    = {Guo, Xiefan and Yang, Hongyu and Huang, Di},
    title     = {Image Inpainting via Conditional Texture and Structure Dual Generation},
    booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
    month     = {October},
    year      = {2021},
    pages     = {14134-14143}
}

ctsdg's People

Contributors

xiefan-guo 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.