Home

Awesome

SPatchGAN: Official TensorFlow Implementation

Paper

"SPatchGAN: A Statistical Feature Based Discriminator for Unsupervised Image-to-Image Translation" (ICCV 2021)

<img src='https://img.shields.io/badge/arXiv-2103.16219-blue'> <img src='https://img.shields.io/badge/video-5min-red'> <img src='https://img.shields.io/badge/poster-ICCV-black'>

<img src='./images/s2a_cmp_github_downsized.jpg' align="center" width=1060>

<br><br>

<img src='./images/SPatchGAN_D_20210317_3x.jpg' align="center" width=612>

Web Demos

<a href="https://replicate.ai/netease-gameai/spatchgan-selfie2anime"><img src="https://img.shields.io/static/v1?label=Replicate&message=Demo and Docker Image&color=blue"></a> by CJWBW

Environment

Dataset

- dataset
    - <dataset_name>
        - trainA
            - 1.jpg
            - 2.jpg
            - ...
        - trainB
            - 3.jpg
            - 4.jpg
            - ...
        - testA
            - 5.jpg
            - 6.jpg
            - ...
        - testB
            - 7.jpg
            - 8.jpg
            - ...
- trainA
    - subdir1
        - 1.jpg
        - 2.jpg
        - ...
    - subdir2
        - ...

Training

python main.py --dataset selfie2anime --augment_type resize_crop --n_scales_dis 3 --suffix scale3_cyc20_20210831 --phase train
python main.py --dataset male2female --cyc_weight 10 --suffix cyc10_20210831 --phase train
python main.py --dataset glasses-male --cyc_weight 30 --suffix cyc30_20210831 --phase train

Testing with the latest checkpoint

Save a frozen model (.pb)

Testing with the frozon model

cd frozen_model
python test_frozen_model.py --image <input_image_or_dir> --output_dir <output_dir> --model <frozen_model_path>

Pretrained Models

Other Implementations

Citation

@InProceedings{Shao_2021_ICCV,
    author    = {Shao, Xuning and Zhang, Weidong},
    title     = {SPatchGAN: A Statistical Feature Based Discriminator for Unsupervised Image-to-Image Translation},
    booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
    month     = {October},
    year      = {2021},
    pages     = {6546-6555}
}

Acknowledgement