Algolzw / image-restoration-sde

Image Restoration with Mean-Reverting Stochastic Differential Equations, ICML 2023. Winning solution of the NTIRE 2023 Image Shadow Removal Challenge.
https://algolzw.github.io/ir-sde/index.html
MIT License
520 stars 39 forks source link

关于 list index out of range #43

Open zhenghaoyes opened 10 months ago

zhenghaoyes commented 10 months ago

在运行 python3 train.py -opt=options/train/ir-sde.yml,出现 Traceback (most recent call last): File "E:\matlab\image-restoration-sde-main\codes\config\deblurring\train.py", line 319, in main() File "E:\matlab\image-restoration-sde-main\codes\config\deblurring\train.py", line 52, in main opt = option.parse(args.opt, is_train=True) File "E:\matlab\image-restoration-sde-main\codes\config\deblurring\options.py", line 68, in parse config_dir = path.split("/")[-2] IndexError: list index out of range

Algolzw commented 10 months ago

你好,如果你使用windows系统的话需要改一下options.py里面68行的分隔符,如把"/" 改成 “\”

zhenghaoyes commented 10 months ago

感谢您在百忙之中的回复,这次出现的问题是: FileExistsError: [WinError 183] 当文件已存在时,无法创建该文件。: 'E:\matlab\image-restoration-sde-main\experiments\deblurring\ir-sde\..' -> './log' 我把experiments 文件删除后,再次运行代码仍会出现该问题 很抱歉,因为这是我第一次尝试复现别人的代码,所以问题会有点多。

Algolzw commented 10 months ago

可能还需要在deblurring主目录下删除log文件夹,这是个从experiments里过来的软连接。

zhenghaoyes commented 10 months ago

