kkjishnu / Image-Dehazing-with-GAN

A pytorch implementation of Cycle-Dehaze
38 stars 8 forks source link

Your code is not working #3

Open Scienceseb opened 4 years ago

Scienceseb commented 4 years ago

I got that error while running your code...

/home/seb/anaconda3/envs/radar/lib/python3.6/site-packages/requests/init.py:91: RequestsDependencyWarning: urllib3 (1.25) or chardet (3.0.4) doesn't match a supported version! RequestsDependencyWarning) Namespace(batchSize=1, cuda=False, dataroot='datasets/Haze2Dehaze/', decay_epoch=100, epoch=0, input_nc=3, lr=0.0002, n_cpu=0, n_epochs=200, outputnc=3, size=256) /media/seb/SSD2/master/Image-Dehazing-with-GAN/utils.py:150: UserWarning: nn.init.normal is now deprecated in favor of nn.init.normal. torch.nn.init.normal(m.weight.data, 0.0, 0.02) WARNING:root:Setting up a new session... /home/seb/anaconda3/envs/radar/lib/python3.6/site-packages/torch/nn/modules/loss.py:431: UserWarning: Using a target size (torch.Size([1])) that is different to the input size (torch.Size([1, 1])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size. return F.mse_loss(input, target, reduction=self.reduction) /home/seb/anaconda3/envs/radar/lib/python3.6/site-packages/torch/nn/modules/loss.py:88: UserWarning: Using a target size (torch.Size([1, 3, 256, 256])) that is different to the input size (torch.Size([1, 3, 16, 16])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size. return F.l1_loss(input, target, reduction=self.reduction) Traceback (most recent call last): File "/media/seb/SSD2/master/Image-Dehazing-with-GAN/train.py", line 152, in loss_cycle_ABA = criterion_cycle(recovered_A, real_A)10.0 File "/home/seb/anaconda3/envs/radar/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(input, **kwargs) File "/home/seb/anaconda3/envs/radar/lib/python3.6/site-packages/torch/nn/modules/loss.py", line 88, in forward return F.l1_loss(input, target, reduction=self.reduction) File "/home/seb/anaconda3/envs/radar/lib/python3.6/site-packages/torch/nn/functional.py", line 2164, in l1_loss expanded_input, expanded_target = torch.broadcast_tensors(input, target) File "/home/seb/anaconda3/envs/radar/lib/python3.6/site-packages/torch/functional.py", line 53, in broadcast_tensors return torch._C._VariableFunctions.broadcast_tensors(tensors) RuntimeError: The size of tensor a (16) must match the size of tensor b (256) at non-singleton dimension 3

ForeverPs commented 3 years ago

image you should perform the convtranspose 4 times and change the input channels of the following conv2d into 16, then the network works well. Good Luck.