Code Monkey home page Code Monkey logo

cyclegan's Introduction




CycleGAN

Torch implementation for learning an image-to-image translation (i.e. pix2pix) without input-output pairs, for example:

New: Please check out contrastive-unpaired-translation (CUT), our new unpaired image-to-image translation model that enables fast and memory-efficient training.

Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks
Jun-Yan Zhu*, Taesung Park*, Phillip Isola, Alexei A. Efros
Berkeley AI Research Lab, UC Berkeley
In ICCV 2017. (* equal contributions)

This package includes CycleGAN, pix2pix, as well as other methods like BiGAN/ALI and Apple's paper S+U learning.
The code was written by Jun-Yan Zhu and Taesung Park.
Update: Please check out PyTorch implementation for CycleGAN and pix2pix. The PyTorch version is under active development and can produce results comparable or better than this Torch version.

Other implementations:

[Tensorflow] (by Harry Yang), [Tensorflow] (by Archit Rathore), [Tensorflow] (by Van Huy), [Tensorflow] (by Xiaowei Hu), [Tensorflow-simple] (by Zhenliang He), [TensorLayer] (by luoxier), [Chainer] (by Yanghua Jin), [Minimal PyTorch] (by yunjey), [Mxnet] (by Ldpe2G), [lasagne/Keras] (by tjwei), [Keras] (by Simon Karlsson)

Applications

Monet Paintings to Photos

Collection Style Transfer

Object Transfiguration

Season Transfer

Photo Enhancement: Narrow depth of field

Prerequisites

  • Linux or OSX
  • NVIDIA GPU + CUDA CuDNN (CPU mode and CUDA without CuDNN may work with minimal modification, but untested)
  • For MAC users, you need the Linux/GNU commands gfind and gwc, which can be installed with brew install findutils coreutils.

Getting Started

Installation

luarocks install nngraph
luarocks install class
luarocks install https://raw.githubusercontent.com/szym/display/master/display-scm-0.rockspec
  • Clone this repo:
git clone https://github.com/junyanz/CycleGAN
cd CycleGAN

Apply a Pre-trained Model

bash ./datasets/download_dataset.sh ae_photos
  • Download the pre-trained model style_cezanne (For CPU model, use style_cezanne_cpu):
bash ./pretrained_models/download_model.sh style_cezanne
  • Now, let's generate Paul Cézanne style images:
DATA_ROOT=./datasets/ae_photos name=style_cezanne_pretrained model=one_direction_test phase=test loadSize=256 fineSize=256 resize_or_crop="scale_width" th test.lua

The test results will be saved to ./results/style_cezanne_pretrained/latest_test/index.html.
Please refer to Model Zoo for more pre-trained models. ./examples/test_vangogh_style_on_ae_photos.sh is an example script that downloads the pretrained Van Gogh style network and runs it on Efros's photos.

Train

  • Download a dataset (e.g. zebra and horse images from ImageNet):
bash ./datasets/download_dataset.sh horse2zebra
  • Train a model:
DATA_ROOT=./datasets/horse2zebra name=horse2zebra_model th train.lua
  • (CPU only) The same training command without using a GPU or CUDNN. Setting the environment variables gpu=0 cudnn=0 forces CPU only
DATA_ROOT=./datasets/horse2zebra name=horse2zebra_model gpu=0 cudnn=0 th train.lua
  • (Optionally) start the display server to view results as the model trains. (See Display UI for more details):
th -ldisplay.start 8000 0.0.0.0

Test

  • Finally, test the model:
DATA_ROOT=./datasets/horse2zebra name=horse2zebra_model phase=test th test.lua

The test results will be saved to an HTML file here: ./results/horse2zebra_model/latest_test/index.html.

Model Zoo

Download the pre-trained models with the following script. The model will be saved to ./checkpoints/model_name/latest_net_G.t7.

bash ./pretrained_models/download_model.sh model_name
  • orange2apple (orange -> apple) and apple2orange: trained on ImageNet categories apple and orange.
  • horse2zebra (horse -> zebra) and zebra2horse (zebra -> horse): trained on ImageNet categories horse and zebra.
  • style_monet (landscape photo -> Monet painting style), style_vangogh (landscape photo -> Van Gogh painting style), style_ukiyoe (landscape photo -> Ukiyo-e painting style), style_cezanne (landscape photo -> Cezanne painting style): trained on paintings and Flickr landscape photos.
  • monet2photo (Monet paintings -> real landscape): trained on paintings and Flickr landscape photographs.
  • cityscapes_photo2label (street scene -> label) and cityscapes_label2photo (label -> street scene): trained on the Cityscapes dataset.
  • map2sat (map -> aerial photo) and sat2map (aerial photo -> map): trained on Google maps.
  • iphone2dslr_flower (iPhone photos of flowers -> DSLR photos of flowers): trained on Flickr photos.

CPU models can be downloaded using:

bash pretrained_models/download_model.sh <name>_cpu

, where <name> can be horse2zebra, style_monet, etc. You just need to append _cpu to the target model.

Training and Test Details

To train a model,

DATA_ROOT=/path/to/data/ name=expt_name th train.lua

Models are saved to ./checkpoints/expt_name (can be changed by passing checkpoint_dir=your_dir in train.lua).
See opt_train in options.lua for additional training options.

To test the model,

DATA_ROOT=/path/to/data/ name=expt_name phase=test th test.lua

This will run the model named expt_name in both directions on all images in /path/to/data/testA and /path/to/data/testB.
A webpage with result images will be saved to ./results/expt_name (can be changed by passing results_dir=your_dir in test.lua).
See opt_test in options.lua for additional test options. Please use model=one_direction_test if you only would like to generate outputs of the trained network in only one direction, and specify which_direction=AtoB or which_direction=BtoA to set the direction.

There are other options that can be used. For example, you can specify resize_or_crop=crop option to avoid resizing the image to squares. This is indeed how we trained GTA2Cityscapes model in the projet webpage and Cycada model. We prepared the images at 1024px resolution, and used resize_or_crop=crop fineSize=360 to work with the cropped images of size 360x360. We also used lambda_identity=1.0.

Datasets

Download the datasets using the following script. Many of the datasets were collected by other researchers. Please cite their papers if you use the data.

