This repo contains the code for my experiments on content completion using the PCNet-C model proposed in Self-Supervised Scene De-occlusion.
- Clone the repo:
https://github.com/praeclarumjj3/PCNet-C-Experiments.git
cd PCNet-C-Experiments
- Install Pytorch and other dependencies:
pip3 install -r requirements.txt
- Install pycocotools:
pip3 install "git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI"
- Download the MS-COCO 2014 images and unzip:
wget http://images.cocodataset.org/zips/train2014.zip
wget http://images.cocodataset.org/zips/val2014.zip
- Download the annotations and untar:
gdown https://drive.google.com/uc?id=0B8e3LNo7STslZURoTzhhMFpCelE
tar -xf annotations.tar.gz
- Unzip the files according to the following structure
PCNet-C-Experiments
├── data
│ ├── COCOA
│ │ ├── annotations
│ │ ├── train2014
│ │ ├── val2014
-
Download the pre-trained image inpainting model using partial convolution here to
pretrains/partialconv.pth
-
Convert the model to accept 4 channel inputs.
python tools/convert_pcnetc_pretrain.py
-
Train (taking COCOA for example).
sh experiments/train.sh # you may have to set --nproc_per_node=#YOUR_GPUS
- In the plots below:
- Rec Loss = λ1 Lhole + λ2 Lvalid + λ3 Lsty + λ4 Lprc + λ5 Ltv
λ<sub>1</sub> = 6.0; λ<sub>2</sub> = 1.0; λ<sub>3</sub> = 250.0; λ<sub>4</sub> = 0.1; λ<sub>5</sub> = 0.1;
- Adv G Loss = 0.1 * Lgen_gan
- Adv D Loss = Lgen_disc
- Rec Loss = λ1 Lhole + λ2 Lvalid + λ3 Lsty + λ4 Lprc + λ5 Ltv
The model was trained for 45000 iterations
.
Run the following command:
sh experiments/demo.sh
- Download released model from here, rename it to G_iter_0.pth.tar and put it the folder
saved_checkpoints
underexperiments
.
gdown https://drive.google.com/uc?id=1MFK3mvSsB_T6IhmunPHi0EUWnDv-nDTa
- Set the
--load_iter
parameter equal to0
in demo.sh.
This repo borrows heavily from deocclusion.