junyanz / pytorch-CycleGAN-and-pix2pix

Image-to-Image Translation in PyTorch
Other
22.96k stars 6.31k forks source link

regarding conversion problem as discussed.(till 27 epochs) #721

Open nehaleosharma opened 5 years ago

nehaleosharma commented 5 years ago

D drive pytorch-CycleGAN-and-pix2pix-master(download or cloned from github) inside it : in dataset there horse2zebra dataset has subfolder: testA, testB, trainA, trainB script: on anaconda prompt:(conversion_1 is just name given)

  1. (cyclegan) D:\pytorch-CycleGAN-and-pix2pix-master>python train.py --dataroot ./datasets/horse2zebra --name conversion_1 --model cycle_gan
  2. (cyclegan) D:\pytorch-CycleGAN-and-pix2pix-master>python test.py --dataroot ./datasets/horse2zebra --name conversion_1 --model cycle_gan
junyanz commented 5 years ago

The model needs to be trained for 200 epochs.

nehaleosharma commented 5 years ago

Good Morning Sir As discussed I have trained the model with 200 epochs with the above written training script. But, did not get the result.I am astonished what I am doing wrong.Does this require any changes in code which i am missing. trainA, trainB are having 1064(horses) and 1334 (zebra) images respectively. testA having 120(horses) and testB 140(zebra) images respectively.

  1. epoch200
  2. NO CONVERSION Kindly guide me.what is wrong ?

and most importantly Thanks for replying every query so frequently.Looking forward for your reply. Thanks

taesungp commented 5 years ago

Hi @nehaleosharma , did you modify any code, or is it directly running the training command from the unmodified code?

Also, do you get this kind of NO CONVERSION result for all input images? It's natural that CycleGAN cannot translate a few images when there is identity loss.

nehaleosharma commented 5 years ago

Firstly, I tried without any modification in code but not complete till 200 epochs (it was till maximum 37epochs) .I tried facade dataset it works as shown in original paper. secondly tried with two modification as mentioned below:

  1. Separate learning rate for G and D with below line by adding new parser.add_argument and lrD with 0.0001 and lr G with 0.0002(in train-options.py) parser.add_argument('--lr', type=float, default=0.0002, help='initial learning rate for adam')
  2. adding wgan-gp after loss_D_fake = self.criterionGAN(pred_fake, False) (in cyclegan.py) completely 200 epochs image size 256*256
  3. Yes , conversion did not take place in any single image.
junyanz commented 5 years ago

Please use the original (and the latest) code and train the models for 200 epochs. We haven't tested wgan-gp and different learning rates. If you want bigger changes, you can use --lambda_identity 0 as used in the paper for horse2zebra.

nehaleosharma commented 5 years ago

Good morning Sir, Referenced to previous conversation on horse2zebra conversion. I have completed 200 epochs and attached the screen shot of conversion in both directions(2files) It was learning and good experience .Forward conversion is good but the conversion from zebra2horse is not good in any image .kindly guide what could be reason for that. horse2zebra zebra2horse Thanks

junyanz commented 5 years ago

The zebra2horse's results are worse than horse2zebra's results, as sometimes, the generator has to preserve some zebra stripes in the generated horse images so that later it can reconstruct the original zebra images. This is one of the limitations of CycleGAN. See this work for more details.