BDL icon indicating copy to clipboard operation
BDL copied to clipboard

Inconsistency fix from CycleGan repository

Open Nadavc220 opened this issue 3 years ago • 1 comments

First of all, thanks for this contribution.

As some may have noticed, there is some inconsistency between the BDL repository and the CycleGAN repository which has updated since it was used by BDL. thus some code and params on the BDL repository needs an update as well. This fixes are based on the history of the CycleGAN repository. I hope I did not miss anything. If anyone notices something wrong or anything I missed please comment this issue.

Param name updates: (old -> new) (fix: change the name on the provided script on BDL/cyclegan/readme.md)

  1. resize_or_crop -> preprocess
  2. niter -> n_epoches
  3. niter_decay -> n_epoches_decay
  4. loadSize -> load_size
  5. fineSize -> crop_size (also change al opt.fineSize calls to opt.crop_size in the given cycle_gan_model.py file)
  6. batchSize -> batch_size

Params more complex updates:

  1. lr_policy: this parameter default was changed to 'linear' from 'lambda'. change the default back to 'lambda'. If you wish you can copy the linear policy implementation from the cycleGAN repository networks.py file to the given networks.py.

  2. which_direction parameter was chenged to direction. go to the given cycle_gan_model.py file and change all opt.which_direction usages to opt.direction.

  3. which_model_netG, and which_model_netD where changed to 'netG' and 'netD'. go to the given cycle_gan_model.py file and change all which_model_netG and which_model_netD usages to netG and netD.

  4. no_lsgan parameter was changed to gan_mode and its type changed from bool to str which indicates the wanted gan mode. a previous issue posted raised this issue and the repository owner commented that the no_lsgan param should be False at default. since this parameter was not changed in the given run command (BDL/cyclegan/readme.md) we can indicate that we want to use the lsgan and the gan_mode parameter is set to "lsgan" as default so were good. all left to do is change two lines in the given cycle_gan_model.py file: (#line num: old -> new) 62: use_sigmoid = opt.no_lsgan -> use_sigmoid = opt.gan_mode != 'lsgan' 74: self.criterionGAN = networks.GANLoss(use_lsgan=not opt.no_lsgan).to(self.device) -> self.criterionGAN = networks.GANLoss(use_lsgan=opt.gan_mode == 'lsgan').to(self.device)

Additional Problems:

  1. CycleGANModel has a method called Initialize(). this may have been used as an _ init _ function in the past in the original CycleGAN repository but this is not true anymore. change the name of Initialize to a proper init function ( _ _init _ _(self, opt)) and change the call for the Base model constructor on line 28 from BaseModel.Initialize(opt) to BaseModel. _ _ init _ _(self, opt)

Nadavc220 avatar Nov 29 '20 11:11 Nadavc220

Thanks so much for your hard work. I do not realize the update of CycleGAN when I released the code. I will upload all my CycleGAN code later.

liyunsheng13 avatar Dec 07 '20 01:12 liyunsheng13