PyTorch implementation of InstaGAN: Instance-aware Image-to-Image Translation

Overview

InstaGAN: Instance-aware Image-to-Image Translation

Warning: This repo contains a model which has potential ethical concerns. Remark that the task of jeans<->skirt was a bad application and should not be used in future research. See the twitter thread for the discussion.


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 ./models/insta_gan_model.py and ./models/networks.py.

Getting Started

Installation

  • Clone this repository
git clone https://github.com/sangwoomo/instagan
pip install -r requirements.txt
  • For Conda users, you can use a script ./scripts/conda_deps.sh to install PyTorch and other libraries.

  • Acknowledgment: Installation scripts are from the official CycleGAN code.

Download base datasets

git clone https://github.com/bearpaw/clothing-co-parsing ./datasets/clothing-co-parsing
# Download "LV-MHP-v1" from the link and locate in ./datasets
./datasets/download_coco.sh

Generate two-domain datasets

  • Generate two-domain dataset for experiments:
python ./datasets/generate_ccp_dataset.py --save_root ./datasets/jeans2skirt_ccp --cat1 jeans --cat2 skirt
python ./datasets/generate_mhp_dataset.py --save_root ./datasets/pants2skirt_mhp --cat1 pants --cat2 skirt
python ./datasets/generate_coco_dataset.py --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., 'trainA_seg'), respectively. For each image (e.g., '0001.png'), corresponding masks for each instance (e.g., '0001_0.png', '0001_1.png', ...) are provided.

Run experiments

  • Train a model:
python train.py --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 train.py --dataroot ./datasets/pants2skirt_mhp --model insta_gan --name pants2skirt_mhp_instagan --loadSizeH 270 --loadSizeW 180 --fineSizeH 240 --fineSizeW 160
python train.py --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 ./checkpoints/experiment_name/web/index.html.

  • For faster experiment, increase batch size and use more gpus:

python train.py --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 test.py --dataroot ./datasets/jeans2skirt_ccp --model insta_gan --name jeans2skirt_ccp_instagan --loadSizeH 300 --loadSizeW 200 --fineSizeH 300 --fineSizeW 200
python test.py --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 test.py --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: ./results/experiment_name/latest_test/index.html.

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 ./checkpoints/ directory.

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

python test.py --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 test.py --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

Results

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)

Citation

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

