KupynOrest / DeblurGAN

Image Deblurring using Generative Adversarial Networks
Other
2.5k stars 516 forks source link

wgan-gp loss #166

Open dan0910 opened 4 years ago

dan0910 commented 4 years ago

Hi, when I train the code, I set up the opt.gan_type = "wgan-gp" but there goes error, the full text is: ------------ Options ------------- batchSize: 1 beta1: 0.5 checkpoints_dir: ./checkpoints continue_train: False dataroot: D:\Data\ dataset_mode: aligned display_freq: 100 display_id: 0 display_port: 8097 display_single_pane_ncols: 0 display_winsize: 256 epoch_count: 1 fineSize: 256 gan_type: wgan-gp gpu_ids: [0] identity: 0.0 input_nc: 3 isTrain: True lambda_A: 100.0 lambda_B: 10.0 learn_residual: False loadSizeX: 640 loadSizeY: 360 lr: 0.0001 max_dataset_size: inf model: content_gan nThreads: 2 n_layers_D: 3 name: experiment_name ndf: 64 ngf: 64 niter: 150 niter_decay: 150 no_dropout: False no_flip: True no_html: True norm: instance output_nc: 3 phase: train pool_size: 50 print_freq: 100 resize_or_crop: resize_and_crop save_epoch_freq: 5 save_latest_freq: 5000 serial_batches: False which_direction: AtoB which_epoch: latest which_model_netD: basic which_model_netG: resnet_9blocks -------------- End ---------------- Opt.nThreads = 2 dataset [AlignedDataset] was created CustomDatasetDataLoader Use Parallel = False Traceback (most recent call last): File "D:/DeblurGAN-master/train.py", line 73, in model = create_model(opt) File "D:\DeblurGAN-master\models\models.py", line 10, in create_model model = ConditionalGAN(opt) File "D:\DeblurGAN-master\models\conditional_gan_model.py", line 58, in init self.discLoss, self.contentLoss = init_loss(opt, self.Tensor) File "D:\DeblurGAN-master\models\losses.py", line 188, in init_loss disc_loss = DiscLossWGANGP(opt, tensor) File "D:\DeblurGAN-master\models\losses.py", line 132, in init super(DiscLossWGANGP, self).init(opt, tensor) File "D:\DeblurGAN-master\models\losses.py", line 117, in init super(DiscLoss, self).init(opt, tensor) TypeError: object.init() takes no arguments

How can I fix this problem?

AzzerAce commented 4 years ago

Hey, what I did was change this line: https://github.com/KupynOrest/DeblurGAN/blob/31fdc7f83d45e05d0d0a352aa1b8a960e42d618b/models/losses.py#L117

to this line super(DiscLossLS, self).__init__(opt, tensor).

lincchenl commented 4 years ago

Hey, what I did was change this line: https://github.com/KupynOrest/DeblurGAN/blob/31fdc7f83d45e05d0d0a352aa1b8a960e42d618b/models/losses.py#L117

to this line super(DiscLossLS, self).__init__(opt, tensor).

yes grammar error,same for me.