bash ./datasets/download_dataset.sh dataset_name
  • facades: 400 images from the CMP Facades dataset. [Citation]
  • cityscapes: 2975 images from the Cityscapes training set. [Citation]. Note: Due to license issue, we do not host the dataset on our repo. Please download the dataset directly from the Cityscapes webpage. Please refer to ./datasets/prepare_cityscapes_dataset.py for more detail.
  • maps: 1096 training images scraped from Google Maps.
  • horse2zebra: 939 horse images and 1177 zebra images downloaded from ImageNet using the keywords wild horse and zebra
  • apple2orange: 996 apple images and 1020 orange images downloaded from ImageNet using the keywords apple and navel orange.
  • summer2winter_yosemite: 1273 summer Yosemite images and 854 winter Yosemite images were downloaded using Flickr API. See more details in our paper.
  • monet2photo, vangogh2photo, ukiyoe2photo, cezanne2photo: The art images were downloaded from Wikiart. The real photos are downloaded from Flickr using the combination of the tags landscape and landscapephotography. The training set size of each class is Monet:1074, Cezanne:584, Van Gogh:401, Ukiyo-e:1433, Photographs:6853.
  • iphone2dslr_flower: both classes of images were downloaded from Flickr. The training set size of each class is iPhone:1813, DSLR:3316. See more details in our paper.

Display UI

Optionally, for displaying images during training and test, use the display package.

  • Install it with: luarocks install https://raw.githubusercontent.com/szym/display/master/display-scm-0.rockspec
  • Then start the server with: th -ldisplay.start
  • Open this URL in your browser: http://localhost:8000

By default, the server listens on localhost. Pass 0.0.0.0 to allow external connections on any interface:

th -ldisplay.start 8000 0.0.0.0

Then open http://(hostname):(port)/ in your browser to load the remote desktop.

Setup Training and Test data

To train CycleGAN model on your own datasets, you need to create a data folder with two subdirectories trainA and trainB that contain images from domain A and B. You can test your model on your training set by setting phase='train' in test.lua. You can also create subdirectories testA and testB if you have test data.

You should not expect our method to work on just any random combination of input and output datasets (e.g. cats<->keyboards). From our experiments, we find it works better if two datasets share similar visual content. For example, landscape painting<->landscape photographs works much better than portrait painting <-> landscape photographs. zebras<->horses achieves compelling results while cats<->dogs completely fails. See the following section for more discussion.

Failure cases

Our model does not work well when the test image is rather different from the images on which the model is trained, as is the case in the figure to the left (we trained on horses and zebras without riders, but test here one a horse with a rider). See additional typical failure cases here. On translation tasks that involve color and texture changes, like many of those reported above, the method often succeeds. We have also explored tasks that require geometric changes, with little success. For example, on the task of dog<->cat transfiguration, the learned translation degenerates into making minimal changes to the input. We also observe a lingering gap between the results achievable with paired training data and those achieved by our unpaired method. In some cases, this gap may be very hard -- or even impossible,-- to close: for example, our method sometimes permutes the labels for tree and building in the output of the cityscapes photos->labels task.

Citation

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

@inproceedings{CycleGAN2017,
  title={Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networkss},
  author={Zhu, Jun-Yan and Park, Taesung and Isola, Phillip and Efros, Alexei A},
  booktitle={Computer Vision (ICCV), 2017 IEEE International Conference on},
  year={2017}
}

Related Projects:

contrastive-unpaired-translation (CUT)
pix2pix-Torch | pix2pixHD | BicycleGAN | vid2vid | SPADE/GauGAN
iGAN | GAN Dissection | GAN Paint

Cat Paper Collection

If you love cats, and love reading cool graphics, vision, and ML papers, please check out the Cat Paper Collection.

Acknowledgments

Code borrows from pix2pix and DCGAN. The data loader is modified from DCGAN and Context-Encoder. The generative network is adopted from neural-style with Instance Normalization.

cyclegan's People

Contributors

1j01 avatar aferriss avatar asturur avatar junyanz avatar kmader avatar naruto-sasuke avatar phillipi avatar taesungp avatar tylercarberry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cyclegan's Issues

attempt to call global 'unpack' (a nil value)

/home/gxy/install_package/torch/install/bin/lua: ./util/plot_util.lua:23: attempt to call global 'unpack' (a nil value)
stack traceback:
./util/plot_util.lua:23: in function 'Initialize'
train.lua:81: in main chunk
[C]: in function 'dofile'
...kage/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: in ?

When you are use Lua5.2. It should modify ./util/plot_util.lua the 23th line, as follow:
-labels={'epoch', unpack(self.display_plot)},
+labels={'epoch', table.unpack(self.display_plot)},

identity loss parameter

Is there a way to configure the identity loss weight via the options parameters? For instance, to set to 0.5 per some of the experiments in the paper?

I see a flag for enabling/disabling identity mapping but nothing for setting the loss weight

Did not find directory: ...CycleGAN/testA

I just want to test this and got an error

/home/gormatevosyan14/torch/install/bin/luajit: ...vosyan14/torch/install/share/lua/5.1/threads/threads.lua:183: [thread 1 callback] /home/gormatevosyan14/lenz/CycleGAN/data/donkey_folder.lua:28: Did not find directory: /home/gormatevosyan14/lenz/CycleGAN/testA stack traceback: [C]: in function 'error' /home/gormatevosyan14/lenz/CycleGAN/data/donkey_folder.lua:28: in main chunk [C]: in function 'dofile' /home/gormatevosyan14/lenz/CycleGAN/data/data.lua:39: in function </home/gormatevosyan14/lenz/CycleGAN/data/data.lua:29> [C]: in function 'xpcall' ...vosyan14/torch/install/share/lua/5.1/threads/threads.lua:234: in function 'callback' ...tevosyan14/torch/install/share/lua/5.1/threads/queue.lua:65: in function <...tevosyan14/torch/install/share/lua/5.1/threads/queue.lua:41> [C]: in function 'pcall' ...tevosyan14/torch/install/share/lua/5.1/threads/queue.lua:40: in function 'dojob' [string " local Queue = require 'threads.queue'..."]:13: in main chunk stack traceback: [C]: in function 'error' ...vosyan14/torch/install/share/lua/5.1/threads/threads.lua:183: in function 'dojob' ...vosyan14/torch/install/share/lua/5.1/threads/threads.lua:264: in function 'synchronize' ...vosyan14/torch/install/share/lua/5.1/threads/threads.lua:142: in function 'specific' ...vosyan14/torch/install/share/lua/5.1/threads/threads.lua:125: in function 'Threads' /home/gormatevosyan14/lenz/CycleGAN/data/data.lua:27: in function 'new' /home/gormatevosyan14/lenz/CycleGAN/data/data_util.lua:17: in function 'load_dataset' ./data/unaligned_data_loader.lua:24: in function 'Initialize' test.lua:47: in main chunk [C]: in function 'dofile' ...an14/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x00406670

