DCPDN icon indicating copy to clipboard operation
DCPDN copied to clipboard

train error /KeyError: 'module name can\'t contain ".", got: layer2.leakyrelu'

Open gyx-tail opened this issue 2 years ago • 3 comments

When I run the train.py,show this Traceback (most recent call last): File "train.py", line 118, in netG = net.dehaze(inputChannelSize, outputChannelSize, ngf) File "/mnt/e/PycharmProject/DCPDN-master/models/dehaze22.py", line 665, in init self.tran_est=G(input_nc=3,output_nc=3, nf=64) File "/mnt/e/PycharmProject/DCPDN-master/models/dehaze22.py", line 216, in init layer2 = blockUNet(nf, nf*2, name, transposed=False, bn=True, relu=False, dropout=False) File "/mnt/e/PycharmProject/DCPDN-master/models/dehaze22.py", line 56, in blockUNet block.add_module('%s.leakyrelu' % name, nn.LeakyReLU(0.2, inplace=True)) File "/home/gyx1999/anaconda3/envs/pytorchgpu/lib/python3.8/site-packages/torch/nn/modules/module.py", line 380, in add_module raise KeyError("module name can't contain ".", got: {}".format(name)) KeyError: 'module name can't contain ".", got: layer2.leakyrelu' How can I solve this problem

gyx-tail avatar Oct 12 '22 14:10 gyx-tail

请问你解决了吗 我也遇到了这样的问题

DMNQYQ avatar Apr 11 '23 12:04 DMNQYQ

请问你解决了吗 我也遇到了这样的问题

dahaze22中,block module 把里面的参数%d后面的点删掉就行,

yogurtbuddy avatar Oct 13 '23 12:10 yogurtbuddy