@inproceedings{
    mo2019instagan,
    title={InstaGAN: Instance-aware Image-to-Image Translation},
    author={Sangwoo Mo and Minsu Cho and Jinwoo Shin},
    booktitle={International Conference on Learning Representations},
    year={2019},
    url={https://openreview.net/forum?id=ryxwJhC9YX},
}
Comments
  • hi, I did an experiments on hair style transfer, but it seem don't work.

    hi, I did an experiments on hair style transfer, but it seem don't work.

    i did an experiments on hair style transfer, stright hair to curl hair. but the fake seg B seems to be all zeros, so it don't work to transfer hair style . could you please tell me instagan is able to work on the experiment, and maybe what is wrong about the experiment

    thanks a lot !!

    opened by leonardodora 11
  • How did you train your instagan model?

    How did you train your instagan model?

    I trained the pix2pix model to predict the pants mask and the skirts mask, and the result of pix2pxi model were satisfied, then I trained the instagan model, but the result seems bad. So how did you train your instagan model? Have you combined the skirts and skin mask together, and train the instagan to learn to transfer pants to skirts and the skin of legs?

    opened by hjwang-824 11
  • AttributeError: 'Namespace' object has no attribute 'loadSize'

    AttributeError: 'Namespace' object has no attribute 'loadSize'

    Hi, I want to train a pix2pix model, and run: python train.py --dataroot ./datasets/photos2pants_ccp --name photos2pants_ccp_pix2pix --model pix2pix

    but the result: ----------------- Options --------------- batch_size: 1 beta1: 0.5 checkpoints_dir: ./checkpoints continue_train: False dataroot: ./datasets/photos2pants_ccp [default: None] dataset_mode: aligned direction: AtoB display_env: main display_freq: 400 display_id: 1 display_ncols: 6 display_port: 8097 display_server: http://localhost display_winsize: 256 epoch: latest epoch_count: 1 fineSizeH: 200 fineSizeW: 200 gpu_ids: 0 init_gain: 0.02 init_type: normal input_nc: 3 isTrain: True [default: None] lambda_L1: 100.0 loadSizeH: 220 loadSizeW: 220 load_iter: 0 [default: 0] lr: 0.0002 lr_decay_iters: 50 lr_policy: lambda max_dataset_size: inf model: pix2pix [default: insta_gan] n_layers_D: 3 name: photos2pants_ccp_pix2pix [default: experiment_name] ndf: 64 netD: set netG: unet_256 ngf: 64 niter: 100 niter_decay: 100 no_dropout: False no_flip: False no_html: False no_lsgan: True norm: batch num_threads: 4 output_nc: 3 phase: train pool_size: 0 print_freq: 100 resize_or_crop: resize_and_crop save_by_iter: False save_epoch_freq: 5 save_latest_freq: 5000 serial_batches: False suffix: update_html_freq: 1000 verbose: False ----------------- End ------------------- dataset [AlignedDataset] was created #training images = 604 initialize network with normal initialize network with normal model [Pix2PixModel] was created ---------- Networks initialized ------------- [Network G] Total number of parameters : 54.414 M [Network D] Total number of parameters : 9.760 M

    WARNING:root:Setting up a new session... create web directory ./checkpoints\photos2pants_ccp_pix2pix\web... Traceback (most recent call last): File "train.py", line 24, in for i, data in enumerate(dataset): File "D:\MINE\STUDY in SYSU\SmartLLV\Papers\instagan-master\data_init_.py", line 72, in iter for i, data in enumerate(self.dataloader): File "D:\devcool\Anaconda2\envs\python36\lib\site-packages\torch\utils\data\dataloader.py", line 286, in next return self._process_next_batch(batch) File "D:\devcool\Anaconda2\envs\python36\lib\site-packages\torch\utils\data\dataloader.py", line 307, in _process_next_batch raise batch.exc_type(batch.exc_msg) AttributeError: Traceback (most recent call last): File "D:\devcool\Anaconda2\envs\python36\lib\site-packages\torch\utils\data\dataloader.py", line 57, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "D:\devcool\Anaconda2\envs\python36\lib\site-packages\torch\utils\data\dataloader.py", line 57, in samples = collate_fn([dataset[i] for i in batch_indices]) File "D:\MINE\STUDY in SYSU\SmartLLV\Papers\instagan-master\data\aligned_dataset.py", line 26, in getitem assert(self.opt.loadSize >= self.opt.fineSize) AttributeError: 'Namespace' object has no attribute 'loadSize'

    opened by hjwang-824 9
  • list index out of range

    list index out of range

    error2

    I am just training my dataset with this instagan model. my training dataset has 14221 images and at the first trial, it has error as show in figure when iter value is 4200. Second trial, now it stopped when iter value is 8900. It has increased a lot than the first trial. I am just adding my dataset folder under the directory /instagan/datasets.

    opened by phyuphyuthaw 9
  • RuntimeError: output with shape [1, 300, 200] doesn't match the broadcast shape [3, 300, 200]

    RuntimeError: output with shape [1, 300, 200] doesn't match the broadcast shape [3, 300, 200]

    Hello, I'm following the instruction but faced the error while training. I ran the script on Macbook Pro. Do you have any idea to fix this issue?

    $ python train.py --dataroot ./datasets/jeans2skirt_ccp --model insta_gan --name jeans2skirt_ccp_instagan --loadSizeH 330 --loadSizeW 220 --fineSizeH 300 --fineSizeW 200 --niter 400 --niter_decay 200 --gpu_ids -1
    ----------------- Options ---------------
                   batch_size: 1                             
                        beta1: 0.5                           
              checkpoints_dir: ./checkpoints                 
               continue_train: False                         
                     dataroot: ./datasets/jeans2skirt_ccp    	[default: None]
                 dataset_mode: unaligned_seg                 
                    direction: AtoB                          
                  display_env: main                          
                 display_freq: 400                           
                   display_id: 1                             
                display_ncols: 6                             
                 display_port: 8097                          
               display_server: http://localhost              
              display_winsize: 256                           
                        epoch: latest                        
                  epoch_count: 1                             
                    fineSizeH: 300                           	[default: 200]
                    fineSizeW: 200                           
                      gpu_ids: -1                            	[default: 0]
                    init_gain: 0.02                          
                    init_type: normal                        
                     input_nc: 3                             
                      ins_max: 4                             
                      ins_per: 2                             
                      isTrain: True                          	[default: None]
                     lambda_A: 10.0                          
                     lambda_B: 10.0                          
                   lambda_ctx: 1.0                           
                   lambda_idt: 1.0                           
                    loadSizeH: 330                           	[default: 220]
                    loadSizeW: 220                           
                    load_iter: 0                             	[default: 0]
                           lr: 0.0002                        
               lr_decay_iters: 50                            
                    lr_policy: lambda                        
             max_dataset_size: inf                           
                        model: insta_gan                     
                   n_layers_D: 3                             
                         name: jeans2skirt_ccp_instagan      	[default: experiment_name]
                          ndf: 64                            
                         netD: set                           
                         netG: set                           
                          ngf: 64                            
                        niter: 400                           	[default: 100]
                  niter_decay: 200                           	[default: 100]
                   no_dropout: True                          
                      no_flip: False                         
                      no_html: False                         
                     no_lsgan: False                         
                         norm: instance                      
                  num_threads: 4                             
                    output_nc: 3                             
                        phase: train                         
                    pool_size: 50                            
                   print_freq: 100                           
               resize_or_crop: resize_and_crop               
                 save_by_iter: False                         
              save_epoch_freq: 5                             
             save_latest_freq: 5000                          
               serial_batches: False                         
                    set_order: decreasing                    
                       suffix:                               
             update_html_freq: 1000                          
                      verbose: False                         
    ----------------- End -------------------
    dataset [UnalignedSegDataset] was created
    #training images = 167
    initialize network with normal
    initialize network with normal
    initialize network with normal
    initialize network with normal
    model [InstaGANModel] was created
    ---------- Networks initialized -------------
    [Network G_A] Total number of parameters : 26.815 M
    [Network G_B] Total number of parameters : 26.815 M
    [Network D_A] Total number of parameters : 9.754 M
    [Network D_B] Total number of parameters : 9.754 M
    -----------------------------------------------
    Setting up a new session...
    create web directory ./checkpoints/jeans2skirt_ccp_instagan/web...
    Traceback (most recent call last):
      File "train.py", line 24, in <module>
        for i, data in enumerate(dataset):
      File "/Users/tomo/Documents/GitHub/instagan/data/__init__.py", line 72, in __iter__
        for i, data in enumerate(self.dataloader):
      File "/Users/tomo/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 819, in __next__
        return self._process_data(data)
      File "/Users/tomo/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data
        data.reraise()
      File "/Users/tomo/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torch/_utils.py", line 385, in reraise
        raise self.exc_type(msg)
    RuntimeError: Caught RuntimeError in DataLoader worker process 0.
    Original Traceback (most recent call last):
      File "/Users/tomo/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
        data = fetcher.fetch(index)
      File "/Users/tomo/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
        data = [self.dataset[idx] for idx in possibly_batched_index]
      File "/Users/tomo/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
        data = [self.dataset[idx] for idx in possibly_batched_index]
      File "/Users/tomo/Documents/GitHub/instagan/data/unaligned_seg_dataset.py", line 71, in __getitem__
        A_segs = self.read_segs(A_seg_path, seed)
      File "/Users/tomo/Documents/GitHub/instagan/data/unaligned_seg_dataset.py", line 42, in read_segs
        seg = self.fixed_transform(seg, seed)
      File "/Users/tomo/Documents/GitHub/instagan/data/unaligned_seg_dataset.py", line 34, in fixed_transform
        return self.transform(image)
      File "/Users/tomo/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torchvision/transforms/transforms.py", line 61, in __call__
        img = t(img)
      File "/Users/tomo/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torchvision/transforms/transforms.py", line 166, in __call__
        return F.normalize(tensor, self.mean, self.std, self.inplace)
      File "/Users/tomo/.pyenv/versions/3.7.4/lib/python3.7/site-packages/torchvision/transforms/functional.py", line 217, in normalize
        tensor.sub_(mean[:, None, None]).div_(std[:, None, None])
    RuntimeError: output with shape [1, 300, 200] doesn't match the broadcast shape [3, 300, 200]
    
    

    I tried the other one, pants2skirt_mhp_instagan but almost same result. RuntimeError: output with shape [1, 240, 160] doesn't match the broadcast shape [3, 240, 160] I'm sorry if this is not the right place to ask. Thanks in advance.

    opened by tomostar7 7
  • RuntimeError: The expanded size of the tensor (1) must match the existing size (3) at non-singleton dimension 0

    RuntimeError: The expanded size of the tensor (1) must match the existing size (3) at non-singleton dimension 0

    Hi!I use your pre-trained model and follow the README.md,here follows the output: ---------- Networks initialized ------------- [Network G_A] Total number of parameters : 26.815 M [Network G_B] Total number of parameters : 26.815 M

    Traceback (most recent call last): File "test.py", line 29, in for i, data in enumerate(dataset): File "D:\MINE\Papers\instagan-master\data_init_.py", line 72, in iter for i, data in enumerate(self.dataloader): File "D:\devcool\Anaconda2\envs\python36\lib\site-packages\torch\utils\data\dataloader.py", line 286, in next return self._process_next_batch(batch) File "D:\devcool\Anaconda2\envs\python36\lib\site-packages\torch\utils\data\dataloader.py", line 307, in process_next_batch raise batch.exc_type(batch.exc_msg) RuntimeError: Traceback (most recent call last): File "D:\devcool\Anaconda2\envs\python36\lib\site-packages\torch\utils\data\dataloader.py", line 57, in worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "D:\devcool\Anaconda2\envs\python36\lib\site-packages\torch\utils\data\dataloader.py", line 57, in samples = collate_fn([dataset[i] for i in batch_indices]) File "D:\MINE\STUDY in SYSU\SmartLLV\Papers\instagan-master\data\unaligned_seg_dataset.py", line 71, in getitem A_segs = self.read_segs(A_seg_path, seed) File "D:\MINE\STUDY in SYSU\SmartLLV\Papers\instagan-master\data\unaligned_seg_dataset.py", line 42, in read_segs seg = self.fixed_transform(seg, seed) File "D:\MINE\STUDY in SYSU\SmartLLV\Papers\instagan-master\data\unaligned_seg_dataset.py", line 34, in fixed_transform return self.transform(image) File "D:\devcool\Anaconda2\envs\python36\lib\site-packages\torchvision\transforms\transforms.py", line 60, in call img = t(img) File "D:\devcool\Anaconda2\envs\python36\lib\site-packages\torchvision\transforms\transforms.py", line 163, in call return F.normalize(tensor, self.mean, self.std, self.inplace) File "D:\devcool\Anaconda2\envs\python36\lib\site-packages\torchvision\transforms\functional.py", line 208, in normalize tensor.sub(mean[:, None, None]).div(std[:, None, None]) RuntimeError: The expanded size of the tensor (1) must match the existing size (3) at non-singleton dimension 0

    opened by hjwang-824 7
  • Instagan in Google Colab

    Instagan in Google Colab

    Hi! Is it possible to run Instagan in Google Colab? I've got a problem of running visdom server in colab. Seems that it's not allowed by Google. What is a possible solution? Much thanks in advance!

    opened by muxgt 5
  •  clothing-co-parsing do not generate seg label for test/val dataset?

    clothing-co-parsing do not generate seg label for test/val dataset?

    Hi,I find MHP and COCO generate seg label for test/val dataset, but CPP have not. generate_ccp_dataset_val() in generate_ccp_dataset.py do not save seg label. Why is that? Who to test the model "python test.py --dataroot ./datasets/jeans2skirt_ccp --model insta_gan --name jeans2skirt_ccp_instagan --loadSizeH 300 --loadSizeW 200 --fineSizeH 300 --fineSizeW 200"?

    opened by chaipangpang 5
  • Crashing on

    Crashing on "WARNING:root:Setting up a new session" while trying to train on custom dataset

    Hi, Any help would be appreciated. This error also is happening when i run on the jeans2skirt_ccp dataset.

    WARNING:root:Setting up a new session... create web directory ./checkpoints/deep_nude_results/web... Traceback (most recent call last): File "train.py", line 24, in for i, data in enumerate(dataset): File "/Users/WillMReynolds/Desktop/GAN_STUDY/instaGAN/data/init.py", line 72, in iter for i, data in enumerate(self.dataloader): File "/Users/WillMReynolds/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 582, in next return self._process_next_batch(batch) File "/Users/WillMReynolds/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch raise batch.exc_type(batch.exc_msg) RuntimeError: Traceback (most recent call last): File "/Users/WillMReynolds/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/torch/utils/data/_utils/worker.py", line 99, in worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/Users/WillMReynolds/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/torch/utils/data/utils/worker.py", line 99, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/Users/WillMReynolds/Desktop/GAN_STUDY/instaGAN/data/unaligned_seg_dataset.py", line 71, in getitem A_segs = self.read_segs(A_seg_path, seed) File "/Users/WillMReynolds/Desktop/GAN_STUDY/instaGAN/data/unaligned_seg_dataset.py", line 42, in read_segs seg = self.fixed_transform(seg, seed) File "/Users/WillMReynolds/Desktop/GAN_STUDY/instaGAN/data/unaligned_seg_dataset.py", line 34, in fixed_transform return self.transform(image) File "/Users/WillMReynolds/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/torchvision/transforms/transforms.py", line 61, in call img = t(img) File "/Users/WillMReynolds/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/torchvision/transforms/transforms.py", line 164, in call return F.normalize(tensor, self.mean, self.std, self.inplace) File "/Users/WillMReynolds/anaconda3/envs/tfdeeplearning/lib/python3.5/site-packages/torchvision/transforms/functional.py", line 208, in normalize tensor.sub(mean[:, None, None]).div(std[:, None, None]) RuntimeError: output with shape [1, 240, 160] doesn't match the broadcast shape [3, 240, 160]

    opened by WillReynolds5 3
  • Incorrect image channels for segmentation?

    Incorrect image channels for segmentation?

    Hi, I'm getting this runtime error during training on line 71 of unaligned_seg_dataset.py

    RuntimeError: output with shape [1, 200, 200] doesn't match the broadcast shape [3, 200, 200]

    It looks like there is a transform being applied to the segmentation mask that doesn't match the correct dimensions. Segmentation masks are 8-bit 1 channel gray image, while training images are 24-bit 3 channel RGB.

    opened by Sean-S-Wang 2
  • How to interpret the context preserving loss?

    How to interpret the context preserving loss?

    Hello, I really appreciate the awesome instaGAN you guys put forward. However, when I read your paper, I found something confusing about the losses: the L_cyc and L_idt cannot prevent the G to make shortcuts like learning a identity mapping(x==y', y==x'), so you use L_ctx to prevent this shortcut. But if G still learn the identity mapping, it does not hurt L_ctx and it will still be zero.

    opened by wtupc96 2
  • Calculation of masked classification score

    Calculation of masked classification score

    I'm not able to understand how the masked classification score is computed. In the paper it says input images are masked by the corresponding segmentations. How can the images be classified if they are masked? Can anyone help me understand this? Thanks in advance!

    opened by pmgautam 0
  • my own groundtruth images

    my own groundtruth images

    Hello!, thanks for your wonderful code, and I have a question about my own images ,how can I get the groundtruth images of my own original images ,can you give me some tool of the url or some advise,Thanks a lot!!!

    opened by XuJ1E 0
  • What happened to the (pear2orange) generated image without deformation

    What happened to the (pear2orange) generated image without deformation

    Hello! I now want to convert pears into oranges. But after training, it was found that the images produced only a few color shifts, and the color and shape of the fruit did not change. Does anyone know what this is about? Thank you!

    opened by 71256501liu 0
  • While testing also the bnary masks are needed for bothe the domains?

    While testing also the bnary masks are needed for bothe the domains?

    After going through the paper and implementation, I realized that while testing on random images too we need to input the binary masks for both the domains?

    Then can someone explain to me then what is the whole point of this research work?

    If binary masks are needed all the time, then I can use a conventional technique like Alpha Blending or Cloning and get the job done with limited resources .

    Huh !!

    opened by ManuBN786 0
  • AttributeError: InstaGANModel instance has no attribute 'fake_B_img_sng'

    AttributeError: InstaGANModel instance has no attribute 'fake_B_img_sng'

    Hello,

    I am trying to train on the jean2skirt dataset and after the following train command: python train.py --dataroot ./datasets/jeans2skirt_ccp --model insta_gan --name jeans2skirt_ccp_instagan --loadSizeH 330 --loadSizeW 220 --fineSizeH 30 --fineSizeW 20 --gpu_ids -1

    I get the following error:

    ----------------- Options ---------------
                   batch_size: 1                             
                        beta1: 0.5                           
              checkpoints_dir: ./checkpoints                 
               continue_train: False                         
                     dataroot: ./datasets/jeans2skirt_ccp    	[default: None]
                 dataset_mode: unaligned_seg                 
                    direction: AtoB                          
                  display_env: main                          
                 display_freq: 400                           
                   display_id: 1                             
                display_ncols: 6                             
                 display_port: 8097                          
               display_server: http://localhost              
              display_winsize: 256                           
                        epoch: latest                        
                  epoch_count: 1                             
                    fineSizeH: 30                            	[default: 20]
                    fineSizeW: 20                            	[default: 32]
                      gpu_ids: -1                            	[default: 0]
                    init_gain: 0.02                          
                    init_type: normal                        
                     input_nc: 3                             
                      ins_max: 4                             
                      ins_per: 2                             
                      isTrain: True                          	[default: None]
                     lambda_A: 10.0                          
                     lambda_B: 10.0                          
                   lambda_ctx: 1.0                           
                   lambda_idt: 1.0                           
                    loadSizeH: 330                           	[default: 100]
                    loadSizeW: 220                           	[default: 100]
                    load_iter: 0                             	[default: 0]
                           lr: 0.0002                        
               lr_decay_iters: 50                            
                    lr_policy: lambda                        
             max_dataset_size: inf                           
                        model: insta_gan                     
                   n_layers_D: 3                             
                         name: jeans2skirt_ccp_instagan      	[default: experiment_name]
                          ndf: 64                            
                         netD: set                           
                         netG: set                           
                          ngf: 64                            
                        niter: 100                           
                  niter_decay: 100                           
                   no_dropout: True                          
                      no_flip: False                         
                      no_html: False                         
                     no_lsgan: False                         
                         norm: instance                      
                  num_threads: 4                             
                    output_nc: 3                             
                        phase: train                         
                    pool_size: 50                            
                   print_freq: 100                           
               resize_or_crop: resize_and_crop               
                 save_by_iter: False                         
              save_epoch_freq: 5                             
             save_latest_freq: 5000                          
               serial_batches: False                         
                    set_order: decreasing                    
                       suffix:                               
             update_html_freq: 1000                          
                      verbose: False                         
    ----------------- End -------------------
    dataset [UnalignedSegDataset] was created
    #training images = 167
    initialize network with normal
    initialize network with normal
    initialize network with normal
    initialize network with normal
    model [InstaGANModel] was created
    ---------- Networks initialized -------------
    [Network G_A] Total number of parameters : 26.815 M
    [Network G_B] Total number of parameters : 26.815 M
    [Network D_A] Total number of parameters : 9.754 M
    [Network D_B] Total number of parameters : 9.754 M
    -----------------------------------------------
    create web directory ./checkpoints/jeans2skirt_ccp_instagan/web...
    Traceback (most recent call last):
      File "train.py", line 32, in <module>
        model.optimize_parameters()
      File "/home/ysn/instagan/models/insta_gan_model.py", line 295, in optimize_parameters
        self.real_A_img_sng = self.fake_B_img_sng.detach()
    AttributeError: InstaGANModel instance has no attribute 'fake_B_img_sng'
    
    

    If I increase the fineSize, I get a CUDA memory error. Any help would be welcome.

    Thank you

    opened by YShoun 0
Owner
Sangwoo Mo
Ph.D. Student in Machine Learning
Sangwoo Mo
[ArXiv 2021] Data-Efficient Instance Generation from Instance Discrimination

InsGen - Data-Efficient Instance Generation from Instance Discrimination Data-Efficient Instance Generation from Instance Discrimination Ceyuan Yang,

GenForce: May Generative Force Be with You 93 Dec 25, 2022
Code of Adverse Weather Image Translation with Asymmetric and Uncertainty aware GAN

Adverse Weather Image Translation with Asymmetric and Uncertainty-aware GAN (AU-GAN) Official Tensorflow implementation of Adverse Weather Image Trans

Jeong-gi Kwak 36 Dec 26, 2022
Deep Occlusion-Aware Instance Segmentation with Overlapping BiLayers [CVPR 2021]

Deep Occlusion-Aware Instance Segmentation with Overlapping BiLayers [BCNet, CVPR 2021] This is the official pytorch implementation of BCNet built on

Lei Ke 434 Dec 1, 2022
Based on the paper "Geometry-aware Instance-reweighted Adversarial Training" ICLR 2021 oral

Geometry-aware Instance-reweighted Adversarial Training This repository provides codes for Geometry-aware Instance-reweighted Adversarial Training (ht

Jingfeng 47 Dec 22, 2022
Disentangled Face Attribute Editing via Instance-Aware Latent Space Search, accepted by IJCAI 2021.

Instance-Aware Latent-Space Search This is a PyTorch implementation of the following paper: Disentangled Face Attribute Editing via Instance-Aware Lat

null 67 Dec 21, 2022
Official pytorch implementation of paper "Image-to-image Translation via Hierarchical Style Disentanglement".

HiSD: Image-to-image Translation via Hierarchical Style Disentanglement Official pytorch implementation of paper "Image-to-image Translation

null 364 Dec 14, 2022
This is the PyTorch implementation of GANs N’ Roses: Stable, Controllable, Diverse Image to Image Translation

Official PyTorch repo for GAN's N' Roses. Diverse im2im and vid2vid selfie to anime translation.

null 1.1k Jan 1, 2023
PyTorch implementation of "Image-to-Image Translation Using Conditional Adversarial Networks".

pix2pix-pytorch PyTorch implementation of Image-to-Image Translation Using Conditional Adversarial Networks. Based on pix2pix by Phillip Isola et al.

mrzhu 383 Dec 17, 2022
Official pytorch implementation of "Scaling-up Disentanglement for Image Translation", ICCV 2021.

Official pytorch implementation of "Scaling-up Disentanglement for Image Translation", ICCV 2021.

Aviv Gabbay 41 Nov 29, 2022
Image-to-Image Translation in PyTorch

CycleGAN and pix2pix in PyTorch New: Please check out contrastive-unpaired-translation (CUT), our new unpaired image-to-image translation model that e

Jun-Yan Zhu 19k Jan 7, 2023
Image-to-Image Translation with Conditional Adversarial Networks (Pix2pix) implementation in keras

pix2pix-keras Pix2pix implementation in keras. Original paper: Image-to-Image Translation with Conditional Adversarial Networks (pix2pix) Paper Author

William Falcon 141 Dec 30, 2022
Maximum Spatial Perturbation for Image-to-Image Translation (Official Implementation)

MSPC for I2I This repository is by Yanwu Xu and contains the PyTorch source code to reproduce the experiments in our CVPR2022 paper Maximum Spatial Pe

null 51 Dec 14, 2022
This repository contains several image-to-image translation models, whcih were tested for RGB to NIR image generation. The models are Pix2Pix, Pix2PixHD, CycleGAN and PointWise.

RGB2NIR_Experimental This repository contains several image-to-image translation models, whcih were tested for RGB to NIR image generation. The models

null 5 Jan 4, 2023
Official PyTorch implementation of "Camera Distance-aware Top-down Approach for 3D Multi-person Pose Estimation from a Single RGB Image", ICCV 2019

PoseNet of "Camera Distance-aware Top-down Approach for 3D Multi-person Pose Estimation from a Single RGB Image" Introduction This repo is official Py

Gyeongsik Moon 677 Dec 25, 2022
Implementation of DropLoss for Long-Tail Instance Segmentation in Pytorch

[AAAI 2021]DropLoss for Long-Tail Instance Segmentation [AAAI 2021] DropLoss for Long-Tail Instance Segmentation Ting-I Hsieh*, Esther Robb*, Hwann-Tz

Tim 37 Dec 2, 2022
Fast, modular reference implementation of Instance Segmentation and Object Detection algorithms in PyTorch.

Faster R-CNN and Mask R-CNN in PyTorch 1.0 maskrcnn-benchmark has been deprecated. Please see detectron2, which includes implementations for all model

Facebook Research 9k Jan 4, 2023
Official Pytorch Implementation of Adversarial Instance Augmentation for Building Change Detection in Remote Sensing Images.

IAug_CDNet Official Implementation of Adversarial Instance Augmentation for Building Change Detection in Remote Sensing Images. Overview We propose a

null 53 Dec 2, 2022
This is the official pytorch implementation for the paper: Instance Similarity Learning for Unsupervised Feature Representation.

ISL This is the official pytorch implementation for the paper: Instance Similarity Learning for Unsupervised Feature Representation, which is accepted

null 19 May 4, 2022
Unofficial pytorch implementation of 'Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization'

pytorch-AdaIN This is an unofficial pytorch implementation of a paper, Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization [Hua

Naoto Inoue 873 Jan 6, 2023