Here is options

CPU Mode { cudnn : 0 results_dir : "./results/" resize_or_crop : "scale_width" name : "style_cezanne_pretrained" which_direction : "AtoB" visual_dir : "/home/gormatevosyan14/lenz/CycleGAN/checkpoints/style_cezanne_pretrained/visuals" phase : "test" batchSize : 1 fineSize : 256 continue_train : 1 nThreads : 1 aspect_ratio : 1 loadSize : 256 gpu : 0 test : 1 DATA_ROOT : "" align_data : 0 which_epoch : "latest" model : "one_direction_test" cache_dir : "./cache" norm : "instance" how_many : "all" input_nc : 3 display : 1 output_nc : 3 flip : 0 checkpoints_dir : "./checkpoints" display_id : 200 serial_batches : 1 }

OS: Ubuntu 14.04 trusty

Freezing instance normalization during test phase?

I am looking for a way to get more consistency in the output when processing a bigger image in tiles.

The problem is that due to the memory constraints currently it's hard training and processing inputs bigger than 512x512 (actually for 64 filters the maximum I can train is 256x256 on a GTX 1080ti). So the workaround is to train and process the images in tiles, but trying to maintain the texture details and scale of the original image size. Of course this comes with its own bag of issues since the model does never see the entire image and might learn different features.

Anyway, it kind of works at least for artistic purposes, but the problem is that when processing all the tiles of an image in test mode the results of neighboring tiles often differ a lot in color (unfortunately also in style, which will be much harder to solve).

Here's an example:
j_14779896064_80459dfff7_o

Philip Isola mentioned in a tweet that there might be a way to freeze the instance normalization, which possibly might help with the consistency. So my questions are: How would one do that? Is this something that has aready to be done during the training phase or it possible to just do it in the test phase?

I suspect that I have to look at the InstanceNormalization class' running_mean and runng_var, but any clue how to go about this would be very welcome.

The scale of generated image

Hi Mr. Zhu,
Your results are powerful and attract me deeply.
But I have a question, the scale of generated image is too small (only 128*128), do you have some idea to transform arbitrary scale of image as input ?

Loading `latest_net_G.t7 ` model requires CUDA from util.lua in (CPU_MODE) Mac

------------------- Options -------------------	
                DATA_ROOT: ./datasets/ae_photos	
               align_data: 0	
             aspect_ratio: 1	
                batchSize: 1	
          checkpoints_dir: ./checkpoints	
           continue_train: 1	
                    cudnn: 0	
                  display: 1	
               display_id: 200	
                 fineSize: 256	
                     flip: 0	
                      gpu: 0	
                 how_many: all	
                 input_nc: 3	
                 loadSize: 256	
                    model: one_direction_test	
                 nThreads: 1	
                     name: style_cezanne_pretrained	
                     norm: instance	
                output_nc: 3	
                    phase: test	
           resize_or_crop: scale_width	
              results_dir: ./results/	
           serial_batches: 1	
                     test: 1	
          which_direction: AtoB	
              which_epoch: latest	
-----------------------------------------------	
CPU Mode	
{
  cudnn : 0
  results_dir : "./results/"
  resize_or_crop : "scale_width"
  name : "style_cezanne_pretrained"
  which_direction : "AtoB"
  phase : "test"
  fineSize : 256
  batchSize : 1
  continue_train : 1
  aspect_ratio : 1
  loadSize : 256
  gpu : 0
  nThreads : 1
  DATA_ROOT : "./datasets/ae_photos"
  test : 1
  which_epoch : "latest"
  align_data : 0
  model : "one_direction_test"
  norm : "instance"
  how_many : "all"
  input_nc : 3
  display : 1
  output_nc : 3
  flip : 0
  checkpoints_dir : "./checkpoints"
  display_id : 200
  serial_batches : 1
}
DataLoader UnalignedDataLoader was created.	
Starting donkey with id: 1 seed: 6108
table: 0x0836e0a0
table: 0x084acfc8
running "find" on each class directory, and concatenate all those filenames into a single file containing all image paths for a given class
now combine all the files to a single large file
load the large concatenated list of sample paths to self.imagePath
cmd..gwc -L '/tmp/lua_RBFY3t' |gcut -f1 -d' '
205 samples found.............. 0/205 .............................] ETA: 0ms | Step: 0ms          
Updating classList and imageClass appropriately
 [============================= 1/1 ==============================>] Tot: 0ms | Step: 0ms          
Cleaning up temporary files
Dataset Size A: 	205	
Starting donkey with id: 1 seed: 3950
table: 0x08905270
table: 0x08855168
running "find" on each class directory, and concatenate all those filenames into a single file containing all image paths for a given class
now combine all the files to a single large file
load the large concatenated list of sample paths to self.imagePath
cmd..gwc -L '/tmp/lua_YTSNnD' |gcut -f1 -d' '
205 samples found.............. 0/205 .............................] ETA: 0ms | Step: 0ms          
Updating classList and imageClass appropriately
 [============================= 1/1 ==============================>] Tot: 0ms | Step: 0ms          
Cleaning up temporary files
Dataset Size B: 	205	
use InstanceNormalization	
loading previously trained model (~/Documents/BigDataLab/Lotus/CycleGAN/checkpoints/style_cezanne_pretrained/latest_net_G.t7)	
use InstanceNormalization	
~/torch/install/bin/luajit: ~/torch/install/share/lua/5.1/torch/File.lua:343: unknown Torch class <torch.CudaTensor>
stack traceback:
	[C]: in function 'error'
	/Users/HANEL/torch/install/share/lua/5.1/torch/File.lua:343: in function 'readObject'
	/Users/HANEL/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject'
	/Users/HANEL/torch/install/share/lua/5.1/nn/Module.lua:192: in function 'read'
	/Users/HANEL/torch/install/share/lua/5.1/torch/File.lua:351: in function 'readObject'
	/Users/HANEL/torch/install/share/lua/5.1/torch/File.lua:409: in function 'load'
	...~/Documents/BigDataLab/Lotus/CycleGAN/util/util.lua:192: in function 'load_test_model'
	./models/one_direction_test_model.lua:23: in function 'Initialize'
	test.lua:79: in main chunk
	[C]: in function 'dofile'
	...ANEL/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
	[C]: at 0x0107710360

