- Overview
- Setup Instructions
- Repository Overview
- Reproduction
- Experiments on Places2
- Experiments on COCOA
This repo contains the code for my experiments on AOT-GAN.
- Clone the repo:
git clone https://github.com/praeclarumjj3/AOT-GAN-Experiments.git
cd AOT-GAN-Experiments
- Download the PConv Masks:
wget https://www.dropbox.com/s/qp8cxqttta4zi70/irregular_mask.zip?dl=1 // training dataset
wget https://www.dropbox.com/s/qp8cxqttta4zi70/test_mask.zip?dl=1 // testing dataset
- Download the Places2 dataset:
wget http://data.csail.mit.edu/places/places365/places365standard_easyformat.tar
- 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
- The COCOA dataset has annotations for only
2500 training images
and1300 validation images
. So, if you want to use only those images, run:
python prepare_cocoa_flist.py
- On the other hand, the original COCO2014 dataset has about
83k training images
and40k validation images
. So, if you want to use all images, run:
python prepare_coco_flist.py
- Unzip the files according to the following structure
AOT-GAN-Experiments
├── dataset
│ ├── places2 (rename places365 folder)
│ ├── pconv (rename the folder inside irregular_mask / test_mask)
│ ├── COCOA
│ │ ├── annotations
│ │ ├── train2014
│ │ ├── val2014
│ │ ├── train.txt
│ │ ├── val.txt
- Install Pytorch and other dependencies creating a conda environment:
conda env create -f environment.yml
conda activate inpainting
The repository is structured as follows:
src
- All the source code files.data
- Dataset related scripts.loss
- Scripts for loss functions.model
- Scripts containing the structure of the model.scripts
- Contains shell scripts for running code.utils
- Utility scripts.trainer
: Trainer Class for training the model.
visulaizations
- All kinds of diagrams and plots.
Run the following scripts
sh test.sh
Download the Places2 model.
gdown https://drive.google.com/uc?id=1FgeLfUONic3IP690YhlpGpowXqi_NEAb
Replace the name of the model in test.sh file.
- You can change the cofigurational parameters for training in the
src/utils/option.py
file. - Run the following command to train the AOT-GAN model for
1e4 iterations
:
$ sh scripts/train.sh
If you encounter any errors, install the pretty-errors package to see the beautified errors.
$ python -m pip install pretty_errors
$ python -m pretty_errors
- In the plots below:
- Rec Loss = λ1 Lrec + λ2 Lperceptual + λ3 Lstyle ; λ1 = 1, λ2 = 0.1, λ3 = 250
- Adv G Loss = 0.01 * Lgen_gan
- Adv D Loss = Lgen_disc
The model was trained for 10000 iterations
on a total of 18034 images
with batch size=8
. The checkpoint frequency was 2000 iterations
.
You can find more iteration-wise results in visualizations folder under no_style in pconv_test.
The model was trained for 10000 iterations
on a total of 18034 images
with batch size=8
. The checkpoint frequency was 2000 iterations
.
You can find more iteration-wise results in visualizations folder under style in pconv_test.
The model was trained for 10000 iterations
on a total of 18034 images
with batch size=8
. The checkpoint frequency was 2000 iterations
.
You can find more iteration-wise results in visualizations folder under no_adv in pconv_test.
The model was trained for 40000 iterations
on a total of 18034 images
with batch size=8
. The checkpoint frequency was 2000 iterations
.
You can find more iteration-wise results in visualizations folder under pconv_train.
-
The adversarial loss doesn't seem to be contributing to the learning of the model as it stays almost the same throughout the training.
-
The results don't look realistic from any angle adding weight to the possibility of failure in adversarial training when using train pconv masks dataset. However, if we use the test pconv masks dataset for training, the results are realistic even though adversarial losses don't contribute much to the learning.
-
Training is beneficial only using the
testing pconv masks dataset
. -
Training for longer than
1e4
iterations doesn't add much improvement to the results. -
Training without style loss produces blurry results. Therefore, style loss is an important component for texture related synthesis of images.
-
Training without adversarial loss also produces good quality results!
- In the plots below:
- Rec Loss = λ1 Lrec + λ2 Lperceptual; λ1 = 1, λ2 = 0.1
- Adv G Loss = 0.01 * Lgen_gan
- Adv D Loss = Lgen_disc
The model was trained for 10000 iterations
on a total of 18034 images
with batch size=8
. The checkpoint frequency was 2000 iterations
.
You can find more iteration-wise results in visualizations folder under smpatchGAN in coco.
The model was trained for 10000 iterations
on a total of 18034 images
with batch size=8
. The checkpoint frequency was 2000 iterations
.
You can find more iteration-wise results in visualizations folder under patchGAN in coco.
Code is based on the official AOT-GAN Repo.