TaoHuang2018 / Neighbor2Neighbor

Neighbor2Neighbor: Self-Supervised Denoising from Single Noisy Images
BSD 3-Clause "New" or "Revised" License
244 stars 37 forks source link

Training script throws error. #21

Open shankerabhigyan opened 6 months ago

shankerabhigyan commented 6 months ago

Following is the error I get after following the steps and executing the training script. Haven't gone through the script yet, any clues to what the issue might be?

Traceback (most recent call last): File "train.py", line 378, in noisy_denoised = network(noisy) File "/home/abhigyan2/env1/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, kwargs) File "/home/abhigyan2/flcp/Neighbor2Neighbor/arch_unet.py", line 206, in forward x = self.up5(x, pool4) File "/home/abhigyan2/env1/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, *kwargs) File "/home/abhigyan2/flcp/Neighbor2Neighbor/arch_unet.py", line 43, in forward x1 = self.deconv(x1) File "/home/abhigyan2/env1/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(input, kwargs) File "/home/abhigyan2/env1/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 916, in forward return F.conv_transpose2d( TypeError: conv_transpose2d(): argument 'output_padding' (position 6) must be tuple of ints, not tuple

ErfanMo77 commented 4 months ago

In the member function init of class UpsampleCat (arc_unet.py) you have to change the last parameter in nn.ConvTranspose2d from False to 0.

class UpsampleCat(nn.Module):
    def __init__(self, in_nc, out_nc):
        super(UpsampleCat, self).__init__()
        self.in_nc = in_nc
        self.out_nc = out_nc

        self.deconv = nn.ConvTranspose2d(in_nc, out_nc, 2, 2, 0, 0)
        initialize_weights(self.deconv, 0.1)

that fixed it for me.