Error while running Test script

./models/cycle_gan_model.lua:305: attempt to compare number with nil
stack traceback:
./models/cycle_gan_model.lua:305: in function 'GetCurrentVisuals'
test.lua:103: in main chunk

AWS Instance - "unknown Torch class <nn.SpatialReflectionPadding>"

I've made an AWS instance for people to test this.
All setup with Torch and dependencies.

However getting this error when running...

ubuntu@ip-172-31-3-22:~/CycleGAN$ DATA_ROOT=./datasets/ae_photos name=style_cezanne_pretrained model=one_direction_test phase=test loadSize=256 fineSize=256 resize_or_crop="scale_width" th test.lua
------------------- Options -------------------
DATA_ROOT: ./datasets/ae_photos
align_data: 0
aspect_ratio: 1
batchSize: 1
checkpoints_dir: ./checkpoints
continue_train: 1
cudnn: 1
display: 1
display_id: 200
fineSize: 256
flip: 0
gpu: 1
how_many: all
input_nc: 3
loadSize: 256
model: one_direction_test
nThreads: 1
name: style_cezanne_pretrained
norm: instance
output_nc: 3
phase: test
preprocess: regular
resize_or_crop: scale_width
results_dir: ./results/
serial_batches: 1
test: 1
which_direction: AtoB
which_epoch: latest

GPU Mode
function: 0x412208d8
DataLoader UnalignedDataLoader was created.
Starting donkey with id: 1 seed: 5476
table: 0x41ea8e98
table: 0x41ec0fb8
running "find" on each class directory, and concatenate all those filenames into a single file containing all image paths for a given class
now combine all the files to a single large file
load the large concatenated list of sample paths to self.imagePath
cmd..wc -L '/tmp/lua_kY7Jdn' |cut -f1 -d' '
205 samples found................................... 0/205 ...................................................] ETA: 0ms | Step: 0ms
Updating classList and imageClass appropriately
[================================================== 1/1 ====================================================>] ETA: 0ms | Step: 0ms
Cleaning up temporary files
Dataset Size A: 205
Starting donkey with id: 1 seed: 514
table: 0x40c39b98
table: 0x41888090
running "find" on each class directory, and concatenate all those filenames into a single file containing all image paths for a given class
now combine all the files to a single large file
load the large concatenated list of sample paths to self.imagePath
cmd..wc -L '/tmp/lua_eMI6Qv' |cut -f1 -d' '
205 samples found................................... 0/205 ...................................................] ETA: 0ms | Step: 0ms
Updating classList and imageClass appropriately
[================================================== 1/1 ====================================================>] ETA: 0ms | Step: 0ms
Cleaning up temporary files
Dataset Size B: 205
use InstanceNormalization
loading previously trained model (/home/ubuntu/CycleGAN/checkpoints/style_cezanne_pretrained/latest_net_G.t7)
use InstanceNormalization
/home/ubuntu/torch/install/bin/luajit: /home/ubuntu/torch/install/share/lua/5.1/torch/File.lua:249: unknown Torch class <nn.SpatialReflectionPadding>
stack traceback:
[C]: in function 'error'
/home/ubuntu/torch/install/share/lua/5.1/torch/File.lua:249: in function 'readObject'
/home/ubuntu/torch/install/share/lua/5.1/torch/File.lua:271: in function 'readObject'
/home/ubuntu/torch/install/share/lua/5.1/torch/File.lua:271: in function 'readObject'
/home/ubuntu/torch/install/share/lua/5.1/torch/File.lua:257: in function 'readObject'
/home/ubuntu/torch/install/share/lua/5.1/torch/File.lua:294: in function 'load'
/home/ubuntu/CycleGAN/util/util.lua:192: in function 'load_test_model'
./models/one_direction_test_model.lua:23: in function 'Initialize'
test.lua:80: in main chunk
[C]: in function 'dofile'
...untu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
[C]: at 0x00406670

result of the pretrained model

Hey,
thanks for publishing the pretrained model, however, after I run the scripts that you provided to generate Paul Cézanne style images, here are the images that I get:
screenshot from 2017-10-12 16 47 40
I don't know where went wrong cos I just follow directly your instructions here:
screenshot from 2017-10-12 16 49 06
Any help would be appreciated, thanks in advance!

Ignore

Never mind, I figured it.

Fine-tune a pre-trained model

