跑DID-MDN代码遇到的问题

《Density-aware Single Image De-raining using a Multi-stream Dense Network》
我的环境:win10,python3.6,pytorch1.2.0

1.

ImportError: bad magic number in 'myutils': b'\x03\xf3\r\n'

解决办法:

删除myutils文件夹中的.pyc文件

2.

ModuleNotFoundError: No module named 'torch.utils.serialization'

因为新版torch中删掉了load_lua

解决办法:

安装torchfile:pip install torchfile(虚拟环境中请使用conda install torchfile)

将utils.py第7行中的from torch.utils.serialization import load_lua改为import torchfile,

将utils.py第90行中的load_lua改为torchfile.load

3.

RuntimeError: DataLoader worker (pid(s) 10740) exited unexpectedly

解决办法:

test.py中57行:parser.add_argument('--workers', type=int, help='number of data loading workers', default=1)

default=1改为default=0
(Windows系统中num_workers>0时会出现bug,所以只能设置为0)

4.

  File "D:\1AA\DID_MDN\models\derain_dense.py", line 484, in forward
    label_d11.data.resize_((1, 8, sizePatchGAN, sizePatchGAN)).fill_(label_result)
RuntimeError: set_sizes_contiguous is not allowed on a Tensor created from .data or .detach().
If your intent is to change the metadata of a Tensor (such as sizes / strides / storage / storage_offset)
without autograd tracking the change, remove the .data / .detach() call and wrap the change in a `with torch.no_grad():` block.
For example, change:
    x.data.set_(y)
to:
    with torch.no_grad():
        x.set_(y)

解决办法:

将derain_residual.py和derain_dense.py中的:label_d11.data.resize_改为:label_d11.resize_

两个文件中大概有三处,代码具体位置我记不太清楚了,可以根据报错提示查找

Reference:
https://blog.csdn.net/kent_xyli/article/details/89187558

  • 8
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值