Need help with instagan?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

764 Stars 156 Forks Other 320 Commits 5 Opened issues


InstaGAN: Instance-aware Image Translation (ICLR 2019)

Services available


Need anything else?

Contributors list

InstaGAN: Instance-aware Image-to-Image Translation

PyTorch implementation of "InstaGAN: Instance-aware Image-to-Image Translation" (ICLR 2019). The implementation is based on the official CycleGAN code. Our major contributions are in


Getting Started


  • Clone this repository

    git clone
  • Install PyTorch 0.4+ and torchvision from and other dependencies (e.g., visdom and dominate). You can install all the dependencies by

    pip install -r requirements.txt
  • For Conda users, you can use a script

    to install PyTorch and other libraries.
  • Acknowledgment: Installation scripts are from the official CycleGAN code.

Download base datasets

  • Download clothing-co-parsing (CCP) dataset:

    git clone ./datasets/clothing-co-parsing
  • Download multi-human parsing (MHP) dataset: ```

    Download "LV-MHP-v1" from the link and locate in ./datasets

  • Download MS COCO dataset:


Generate two-domain datasets

  • Generate two-domain dataset for experiments:
    python ./datasets/ --save_root ./datasets/jeans2skirt_ccp --cat1 jeans --cat2 skirt
    python ./datasets/ --save_root ./datasets/pants2skirt_mhp --cat1 pants --cat2 skirt
    python ./datasets/ --save_root ./datasets/shp2gir_coco --cat1 sheep --cat2 giraffe
  • Note: Generated dataset contains images and corresponding masks, which are located in image folders (e.g., 'trainA') and mask folders (e.g., 'trainAseg'), respectively. For each image (e.g., '0001.png'), corresponding masks for each instance (e.g., '00010.png', '0001_1.png', ...) are provided.

Run experiments

  • Train a model:

    python --dataroot ./datasets/jeans2skirt_ccp --model insta_gan --name jeans2skirt_ccp_instagan --loadSizeH 330 --loadSizeW 220 --fineSizeH 300 --fineSizeW 200 --niter 400 --niter_decay 200
    python --dataroot ./datasets/pants2skirt_mhp --model insta_gan --name pants2skirt_mhp_instagan --loadSizeH 270 --loadSizeW 180 --fineSizeH 240 --fineSizeW 160
    python --dataroot ./datasets/shp2gir_coco --model insta_gan --name shp2gir_coco_instagan --loadSizeH 220 --loadSizeW 220 --fineSizeH 200 --fineSizeW 200
  • To view training results and loss plots, run

    python -m visdom.server
    and click the URL http://localhost:8097. To see more intermediate results, check out
  • For faster experiment, increase batch size and use more gpus:

    python --dataroot ./datasets/shp2gir_coco --model insta_gan --name shp2gir_coco_instagan --loadSizeH 220 --loadSizeW 220 --fineSizeH 200 --fineSizeW 200 --batch_size 4 --gpu_ids 0,1,2,3
  • Test the model:

    python --dataroot ./datasets/jeans2skirt_ccp --model insta_gan --name jeans2skirt_ccp_instagan --loadSizeH 300 --loadSizeW 200 --fineSizeH 300 --fineSizeW 200
    python --dataroot ./datasets/pants2skirt_mhp --model insta_gan --name pants2skirt_mhp_instagan --loadSizeH 240 --loadSizeW 160 --fineSizeH 240 --fineSizeW 160 --ins_per 2 --ins_max 20
    python --dataroot ./datasets/shp2gir_coco --model insta_gan --name shp2gir_coco_instagan --loadSizeH 200 --loadSizeW 200 --fineSizeH 200 --fineSizeW 200 --ins_per 2 --ins_max 20
  • The test results will be saved to a html file here:


Apply a pre-trained model

  • You can download a pre-trained model (pants->skirt and/or sheep->giraffe) from the following Google drive link. Save the pretrained model in

  • We provide samples of two datasets (pants->skirt and sheep->giraffe) in this repository. To test the model:

    python --dataroot ./datasets/pants2skirt_mhp --model insta_gan --name pants2skirt_mhp_instagan --loadSizeH 240 --loadSizeW 160 --fineSizeH 240 --fineSizeW 160 --ins_per 2 --ins_max 20 --phase sample --epoch 200
    python --dataroot ./datasets/shp2gir_coco --model insta_gan --name shp2gir_coco_instagan --loadSizeH 200 --loadSizeW 200 --fineSizeH 200 --fineSizeW 200 --ins_per 2 --ins_max 20 --phase sample --epoch 200


We provide some translation results of our model. See the link for more translation results.

1. Fashion dataset (pants->skirt)

2. COCO dataset (sheep->giraffe)

3. Results on Google-searched images (pants->skirt)

4. Results on YouTube-searched videos (pants->skirt)


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

    title={InstaGAN: Instance-aware Image-to-Image Translation},
    author={Sangwoo Mo and Minsu Cho and Jinwoo Shin},
    booktitle={International Conference on Learning Representations},

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.