Hi, How can I load a pre-trained model and fine-tune it on my own data? (I don't want to train the model from scratch)

Out of memory

Hi,
When running the pretrained style_monet, I get the following error:

THCudaCheck FAIL file=/tmp/luarocks_cutorch-scm-1-3656/cutorch/lib/THC/generic/THCStorage.cu line=66 error=2 : out of memory
/root/torch/distro/install/bin/luajit: /root/torch/distro/install/share/lua/5.1/nn/Container.lua:67:
In 29 module of nn.Sequential:
/root/torch/distro/install/share/lua/5.1/nn/THNN.lua:110: cuda runtime error (2) : out of memory at /tmp/luarocks_cutorch-scm-1-3656/cutorch/lib/THC/generic/THCStorage.cu:66
stack traceback:
[C]: in function 'v'
/root/torch/distro/install/share/lua/5.1/nn/THNN.lua:110: in function 'SpatialConvolutionMM_updateOutput'
...h/distro/install/share/lua/5.1/nn/SpatialConvolution.lua:79: in function <...h/distro/install/share/lua/5.1/nn/SpatialConvolution.lua:76>
[C]: in function 'xpcall'
/root/torch/distro/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
/root/torch/distro/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
./models/one_direction_test_model.lua:52: in function 'Forward'
test.lua:100: in main chunk
[C]: in function 'dofile'
...rch/distro/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50

WARNING: If you see a stack trace below, it doesn't point to the place where this error occurred. Please use only the one above.
stack traceback:
[C]: in function 'error'
/root/torch/distro/install/share/lua/5.1/nn/Container.lua:67: in function 'rethrowErrors'
/root/torch/distro/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
./models/one_direction_test_model.lua:52: in function 'Forward'
test.lua:100: in main chunk
[C]: in function 'dofile'
...rch/distro/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50

Multi-GPU support

It is possible to choose which GPU gets to do the job, it would be great to also allow to use multiple GPUs at the same time.

Why batch size is 1 ?

When using batch norm, batch size more than 16 is better I think, to reduce variance.
Why the batch size is 1 here ?

Torch-CL support?

This looks really fun to play with, thanks!

Any reason to think this wouldn't work with Torch-CL, if all occurances of :cuda() were just replaced with :cl()?

(more and more reasons to just drop the two methods and have a generic :gpu() method, IMO...)

Pre-trained model

Hi,
could please also make available the pretrained models for cityscapes_label2photo, i.e. the generator takes the segmented image and generates a realistic one?

Thanks

display error

Hi I tried to run but received this error
/Users/zSUGARBANK/torch/install/bin/luajit: ...rs/zSUGARBANK/torch/install/share/lua/5.1/trepl/init.lua:389: ...rs/zSUGARBANK/torch/install/share/lua/5.1/trepl/init.lua:389: module 'display' not found:No LuaRocks module found for display
no field package.preload['display']
no file '/Users/zSUGARBANK/.luarocks/share/lua/5.1/display.lua'
no file '/Users/zSUGARBANK/.luarocks/share/lua/5.1/display/init.lua'
no file '/Users/zSUGARBANK/torch/install/share/lua/5.1/display.lua'
no file '/Users/zSUGARBANK/torch/install/share/lua/5.1/display/init.lua'
no file './display.lua'
no file '/Users/zSUGARBANK/torch/install/share/luajit-2.1.0-beta1/display.lua'
no file '/usr/local/share/lua/5.1/display.lua'
no file '/usr/local/share/lua/5.1/display/init.lua'
no file '/Users/zSUGARBANK/.luarocks/lib/lua/5.1/display.so'
no file '/Users/zSUGARBANK/torch/install/lib/lua/5.1/display.so'
no file './display.so'
no file '/usr/local/lib/lua/5.1/display.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'error'
...rs/zSUGARBANK/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
test.lua:27: in main chunk
[C]: in function 'dofile'
...BANK/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x010402bd00

When checking it looks like I have installed this rock rock though

Christians-iMac:CycleGAN-master zSUGARBANK$ luarocks list

Installed rocks:

async
scm-1 (installed) - /usr/local/lib/luarocks/rocks-5.2

autograd
scm-1 (installed) - /usr/local/lib/luarocks/rocks-5.2

cwrap
scm-1 (installed) - /usr/local/lib/luarocks/rocks-5.2

display
scm-0 (installed) - /usr/local/lib/luarocks/rocks-5.2

image
1.0-0 (installed) - /usr/local/lib/luarocks/rocks-5.2

lua-cjson
2.1.0-1 (installed) - /usr/local/lib/luarocks/rocks-5.2

luaffi
scm-1 (installed) - /usr/local/lib/luarocks/rocks-5.2

luarocks
2.4.2-1 (installed) - /usr/local/lib/luarocks/rocks-5.2

luasocket
3.0rc1-2 (installed) - /usr/local/lib/luarocks/rocks-5.2

matio
scm-1 (installed) - /usr/local/lib/luarocks/rocks-5.2

nn
scm-1 (installed) - /usr/local/lib/luarocks/rocks-5.2

nninit
scm-1 (installed) - /usr/local/lib/luarocks/rocks-5.2

optim
1.0.5-0 (installed) - /usr/local/lib/luarocks/rocks-5.2

paths
scm-1 (installed) - /usr/local/lib/luarocks/rocks-5.2

sys
1.1-0 (installed) - /usr/local/lib/luarocks/rocks-5.2

torch
scm-1 (installed) - /usr/local/lib/luarocks/rocks-5.2

unsup
0.1-0 (installed) - /usr/local/lib/luarocks/rocks-5.2

xlua
1.1-0 (installed) - /usr/local/lib/luarocks/rocks-5.2

Any advice?
Could I unrequire display?

Option for cache location

Hello,

I tried to run CycleGAN in a Singularity Container on our cluster. If the normal user runs this container (and therefore CycleGAN) he is not allowed to change the container. Unfortunately the creation of the cache directory for the training metadata in the file data/donkey_folder.lua does not work. It says something like "mkdir cannot create directory".

  1. I don't know how much the cache speeds up the computation? The training ran without cache (I hope succesfully). Does CycleGAN need the cache?

  2. Can you introduce an option for the location of the cache directory analogue to the options for results_dir and checkpoints_dir? If I can specify a cache directory by an absolute path my Singularity container could create that cache.

The code in data/donkey_folder.lua I mean is:

-- a cache file of the training metadata (if doesnt exist, will be created)
local cache = "cache"
local cache_prefix = opt.data:gsub('/', '_')
os.execute('mkdir -p cache')
local trainCache = paths.concat(cache, cache_prefix .. '_trainCache.t7')

Correct learning model and the size of the photo at the output

I understand that to get the output of a photo size of 512x512 should I train it on 512x512?

For example, before learning, change the size in options.lua display_winsize to 512?
Or is it not necessary?

Just like now I get this error:
./models/cycle_gan_model.lua:109: bad argument #1 to 'copy' (sizes do not match at /root/torch/extra/cutorch/lib/THC/generic/THCTensorCopy.c:48) stack traceback: [C]: in function 'copy' ./models/cycle_gan_model.lua:109: in function 'Forward' test.lua:101: in main chunk [C]: in function 'dofile' /root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x00405d50

I do this:
DATA_ROOT=./datasets/faces name=face_model phase=test loadSize=128 fineSize=512 resize_or_crop="scale_width" th test.lua

sorry, this google translate ¯ \ _ (ツ) _ / ¯

Training Grid Like Image

During the training procedure, the output image of cycle GAN is always grid like, I am wondering anyone else meets this problem and has some idea on it~
screen shot 2017-08-16 at 9 02 21 am
Thanks~

soft smoothing for lsgan?

why is this 0.9 and not 1? (differs from eq.5 in paper)


self.real_label_A = torch.Tensor(D_A_size):fill(0.9)
self.real_label_B = torch.Tensor(D_B_size):fill(0.9)

MInimum Datasets

What is the minimum number of images include in training part and testing part?

Error "attempt to index field 'THNN' (a nil value)"

------------------- Options -------------------
DATA_ROOT: ./datasets/ae_photos
align_data: 0
aspect_ratio: 1
batchSize: 1
checkpoints_dir: ./checkpoints
continue_train: 1
cudnn: 1
display: 1
display_id: 200
fineSize: 256
flip: 0
gpu: 1
how_many: all
input_nc: 3
loadSize: 256
model: one_direction_test
nThreads: 1
name: style_vangogh_pretrained
norm: instance
output_nc: 3
phase: test
preprocess: regular
resize_or_crop: scale_width
results_dir: ./results/
serial_batches: 1
test: 1
which_direction: AtoB
which_epoch: latest

GPU Mode
function: 0x4047acd8
DataLoader UnalignedDataLoader was created.
Starting donkey with id: 1 seed: 8091
table: 0x41e940c0
table: 0x418ef650
running "find" on each class directory, and concatenate all those filenames into a single file containing all image paths for a given class
now combine all the files to a single large file
load the large concatenated list of sample paths to self.imagePath
cmd..wc -L '/tmp/lua_gOkqLo' |cut -f1 -d' '
205 samples found................................................................... 0/205 ....................................................................................]ETA: 0ms | Step: 0ms
Updating classList and imageClass appropriately
[================================================================================== 1/1 =====================================================================================>]ETA: 0ms | Step: 0ms
Cleaning up temporary files
Dataset Size A: 205
Starting donkey with id: 1 seed: 2932
table: 0x414e6458
table: 0x414a2c68
running "find" on each class directory, and concatenate all those filenames into a single file containing all image paths for a given class
now combine all the files to a single large file
load the large concatenated list of sample paths to self.imagePath
cmd..wc -L '/tmp/lua_WJyu1k' |cut -f1 -d' '
205 samples found................................................................... 0/205 ....................................................................................]ETA: 0ms | Step: 0ms
Updating classList and imageClass appropriately
[================================================================================== 1/1 =====================================================================================>]ETA: 0ms | Step: 0ms
Cleaning up temporary files
Dataset Size B: 205
use InstanceNormalization
loading previously trained model (/home/ubuntu/CycleGAN/checkpoints/style_vangogh_pretrained/latest_net_G.t7)
use InstanceNormalization
---------- # Learnable Parameters --------------
G_A = 2855811

