Home

Awesome

Spatial Content Alignment GAN (SCA-GAN)

Official implementation of the paper "Spatial Content Alignment For Pose Transfer", ICME 2021(Oral)
Wing-Yin Yu, Lai-Man Po, Yuzhi Zhao, Jingjing Xiong, Kin-Wai Lau. Department of Electrical Engineering, City University of Hong Kong

<img src='image/comparison.png' width=800>

Abstract

Due to unreliable geometric matching and content misalignment, most conventional pose transfer algorithms fail to generate fine-trained person images. In this paper, we propose a novel framework – Spatial Content Alignment GAN (SCA-GAN) which aims to enhance the content consistency of garment textures and the details of human characteristics. We first alleviate the spatial misalignment by transferring the edge content to the target pose in advance. Secondly, we introduce a new Content-Style DeBlk which can progressively synthesize photo-realistic person images based on the appearance features of the source image, the target pose heatmap and the prior transferred content in edge domain. We compare the proposed framework with several state-of-the-art methods to show its superiority in quantitative and qualitative analysis. Moreover, detailed ablation study results demonstrate the efficacy of our contributions.

Getting Started

Our generated images

Our generated images on test set can be downloaded from Google Drive or OneDrive.

Installation

git clone https://github.com/rocketappslab/SCA-GAN.git
cd SCA-GAN
pip install -r requirements.txt

Data Preparation

python tool/generate_pose_map_fashion.py

The dataset structure is recommended as:

+—fashion_data
|   +--train
|       +-- e.g. fashionMENDenimid0000008001_1front.jpg
|   +--test 
|       +-- e.g. fashionMENDenimid0000056501_1front.jpg
|   +--trainK
|       +-- e.g. fashionMENDenimid0000008001_1front.jpg.npy
|   +--testK
|       +-- e.g. fashionMENDenimid0000056501_1front.jpg.npy
|   +--trainE
|       +-- diff
|           +-- e.g. MENDenimid0000008001_1front.png
|   +—fashion-resize-pairs-train.csv
|   +—fashion-resize-pairs-test.csv
|   +—fashion-resize-annotation-pairs-train.csv
|   +—fashion-resize-annotation-pairs-test.csv
|   +—train.lst
|   +—test.lst
|   +—vgg19-dcbb9e9d.pth
|   +—vgg_conv.pth
...

Training

Phase 1 - Prior Content Transfer Network (PCT-Net)

sh scripts/train_pctnet.sh
+—checkpoints
|   +—scagan_pctnet
|       +--latest_netG.pth
...

Phase 2 - Image Synthesis Network (IS-Net)

sh scripts/train_isnet.sh

Testing

sh scripts/test_isnet.sh

The generated imaged are located in result folder.

The file structure is recommended as:

+—checkpoints
|   +—scagan_isnet
|       +--latest_netG.pth
...

Evaluation

We provide a script that can evaluate IS, SSIM, FID and LPIPS metrics.

For evaluation, Tensorflow 1.4.1(python3) is required. Launch
Note: You need to modify the path generated_images_dir = YourImagesPath

python tool/getMetrics_fashion.py

Citation

If you use this code for your research, please cite our paper.

@article{yu2021spatial,
  title={Spatial Content Alignment For Pose Transfer},
  author={Yu, Wing-Yin and Po, Lai-Man and Zhao, Yuzhi and Xiong, Jingjing and Lau, Kin-Wai},
  journal={arXiv preprint arXiv:2103.16828},
  year={2021}
}

Acknowledgments

Our code is based on PATN and ADGAN, thanks for their great work.