抱歉再次打扰您,模型训练完成后,在测试阶段,遇到以下问题,请问改怎么解决? size mismatch for init_conv.weight: copying a param with shape torch.Size([32, 6, 7, 7]) from checkpoint, the shape in current model is torch.Size([64, 6, 7, 7]). size mismatch for time_mlp.1.weight: copying a param with shape torch.Size([128, 32]) from checkpoint, the shape in current model is torch.Size([256, 64]). size mismatch for time_mlp.1.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]). size mismatch for time_mlp.3.weight: copying a param with shape torch.Size([128, 128]) from checkpoint, the shape in current model is torch.Size([256, 256]). size mismatch for time_mlp.3.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]). size mismatch for downs.0.0.mlp.1.weight: copying a param with shape torch.Size([64, 128]) from checkpoint, the shape in current model is torch.Size([128, 256]). size mismatch for downs.0.0.mlp.1.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for downs.0.0.block1.proj.weight: copying a param with shape torch.Size([32, 32, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 64, 3, 3]). size mismatch for downs.0.0.block2.proj.weight: copying a param with shape torch.Size([32, 32, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 64, 3, 3]). size mismatch for downs.0.1.mlp.1.weight: copying a param with shape torch.Size([64, 128]) from checkpoint, the shape in current model is torch.Size([128, 256]). size mismatch for downs.0.1.mlp.1.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for downs.0.1.block1.proj.weight: copying a param with shape torch.Size([32, 32, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 64, 3, 3]). size mismatch for downs.0.1.block2.proj.weight: copying a param with shape torch.Size([32, 32, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 64, 3, 3]). size mismatch for downs.0.2.fn.fn.to_qkv.weight: copying a param with shape torch.Size([384, 32, 1, 1]) from checkpoint, the shape in current model is torch.Size([384, 64, 1, 1]). size mismatch for downs.0.2.fn.fn.to_out.0.weight: copying a param with shape torch.Size([32, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([64, 128, 1, 1]). size mismatch for downs.0.2.fn.fn.to_out.0.bias: copying a param with shape torch.Size([32]) from checkpoint, the shape in current model is torch.Size([64]). size mismatch for downs.0.2.fn.fn.to_out.1.g: copying a param with shape torch.Size([1, 32, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 64, 1, 1]). size mismatch for downs.0.2.fn.norm.g: copying a param with shape torch.Size([1, 32, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 64, 1, 1]). size mismatch for downs.0.3.weight: copying a param with shape torch.Size([64, 32, 4, 4]) from checkpoint, the shape in current model is torch.Size([128, 64, 4, 4]). size mismatch for downs.0.3.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for downs.1.0.mlp.1.weight: copying a param with shape torch.Size([128, 128]) from checkpoint, the shape in current model is torch.Size([256, 256]). size mismatch for downs.1.0.mlp.1.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]). size mismatch for downs.1.0.block1.proj.weight: copying a param with shape torch.Size([64, 64, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for downs.1.0.block2.proj.weight: copying a param with shape torch.Size([64, 64, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for downs.1.1.mlp.1.weight: copying a param with shape torch.Size([128, 128]) from checkpoint, the shape in current model is torch.Size([256, 256]). size mismatch for downs.1.1.mlp.1.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]). size mismatch for downs.1.1.block1.proj.weight: copying a param with shape torch.Size([64, 64, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for downs.1.1.block2.proj.weight: copying a param with shape torch.Size([64, 64, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 128, 3, 3]). size mismatch for downs.1.2.fn.fn.to_qkv.weight: copying a param with shape torch.Size([384, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([384, 128, 1, 1]). size mismatch for downs.1.2.fn.fn.to_out.0.weight: copying a param with shape torch.Size([64, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([128, 128, 1, 1]). size mismatch for downs.1.2.fn.fn.to_out.0.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for downs.1.2.fn.fn.to_out.1.g: copying a param with shape torch.Size([1, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 128, 1, 1]). size mismatch for downs.1.2.fn.norm.g: copying a param with shape torch.Size([1, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 128, 1, 1]). size mismatch for downs.1.3.weight: copying a param with shape torch.Size([128, 64, 4, 4]) from checkpoint, the shape in current model is torch.Size([256, 128, 4, 4]). size mismatch for downs.1.3.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]). size mismatch for downs.2.0.mlp.1.weight: copying a param with shape torch.Size([256, 128]) from checkpoint, the shape in current model is torch.Size([512, 256]). size mismatch for downs.2.0.mlp.1.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for downs.2.0.block1.proj.weight: copying a param with shape torch.Size([128, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]). size mismatch for downs.2.0.block2.proj.weight: copying a param with shape torch.Size([128, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]). size mismatch for downs.2.1.mlp.1.weight: copying a param with shape torch.Size([256, 128]) from checkpoint, the shape in current model is torch.Size([512, 256]). size mismatch for downs.2.1.mlp.1.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for downs.2.1.block1.proj.weight: copying a param with shape torch.Size([128, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]). size mismatch for downs.2.1.block2.proj.weight: copying a param with shape torch.Size([128, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]). size mismatch for downs.2.2.fn.fn.to_qkv.weight: copying a param with shape torch.Size([384, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([384, 256, 1, 1]). size mismatch for downs.2.2.fn.fn.to_out.0.weight: copying a param with shape torch.Size([128, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 128, 1, 1]). size mismatch for downs.2.2.fn.fn.to_out.0.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]). size mismatch for downs.2.2.fn.fn.to_out.1.g: copying a param with shape torch.Size([1, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 256, 1, 1]). size mismatch for downs.2.2.fn.norm.g: copying a param with shape torch.Size([1, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 256, 1, 1]). size mismatch for downs.2.3.weight: copying a param with shape torch.Size([256, 128, 4, 4]) from checkpoint, the shape in current model is torch.Size([512, 256, 4, 4]). size mismatch for downs.2.3.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for downs.3.0.mlp.1.weight: copying a param with shape torch.Size([512, 128]) from checkpoint, the shape in current model is torch.Size([1024, 256]). size mismatch for downs.3.0.mlp.1.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([1024]). size mismatch for downs.3.0.block1.proj.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]). size mismatch for downs.3.0.block2.proj.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]). size mismatch for downs.3.1.mlp.1.weight: copying a param with shape torch.Size([512, 128]) from checkpoint, the shape in current model is torch.Size([1024, 256]). size mismatch for downs.3.1.mlp.1.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([1024]). size mismatch for downs.3.1.block1.proj.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]). size mismatch for downs.3.1.block2.proj.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]). size mismatch for downs.3.2.fn.fn.to_qkv.weight: copying a param with shape torch.Size([384, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([384, 512, 1, 1]). size mismatch for downs.3.2.fn.fn.to_out.0.weight: copying a param with shape torch.Size([256, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 128, 1, 1]). size mismatch for downs.3.2.fn.fn.to_out.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for downs.3.2.fn.fn.to_out.1.g: copying a param with shape torch.Size([1, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 512, 1, 1]). size mismatch for downs.3.2.fn.norm.g: copying a param with shape torch.Size([1, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 512, 1, 1]). size mismatch for downs.3.3.weight: copying a param with shape torch.Size([512, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([1024, 512, 3, 3]). size mismatch for ups.0.0.mlp.1.weight: copying a param with shape torch.Size([1024, 128]) from checkpoint, the shape in current model is torch.Size([2048, 256]). size mismatch for ups.0.0.mlp.1.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([2048]). size mismatch for ups.0.0.block1.proj.weight: copying a param with shape torch.Size([512, 768, 3, 3]) from checkpoint, the shape in current model is torch.Size([1024, 1536, 3, 3]). size mismatch for ups.0.0.block2.proj.weight: copying a param with shape torch.Size([512, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([1024, 1024, 3, 3]). size mismatch for ups.0.0.res_conv.weight: copying a param with shape torch.Size([512, 768, 1, 1]) from checkpoint, the shape in current model is torch.Size([1024, 1536, 1, 1]). size mismatch for ups.0.1.mlp.1.weight: copying a param with shape torch.Size([1024, 128]) from checkpoint, the shape in current model is torch.Size([2048, 256]). size mismatch for ups.0.1.mlp.1.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([2048]). size mismatch for ups.0.1.block1.proj.weight: copying a param with shape torch.Size([512, 768, 3, 3]) from checkpoint, the shape in current model is torch.Size([1024, 1536, 3, 3]). size mismatch for ups.0.1.block2.proj.weight: copying a param with shape torch.Size([512, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([1024, 1024, 3, 3]). size mismatch for ups.0.1.res_conv.weight: copying a param with shape torch.Size([512, 768, 1, 1]) from checkpoint, the shape in current model is torch.Size([1024, 1536, 1, 1]). size mismatch for ups.0.2.fn.fn.to_qkv.weight: copying a param with shape torch.Size([384, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([384, 1024, 1, 1]). size mismatch for ups.0.2.fn.fn.to_out.0.weight: copying a param with shape torch.Size([512, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([1024, 128, 1, 1]). size mismatch for ups.0.2.fn.fn.to_out.0.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([1024]). size mismatch for ups.0.2.fn.fn.to_out.1.g: copying a param with shape torch.Size([1, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1024, 1, 1]). size mismatch for ups.0.2.fn.norm.g: copying a param with shape torch.Size([1, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 1024, 1, 1]). size mismatch for ups.0.3.1.weight: copying a param with shape torch.Size([256, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 1024, 3, 3]). size mismatch for ups.0.3.1.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]). size mismatch for ups.1.0.mlp.1.weight: copying a param with shape torch.Size([512, 128]) from checkpoint, the shape in current model is torch.Size([1024, 256]). size mismatch for ups.1.0.mlp.1.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([1024]). size mismatch for ups.1.0.block1.proj.weight: copying a param with shape torch.Size([256, 384, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 768, 3, 3]). size mismatch for ups.1.0.block2.proj.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]). size mismatch for ups.1.0.res_conv.weight: copying a param with shape torch.Size([256, 384, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 768, 1, 1]). size mismatch for ups.1.1.mlp.1.weight: copying a param with shape torch.Size([512, 128]) from checkpoint, the shape in current model is torch.Size([1024, 256]). size mismatch for ups.1.1.mlp.1.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([1024]). size mismatch for ups.1.1.block1.proj.weight: copying a param with shape torch.Size([256, 384, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 768, 3, 3]). size mismatch for ups.1.1.block2.proj.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]). size mismatch for ups.1.1.res_conv.weight: copying a param with shape torch.Size([256, 384, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 768, 1, 1]). size mismatch for ups.1.2.fn.fn.to_qkv.weight: copying a param with shape torch.Size([384, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([384, 512, 1, 1]). size mismatch for ups.1.2.fn.fn.to_out.0.weight: copying a param with shape torch.Size([256, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([512, 128, 1, 1]). size mismatch for ups.1.2.fn.fn.to_out.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).

Algolzw commented 10 months ago

测试时模型setting和训练的不一致,你可以修改test.yml中的模型设置(看起来nf应该是32)。

Bulinglife commented 8 months ago

您好,我想请问一下您复现成功了吗,我也遇到了同样的问题

Bulinglife commented 8 months ago

解决办法可以将“/”变为“\”(两条斜线)