processing batch 1
pathsA {
1 : "20.jpg"
}
pathsB nil
/home/ubuntu/torch/install/bin/luajit: /home/ubuntu/torch/install/share/lua/5.1/nn/Container.lua:67:
In 1 module of nn.Sequential:
...ch/install/share/lua/5.1/nn/SpatialReflectionPadding.lua:14: attempt to index field 'THNN' (a nil value)
stack traceback:
...ch/install/share/lua/5.1/nn/SpatialReflectionPadding.lua:14: in function <...ch/install/share/lua/5.1/nn/SpatialReflectionPadding.lua:12>
[C]: in function 'xpcall'
/home/ubuntu/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
/home/ubuntu/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
./models/one_direction_test_model.lua:44: in function 'Forward'
test.lua:101: in main chunk
[C]: in function 'dofile'
...untu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
[C]: at 0x00406670

WARNING: If you see a stack trace below, it doesn't point to the place where this error occurred. Please use only the one above.
stack traceback:
[C]: in function 'error'
/home/ubuntu/torch/install/share/lua/5.1/nn/Container.lua:67: in function 'rethrowErrors'
/home/ubuntu/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
./models/one_direction_test_model.lua:44: in function 'Forward'
test.lua:101: in main chunk
[C]: in function 'dofile'
...untu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
[C]: at 0x00406670
test_vangogh_style_on_ae_photos.sh: 17: [: 1: unexpected operator

To run dataset.lua you need "gfind" and "gwd" for OSX: brew coreutils findutils

Love your project, thanks for putting it online!

As the titles states, please add a small OSX segment to "Prerequisites" in the Readme, something like:

To execute data/dataset.lua you need the Linux/GNU commands gfind and gwc, which can be installed with brew install findutils coreutils.

Otherwise you will get these errors:

(...)
/tmp/lua_iAPGkD: line 1: gfind: command not found
(...)
sh: gwc: command not found

Another OSX quirk: When trying the first training example (horse2zebra), i had to run the command
DATA_ROOT=./datasets/horse2zebra name=horse2zebra_model th train.lua
with sudo, without it i got this error:

(...)
/YOUR-TORCH-PATH/torch/install/bin/luajit: ./options.lua:132: attempt to index global 'fd' (a nil value)
stack traceback:
	./options.lua:132: in function 'parse_options'
	train.lua:14: in main chunk
	[C]: in function 'dofile'
	...avid/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
	[C]: at 0x0105390360

none

I would like to ask what are the image pairs that are defined as x,y in loss_gan. (There are D_y(G(x)) and D_y(y) terms simultaneously in L_GAN.). Are all combinations of image pairs used?

attempt to index global 'jit' (a nil value)

Does not work with Lua52 (not LuaJit) which I used to get around memory issues (OpenNMT/OpenNMT#20)

Full error message

/Users/mader/torch/install/bin/lua: ...rs/mader/torch/install/share/lua/5.2/threads/threads.lua:183: [thread 1 callback] /Users/mader/Dropbox/Informatics/CycleGAN/data/dataset.lua:148: attempt to index global 'jit' (a nil value)

CUDA driver version is insufficient for CUDA runtime version

When I run: DATA_ROOT=./datasets/ae_photos name=style_cezanne_pretrained model=one_direction_test phase=test loadSize=256 fineSize=256 resize_or_crop="scale_width" gpu=0 th test.lua

It comes:
...
Cleaning up temporary files
Dataset Size B: 205
use InstanceNormalization
loading previously trained model (/Users/Y/CycleGAN/checkpoints/style_cezanne_pretrained/latest_net_G.t7)
use InstanceNormalization
THCudaCheck FAIL file=/tmp/luarocks_cutorch-scm-1-7004/cutorch/lib/THC/THCGeneral.c line=66 error=35 : CUDA driver version is insufficient for CUDA runtime version
/Users/Y/torch/install/bin/luajit: /Users/Y/torch/install/share/lua/5.1/trepl/init.lua:389: /Users/Y/torch/install/share/lua/5.1/trepl/init.lua:389: cuda runtime error (35) : CUDA driver version is insufficient for CUDA runtime version at /tmp/luarocks_cutorch-scm-1-7004/cutorch/lib/THC/THCGeneral.c:66
stack traceback:
[C]: in function 'error'
/Users/Y/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
/Users/Y/CycleGAN/util/util.lua:189: in function 'load_test_model'
./models/one_direction_test_model.lua:23: in function 'Initialize'
test.lua:79: in main chunk
[C]: in function 'dofile'
...nggy/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x010f30da00

Why will it come out? Any one can help me?
OS: 10.12.4
CUDA: 8.0.61
Xcode: 8.2 (CUDA (v8.0.61) does not yet support Xcode 8.3)

input_nc not used

In models/architecture.lua

-- function defineG_resnet_9blocks(input_nc, output_nc, ngf)
-- local e1 = data - nn.SpatialReflectionPadding(p, p, p, p) - nn.SpatialConvolution(3, ngf, f, f, 1, 1) - normalization(ngf) - nn.ReLU(true)

shouldn't it be the following?

++ function defineG_resnet_9blocks(input_nc, output_nc, ngf)
++ local e1 = data - nn.SpatialReflectionPadding(p, p, p, p) - nn.SpatialConvolution(input_nc, ngf, f, f, 1, 1) - normalization(ngf) - nn.ReLU(true)

Loading and testing only a trained fakeA or fakeB model?

I'm wondering if there is already an option in place that does only load one of the generator models for the purpose of processing images after training? It seems like right now the test.lua script and the model classes will always load all the models and thus using GPU memory that could otherwise be used for processing bigger input sizes.

I'm not sure if that even possible or if the CycleGAN process always requires both models even in test mode?

Discriminator looses (?)

I am trying to apply cyclegan to my data, and at the beginning (1-2 epoch) it kinda makes needed transformation (with added noise), but then it just copies the image 2 times. Losses for G and D are near, so it seems that Generator is fooling discriminator with adversarial examples. I haven't find any solution, maybe someone have faced this problem? I have seen quite complex transformations with cyclegan, like face2food and face2doll

Windows support

Hi,
I'm interested in helping porting this to windows. This project can be a good application for video editing. How can I help?
Any pointers as to how I can approach this?

Memory usage increases with epochs

Hi junyanz,

Thanks for releasing the code, very cool work. Awesome!

I am having a memory issue, or perhaps it is normal that you know of. With each epoch, GPU memory usage seems to increase. After a while, the limit (12GB) is reached and the learning terminates.

Is there a way to circumvent this? I currently just reduce the number of filters, but it is hard to estimate how many epoch I can run until it crashes.

Best,
Ruud

content gan

Can you provide the paper of content gan?
Thank a lot.

Fatal error when running test in CPU only mode.

First of all CycleGAN show awesome results when running on GPU.
But I was unable to generate bigger image using CPU.

DATA_ROOT=./datasets/m name=style_cezanne_pretrained model=one_direction_test phase=test loadSize=500 fineSize=500 resize_or_crop="scale_width" gpu=0 cudnn=0 th test.lua

/root/torch/install/bin/luajit: /root/torch/install/share/lua/5.1/torch/File.lua:343: unknown Torch class <torch.CudaTensor> stack traceback: [C]: in function 'error' /root/torch/install/share/lua/5.1/torch/File.lua:343: in function 'readObject' /root/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject' /root/torch/install/share/lua/5.1/nn/Module.lua:184: in function 'read' /root/torch/install/share/lua/5.1/torch/File.lua:351: in function 'readObject' /root/torch/install/share/lua/5.1/torch/File.lua:409: in function 'load' /root/CycleGAN/util/util.lua:192: in function 'load_test_model' ./models/one_direction_test_model.lua:23: in function 'Initialize' test.lua:80: in main chunk [C]: in function 'dofile' /root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk [C]: at 0x00406670

Visualize the middle layers

Hi,
How can I get the values of the middle layers to visualize them in generator? (for example in defineG_encoder_decoder function.)

train.lua crashes with batchSize bigger than 1

[...]/torch/install/bin/luajit: [...]/torch/install/share/lua/5.1/image/init.lua:176: [write_png_file] Depth must be 1, 3 or 4
stack traceback:
[C]: in function 'save'
/data/software/torch/install/share/lua/5.1/image/init.lua:176: in function 'saver'
/data/software/torch/install/share/lua/5.1/image/init.lua:442: in function 'save'
./util/visualizer.lua:50: in function 'save_results'
train.lua:96: in function 'save_current_results'
train.lua:154: in main chunk
[C]: in function 'dofile'
[...]/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50

<torch.CudaTensor> is not a string describing a torch object (when gpu=0)

Running DATA_ROOT=./datasets/horse2zebra name=horse2zebra_model gpu=0 cudnn=0 th train.lua on a virtual machine without CUDA results in the following error message:

# DATA_ROOT=./datasets/horse2zebra name=horse2zebra_model gpu=0 cudnn=0 th train.lua
[...]
#training iterations: 200
Epoch: [1][       0 /     1067]  Time: 50.110  DataTime: 0.014  [A] G: 1.4054  D
: 0.8841  Rec: 6.5981 I: -1.0000 || [B] G: 1.0280 D: 0.7510 Rec: 5.2516 I:-1.000
0
/root/torch/install/bin/luajit: /root/torch/install/share/lua/5.1/torch/init.lua
:116: <torch.CudaTensor> is not a string describing a torch object
stack traceback:
        [C]: in function 'error'
        /root/torch/install/share/lua/5.1/torch/init.lua:116: in function 'setdefaulttensortype'
        ./util/visualizer.lua:45: in function 'save_results'
        train.lua:99: in function 'save_current_results'
        train.lua:157: in main chunk
        [C]: in function 'dofile'
        /root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
        [C]: at 0x00406670
root@fe026e4f4713:~/shared/CycleGAN# DATA_ROOT=./datasets/horse2zebra name=horse2zebra_model gpu=0 cudnn=0 th train.lua

This is in Ubuntu 16.04 running inside a VM in Windows 7. (Tested with both a Docker image and VirtualBox, though the DockerToolkit uses VirtualBox in Windows 7, so it might be a VirtualBox issue.)

I recognize that Windows support is likely not one of the first considerations, but my Linux box is currently training a different neural net so I thought I might as well give it a shot.

Pytorch version

Thanks for posting your work!! Just wondering approximately when would the pytorch version be available?

"Could not find any image file" Error when running test.lua

I downloaded the horse2zebra dataset and the horse2zebra pretrained model.

Running "DATA_ROOT=./datasets/horse2zebra name=horse2zebra_pretrained phase=test th test.lua" in the CycleGAN directory gave the below output. I appreciate any help I can get solving this.

------------------- Options -------------------
DATA_ROOT: ./datasets/horse2zebra
align_data: 0
aspect_ratio: 1
batchSize: 1
checkpoints_dir: ./checkpoints
continue_train: 1
cudnn: 1
display: 1
display_id: 200
fineSize: 128
flip: 0
gpu: 1
how_many: all
input_nc: 3
loadSize: 128
model: cycle_gan
nThreads: 1
name: horse2zebra_pretrained
norm: instance
output_nc: 3
phase: test
preprocess: regular
resize_or_crop: resize_and_crop
results_dir: ./results/
serial_batches: 1
test: 1
which_direction: AtoB
which_epoch: latest

GPU Mode
DataLoader UnalignedDataLoader was created.
Starting donkey with id: 1 seed: 8785
table: 0x40ff0d18
table: 0x40fdfb48
running "find" on each class directory, and concatenate all those filenames into a single file containing all image paths for a given class
now combine all the files to a single large file
load the large concatenated list of sample paths to self.imagePath
cmd..wc -L '/tmp/lua_SzUjGM' |cut -f1 -d' '
/home/larry/torch/install/bin/luajit: /home/larry/torch/install/share/lua/5.1/threads/threads.lua:183: [thread 1 callback] /home/larry/Desktop/CycleGAN/data/dataset.lua:216: Could not find any image file in the given input paths
stack traceback:
[C]: in function 'assert'
/home/larry/Desktop/CycleGAN/data/dataset.lua:216: in function '__init'
/home/larry/torch/install/share/lua/5.1/torch/init.lua:91: in function </home/larry/torch/install/share/lua/5.1/torch/init.lua:87>
[C]: in function 'dataLoader'
/home/larry/Desktop/CycleGAN/data/donkey_folder.lua:205: in main chunk
[C]: in function 'dofile'
/home/larry/Desktop/CycleGAN/data/data.lua:39: in function </home/larry/Desktop/CycleGAN/data/data.lua:29>
[C]: in function 'xpcall'
/home/larry/torch/install/share/lua/5.1/threads/threads.lua:234: in function 'callback'
/home/larry/torch/install/share/lua/5.1/threads/queue.lua:65: in function </home/larry/torch/install/share/lua/5.1/threads/queue.lua:41>
[C]: in function 'pcall'
/home/larry/torch/install/share/lua/5.1/threads/queue.lua:40: in function 'dojob'
[string " local Queue = require 'threads.queue'..."]:13: in main chunk
stack traceback:
[C]: in function 'error'
/home/larry/torch/install/share/lua/5.1/threads/threads.lua:183: in function 'dojob'
/home/larry/torch/install/share/lua/5.1/threads/threads.lua:264: in function 'synchronize'
/home/larry/torch/install/share/lua/5.1/threads/threads.lua:142: in function 'specific'
/home/larry/torch/install/share/lua/5.1/threads/threads.lua:125: in function 'Threads'
/home/larry/Desktop/CycleGAN/data/data.lua:27: in function 'new'
/home/larry/Desktop/CycleGAN/data/data_util.lua:17: in function 'load_dataset'
./data/unaligned_data_loader.lua:24: in function 'Initialize'
test.lua:47: in main chunk
[C]: in function 'dofile'
...lice/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50

Error when applying a Pre-trained Model

Hi, I follow 'Apply a Pre-trained Model' steps in readme and run DATA_ROOT=./datasets/ae_photos name=style_cezanne_pretrained model=one_direction_test phase=test loadSize=256 fineSize=256 resize_or_crop="scale_width" th test.lua in GPU mode , then the error happens:

`THCudaCheck FAIL file=/home/whj/torch/extra/cutorch/lib/THC/generic/THCStorage.cu line=66 error=2 : out of memory
/home/whj/torch/install/bin/luajit: /home/whj/torch/install/share/lua/5.1/nn/Container.lua:67:
In 29 module of nn.Sequential:
/home/whj/torch/install/share/lua/5.1/nn/THNN.lua:110: cuda runtime error (2) : out of memory at /home/whj/torch/extra/cutorch/lib/THC/generic/THCStorage.cu:66
stack traceback:
[C]: in function 'v'
/home/whj/torch/install/share/lua/5.1/nn/THNN.lua:110: in function 'SpatialConvolutionMM_updateOutput'
...hj/torch/install/share/lua/5.1/nn/SpatialConvolution.lua:79: in function <...hj/torch/install/share/lua/5.1/nn/SpatialConvolution.lua:76>
[C]: in function 'xpcall'
/home/whj/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
/home/whj/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
./models/one_direction_test_model.lua:44: in function 'Forward'
test.lua:101: in main chunk
[C]: in function 'dofile'
.../whj/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50

WARNING: If you see a stack trace below, it doesn't point to the place where this error occurred. Please use only the one above.
stack traceback:
[C]: in function 'error'
/home/whj/torch/install/share/lua/5.1/nn/Container.lua:67: in function 'rethrowErrors'
/home/whj/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
./models/one_direction_test_model.lua:44: in function 'Forward'
test.lua:101: in main chunk
[C]: in function 'dofile'
.../whj/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50
`

provide minimum nVidia hardware info to reproduce results for each dataset

You state that various CUDA components are required, but you nowhere state in the Readme.md or your paper the minimum GPU hardware requirements to reproduce your results.

i.e.

Minimum Compute Architecture
is it OK to use the lowest that CUDA 7/8 supports, e.g. Fermi (3.5), or do you use FP16 unconditionally and hence require 5.3 or higher ?

Minimum GPU memory
how much on-card memory is required to even load your tutorial datasets ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.