ming053l / DRCT

Accepted by New Trends in Image Restoration and Enhancement workshop (NTIRE), in conjunction with CVPR 2024.
MIT License
181 stars 13 forks source link

real world model inference #16

Closed Limingxing00 closed 4 months ago

Limingxing00 commented 4 months ago

Hi,

Thank you for the good job.

I meet a problem when I use this model.

image

I want to test real world image on my own dataset without GT.

 python inference.py --input output/test_img --output output/test_img_x4 --model_path "pretrain/net_g_latest (MSEModel).pth"

But it has an error. How to implement my work?

  File "inference.py", line 37, in main
    model.load_state_dict(torch.load(args.model_path)['params'], strict=True)
  File "/home/limingxing.lmx/workspace/miniconda3/envs/drct/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1604, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for DRCT:
        Missing key(s) in state_dict: "layers.6.swin1.norm1.weight", "layers.6.swin1.norm1.bias", "layers.6.swin1.attn.relative_position_bias_table", "layers.6.swin1.attn.relative_position_index", "layers.6.swin1.attn.qkv.weight", "layers.6.swin1.attn.qkv.bias", "layers.6.swin1.attn.proj.weight", "layers.6.swin1.attn.proj.bias", "layers.6.swin1.norm2.weight", "layers.6.swin1.norm2.bias", "layers.6.swin1.mlp.fc1.weight", "layers.6.swin1.mlp.fc1.bias", "layers.6.swin1.mlp.fc2.weight", "layers.6.swin1.mlp.fc2.bias", "layers.6.adjust1.weight", "layers.6.adjust1.bias", "layers.6.swin2.attn_mask", "layers.6.swin2.norm1.weight", "layers.6.swin2.norm1.bias", "layers.6.swin2.attn.relative_position_bias_table", "layers.6.swin2.attn.relative_position_index", "layers.6.swin2.attn.qkv.weight", "layers.6.swin2.attn.qkv.bias", "layers.6.swin2.attn.proj.weight", "layers.6.swin2.attn.proj.bias", "layers.6.swin2.norm2.weight", "layers.6.swin2.norm2.bias", "layers.6.swin2.mlp.fc1.weight", "layers.6.swin2.mlp.fc1.bias", "layers.6.swin2.mlp.fc2.weight", "layers.6.swin2.mlp.fc2.bias", "layers.6.adjust2.weight", "layers.6.adjust2.bias", "layers.6.swin3.norm1.weight", "layers.6.swin3.norm1.bias", "layers.6.swin3.attn.relative_position_bias_table", "layers.6.swin3.attn.relative_position_index", "layers.6.swin3.attn.qkv.weight", "layers.6.swin3.attn.qkv.bias", "layers.6.swin3.attn.proj.weight", "layers.6.swin3.attn.proj.bias", "layers.6.swin3.norm2.weight", "layers.6.swin3.norm2.bias", "layers.6.swin3.mlp.fc1.weight", "layers.6.swin3.mlp.fc1.bias", "layers.6.swin3.mlp.fc2.weight", "layers.6.swin3.mlp.fc2.bias", "layers.6.adjust3.weight", "layers.6.adjust3.bias", "layers.6.swin4.attn_mask", "layers.6.swin4.norm1.weight", "layers.6.swin4.norm1.bias", "layers.6.swin4.attn.relative_position_bias_table", "layers.6.swin4.attn.relative_position_index", "layers.6.swin4.attn.qkv.weight", "layers.6.swin4.attn.qkv.bias", "layers.6.swin4.attn.proj.weight", "layers.6.swin4.attn.proj.bias", "layers.6.swin4.norm2.weight", "layers.6.swin4.norm2.bias", "layers.6.swin4.mlp.fc1.weight", "layers.6.swin4.mlp.fc1.bias", "layers.6.swin4.mlp.fc2.weight", "layers.6.swin4.mlp.fc2.bias", "layers.6.adjust4.weight", "layers.6.adjust4.bias", "layers.6.swin5.norm1.weight", "layers.6.swin5.norm1.bias", "layers.6.swin5.attn.relative_position_bias_table", "layers.6.swin5.attn.relative_position_index", "layers.6.swin5.attn.qkv.weight", "layers.6.swin5.attn.qkv.bias", "layers.6.swin5.attn.proj.weight", "layers.6.swin5.attn.proj.bias", "layers.6.swin5.norm2.weight", "layers.6.swin5.norm2.bias", "layers.6.swin5.mlp.fc1.weight", "layers.6.swin5.mlp.fc1.bias", "layers.6.swin5.mlp.fc2.weight", "layers.6.swin5.mlp.fc2.bias", "layers.6.adjust5.weight", "layers.6.adjust5.bias", "layers.7.swin1.norm1.weight", "layers.7.swin1.norm1.bias", "layers.7.swin1.attn.relative_position_bias_table", "layers.7.swin1.attn.relative_position_index", "layers.7.swin1.attn.qkv.weight", "layers.7.swin1.attn.qkv.bias", "layers.7.swin1.attn.proj.weight", "layers.7.swin1.attn.proj.bias", "layers.7.swin1.norm2.weight", "layers.7.swin1.norm2.bias", "layers.7.swin1.mlp.fc1.weight", "layers.7.swin1.mlp.fc1.bias", "layers.7.swin1.mlp.fc2.weight", "layers.7.swin1.mlp.fc2.bias", "layers.7.adjust1.weight", "layers.7.adjust1.bias", "layers.7.swin2.attn_mask", "layers.7.swin2.norm1.weight", "layers.7.swin2.norm1.bias", "layers.7.swin2.attn.relative_position_bias_table", "layers.7.swin2.attn.relative_position_index", "layers.7.swin2.attn.qkv.weight", "layers.7.swin2.attn.qkv.bias", "layers.7.swin2.attn.proj.weight", "layers.7.swin2.attn.proj.bias", "layers.7.swin2.norm2.weight", "layers.7.swin2.norm2.bias", "layers.7.swin2.mlp.fc1.weight", "layers.7.swin2.mlp.fc1.bias", "layers.7.swin2.mlp.fc2.weight", "layers.7.swin2.mlp.fc2.bias", "layers.7.adjust2.weight", "layers.7.adjust2.bias", "layers.7.swin3.norm1.weight", "layers.7.swin3.norm1.bias", "layers.7.swin3.attn.relative_position_bias_table", "layers.7.swin3.attn.relative_position_index", "layers.7.swin3.attn.qkv.weight", "layers.7.swin3.attn.qkv.bias", "layers.7.swin3.attn.proj.weight", "layers.7.swin3.attn.proj.bias", "layers.7.swin3.norm2.weight", "layers.7.swin3.norm2.bias", "layers.7.swin3.mlp.fc1.weight", "layers.7.swin3.mlp.fc1.bias", "layers.7.swin3.mlp.fc2.weight", "layers.7.swin3.mlp.fc2.bias", "layers.7.adjust3.weight", "layers.7.adjust3.bias", "layers.7.swin4.attn_mask", "layers.7.swin4.norm1.weight", "layers.7.swin4.norm1.bias", "layers.7.swin4.attn.relative_position_bias_table", "layers.7.swin4.attn.relative_position_index", "layers.7.swin4.attn.qkv.weight", "layers.7.swin4.attn.qkv.bias", "layers.7.swin4.attn.proj.weight", "layers.7.swin4.attn.proj.bias", "layers.7.swin4.norm2.weight", "layers.7.swin4.norm2.bias", "layers.7.swin4.mlp.fc1.weight", "layers.7.swin4.mlp.fc1.bias", "layers.7.swin4.mlp.fc2.weight", "layers.7.swin4.mlp.fc2.bias", "layers.7.adjust4.weight", "layers.7.adjust4.bias", "layers.7.swin5.norm1.weight", "layers.7.swin5.norm1.bias", "layers.7.swin5.attn.relative_position_bias_table", "layers.7.swin5.attn.relative_position_index", "layers.7.swin5.attn.qkv.weight", "layers.7.swin5.attn.qkv.bias", "layers.7.swin5.attn.proj.weight", "layers.7.swin5.attn.proj.bias", "layers.7.swin5.norm2.weight", "layers.7.swin5.norm2.bias", "layers.7.swin5.mlp.fc1.weight", "layers.7.swin5.mlp.fc1.bias", "layers.7.swin5.mlp.fc2.weight", "layers.7.swin5.mlp.fc2.bias", "layers.7.adjust5.weight", "layers.7.adjust5.bias", "layers.8.swin1.norm1.weight", "layers.8.swin1.norm1.bias", "layers.8.swin1.attn.relative_position_bias_table", "layers.8.swin1.attn.relative_position_index", "layers.8.swin1.attn.qkv.weight", "layers.8.swin1.attn.qkv.bias", "layers.8.swin1.attn.proj.weight", "layers.8.swin1.attn.proj.bias", "layers.8.swin1.norm2.weight", "layers.8.swin1.norm2.bias", "layers.8.swin1.mlp.fc1.weight", "layers.8.swin1.mlp.fc1.bias", "layers.8.swin1.mlp.fc2.weight", "layers.8.swin1.mlp.fc2.bias", "layers.8.adjust1.weight", "layers.8.adjust1.bias", "layers.8.swin2.attn_mask", "layers.8.swin2.norm1.weight", "layers.8.swin2.norm1.bias", "layers.8.swin2.attn.relative_position_bias_table", "layers.8.swin2.attn.relative_position_index", "layers.8.swin2.attn.qkv.weight", "layers.8.swin2.attn.qkv.bias", "layers.8.swin2.attn.proj.weight", "layers.8.swin2.attn.proj.bias", "layers.8.swin2.norm2.weight", "layers.8.swin2.norm2.bias", "layers.8.swin2.mlp.fc1.weight", "layers.8.swin2.mlp.fc1.bias", "layers.8.swin2.mlp.fc2.weight", "layers.8.swin2.mlp.fc2.bias", "layers.8.adjust2.weight", "layers.8.adjust2.bias", "layers.8.swin3.norm1.weight", "layers.8.swin3.norm1.bias", "layers.8.swin3.attn.relative_position_bias_table", "layers.8.swin3.attn.relative_position_index", "layers.8.swin3.attn.qkv.weight", "layers.8.swin3.attn.qkv.bias", "layers.8.swin3.attn.proj.weight", "layers.8.swin3.attn.proj.bias", "layers.8.swin3.norm2.weight", "layers.8.swin3.norm2.bias", "layers.8.swin3.mlp.fc1.weight", "layers.8.swin3.mlp.fc1.bias", "layers.8.swin3.mlp.fc2.weight", "layers.8.swin3.mlp.fc2.bias", "layers.8.adjust3.weight", "layers.8.adjust3.bias", "layers.8.swin4.attn_mask", "layers.8.swin4.norm1.weight", "layers.8.swin4.norm1.bias", "layers.8.swin4.attn.relative_position_bias_table", "layers.8.swin4.attn.relative_position_index", "layers.8.swin4.attn.qkv.weight", "layers.8.swin4.attn.qkv.bias", "layers.8.swin4.attn.proj.weight", "layers.8.swin4.attn.proj.bias", "layers.8.swin4.norm2.weight", "layers.8.swin4.norm2.bias", "layers.8.swin4.mlp.fc1.weight", "layers.8.swin4.mlp.fc1.bias", "layers.8.swin4.mlp.fc2.weight", "layers.8.swin4.mlp.fc2.bias", "layers.8.adjust4.weight", "layers.8.adjust4.bias", "layers.8.swin5.norm1.weight", "layers.8.swin5.norm1.bias", "layers.8.swin5.attn.relative_position_bias_table", "layers.8.swin5.attn.relative_position_index", "layers.8.swin5.attn.qkv.weight", "layers.8.swin5.attn.qkv.bias", "layers.8.swin5.attn.proj.weight", "layers.8.swin5.attn.proj.bias", "layers.8.swin5.norm2.weight", "layers.8.swin5.norm2.bias", "layers.8.swin5.mlp.fc1.weight", "layers.8.swin5.mlp.fc1.bias", "layers.8.swin5.mlp.fc2.weight", "layers.8.swin5.mlp.fc2.bias", "layers.8.adjust5.weight", "layers.8.adjust5.bias", "layers.9.swin1.norm1.weight", "layers.9.swin1.norm1.bias", "layers.9.swin1.attn.relative_position_bias_table", "layers.9.swin1.attn.relative_position_index", "layers.9.swin1.attn.qkv.weight", "layers.9.swin1.attn.qkv.bias", "layers.9.swin1.attn.proj.weight", "layers.9.swin1.attn.proj.bias", "layers.9.swin1.norm2.weight", "layers.9.swin1.norm2.bias", "layers.9.swin1.mlp.fc1.weight", "layers.9.swin1.mlp.fc1.bias", "layers.9.swin1.mlp.fc2.weight", "layers.9.swin1.mlp.fc2.bias", "layers.9.adjust1.weight", "layers.9.adjust1.bias", "layers.9.swin2.attn_mask", "layers.9.swin2.norm1.weight", "layers.9.swin2.norm1.bias", "layers.9.swin2.attn.relative_position_bias_table", "layers.9.swin2.attn.relative_position_index", "layers.9.swin2.attn.qkv.weight", "layers.9.swin2.attn.qkv.bias", "layers.9.swin2.attn.proj.weight", "layers.9.swin2.attn.proj.bias", "layers.9.swin2.norm2.weight", "layers.9.swin2.norm2.bias", "layers.9.swin2.mlp.fc1.weight", "layers.9.swin2.mlp.fc1.bias", "layers.9.swin2.mlp.fc2.weight", "layers.9.swin2.mlp.fc2.bias", "layers.9.adjust2.weight", "layers.9.adjust2.bias", "layers.9.swin3.norm1.weight", "layers.9.swin3.norm1.bias", "layers.9.swin3.attn.relative_position_bias_table", "layers.9.swin3.attn.relative_position_index", "layers.9.swin3.attn.qkv.weight", "layers.9.swin3.attn.qkv.bias", "layers.9.swin3.attn.proj.weight", "layers.9.swin3.attn.proj.bias", "layers.9.swin3.norm2.weight", "layers.9.swin3.norm2.bias", "layers.9.swin3.mlp.fc1.weight", "layers.9.swin3.mlp.fc1.bias", "layers.9.swin3.mlp.fc2.weight", "layers.9.swin3.mlp.fc2.bias", "layers.9.adjust3.weight", "layers.9.adjust3.bias", "layers.9.swin4.attn_mask", "layers.9.swin4.norm1.weight", "layers.9.swin4.norm1.bias", "layers.9.swin4.attn.relative_position_bias_table", "layers.9.swin4.attn.relative_position_index", "layers.9.swin4.attn.qkv.weight", "layers.9.swin4.attn.qkv.bias", "layers.9.swin4.attn.proj.weight", "layers.9.swin4.attn.proj.bias", "layers.9.swin4.norm2.weight", "layers.9.swin4.norm2.bias", "layers.9.swin4.mlp.fc1.weight", "layers.9.swin4.mlp.fc1.bias", "layers.9.swin4.mlp.fc2.weight", "layers.9.swin4.mlp.fc2.bias", "layers.9.adjust4.weight", "layers.9.adjust4.bias", "layers.9.swin5.norm1.weight", "layers.9.swin5.norm1.bias", "layers.9.swin5.attn.relative_position_bias_table", "layers.9.swin5.attn.relative_position_index", "layers.9.swin5.attn.qkv.weight", "layers.9.swin5.attn.qkv.bias", "layers.9.swin5.attn.proj.weight", "layers.9.swin5.attn.proj.bias", "layers.9.swin5.norm2.weight", "layers.9.swin5.norm2.bias", "layers.9.swin5.mlp.fc1.weight", "layers.9.swin5.mlp.fc1.bias", "layers.9.swin5.mlp.fc2.weight", "layers.9.swin5.mlp.fc2.bias", "layers.9.adjust5.weight", "layers.9.adjust5.bias", "layers.10.swin1.norm1.weight", "layers.10.swin1.norm1.bias", "layers.10.swin1.attn.relative_position_bias_table", "layers.10.swin1.attn.relative_position_index", "layers.10.swin1.attn.qkv.weight", "layers.10.swin1.attn.qkv.bias", "layers.10.swin1.attn.proj.weight", "layers.10.swin1.attn.proj.bias", "layers.10.swin1.norm2.weight", "layers.10.swin1.norm2.bias", "layers.10.swin1.mlp.fc1.weight", "layers.10.swin1.mlp.fc1.bias", "layers.10.swin1.mlp.fc2.weight", "layers.10.swin1.mlp.fc2.bias", "layers.10.adjust1.weight", "layers.10.adjust1.bias", "layers.10.swin2.attn_mask", "layers.10.swin2.norm1.weight", "layers.10.swin2.norm1.bias", "layers.10.swin2.attn.relative_position_bias_table", "layers.10.swin2.attn.relative_position_index", "layers.10.swin2.attn.qkv.weight", "layers.10.swin2.attn.qkv.bias", "layers.10.swin2.attn.proj.weight", "layers.10.swin2.attn.proj.bias", "layers.10.swin2.norm2.weight", "layers.10.swin2.norm2.bias", "layers.10.swin2.mlp.fc1.weight", "layers.10.swin2.mlp.fc1.bias", "layers.10.swin2.mlp.fc2.weight", "layers.10.swin2.mlp.fc2.bias", "layers.10.adjust2.weight", "layers.10.adjust2.bias", "layers.10.swin3.norm1.weight", "layers.10.swin3.norm1.bias", "layers.10.swin3.attn.relative_position_bias_table", "layers.10.swin3.attn.relative_position_index", "layers.10.swin3.attn.qkv.weight", "layers.10.swin3.attn.qkv.bias", "layers.10.swin3.attn.proj.weight", "layers.10.swin3.attn.proj.bias", "layers.10.swin3.norm2.weight", "layers.10.swin3.norm2.bias", "layers.10.swin3.mlp.fc1.weight", "layers.10.swin3.mlp.fc1.bias", "layers.10.swin3.mlp.fc2.weight", "layers.10.swin3.mlp.fc2.bias", "layers.10.adjust3.weight", "layers.10.adjust3.bias", "layers.10.swin4.attn_mask", "layers.10.swin4.norm1.weight", "layers.10.swin4.norm1.bias", "layers.10.swin4.attn.relative_position_bias_table", "layers.10.swin4.attn.relative_position_index", "layers.10.swin4.attn.qkv.weight", "layers.10.swin4.attn.qkv.bias", "layers.10.swin4.attn.proj.weight", "layers.10.swin4.attn.proj.bias", "layers.10.swin4.norm2.weight", "layers.10.swin4.norm2.bias", "layers.10.swin4.mlp.fc1.weight", "layers.10.swin4.mlp.fc1.bias", "layers.10.swin4.mlp.fc2.weight", "layers.10.swin4.mlp.fc2.bias", "layers.10.adjust4.weight", "layers.10.adjust4.bias", "layers.10.swin5.norm1.weight", "layers.10.swin5.norm1.bias", "layers.10.swin5.attn.relative_position_bias_table", "layers.10.swin5.attn.relative_position_index", "layers.10.swin5.attn.qkv.weight", "layers.10.swin5.attn.qkv.bias", "layers.10.swin5.attn.proj.weight", "layers.10.swin5.attn.proj.bias", "layers.10.swin5.norm2.weight", "layers.10.swin5.norm2.bias", "layers.10.swin5.mlp.fc1.weight", "layers.10.swin5.mlp.fc1.bias", "layers.10.swin5.mlp.fc2.weight", "layers.10.swin5.mlp.fc2.bias", "layers.10.adjust5.weight", "layers.10.adjust5.bias", "layers.11.swin1.norm1.weight", "layers.11.swin1.norm1.bias", "layers.11.swin1.attn.relative_position_bias_table", "layers.11.swin1.attn.relative_position_index", "layers.11.swin1.attn.qkv.weight", "layers.11.swin1.attn.qkv.bias", "layers.11.swin1.attn.proj.weight", "layers.11.swin1.attn.proj.bias", "layers.11.swin1.norm2.weight", "layers.11.swin1.norm2.bias", "layers.11.swin1.mlp.fc1.weight", "layers.11.swin1.mlp.fc1.bias", "layers.11.swin1.mlp.fc2.weight", "layers.11.swin1.mlp.fc2.bias", "layers.11.adjust1.weight", "layers.11.adjust1.bias", "layers.11.swin2.attn_mask", "layers.11.swin2.norm1.weight", "layers.11.swin2.norm1.bias", "layers.11.swin2.attn.relative_position_bias_table", "layers.11.swin2.attn.relative_position_index", "layers.11.swin2.attn.qkv.weight", "layers.11.swin2.attn.qkv.bias", "layers.11.swin2.attn.proj.weight", "layers.11.swin2.attn.proj.bias", "layers.11.swin2.norm2.weight", "layers.11.swin2.norm2.bias", "layers.11.swin2.mlp.fc1.weight", "layers.11.swin2.mlp.fc1.bias", "layers.11.swin2.mlp.fc2.weight", "layers.11.swin2.mlp.fc2.bias", "layers.11.adjust2.weight", "layers.11.adjust2.bias", "layers.11.swin3.norm1.weight", "layers.11.swin3.norm1.bias", "layers.11.swin3.attn.relative_position_bias_table", "layers.11.swin3.attn.relative_position_index", "layers.11.swin3.attn.qkv.weight", "layers.11.swin3.attn.qkv.bias", "layers.11.swin3.attn.proj.weight", "layers.11.swin3.attn.proj.bias", "layers.11.swin3.norm2.weight", "layers.11.swin3.norm2.bias", "layers.11.swin3.mlp.fc1.weight", "layers.11.swin3.mlp.fc1.bias", "layers.11.swin3.mlp.fc2.weight", "layers.11.swin3.mlp.fc2.bias", "layers.11.adjust3.weight", "layers.11.adjust3.bias", "layers.11.swin4.attn_mask", "layers.11.swin4.norm1.weight", "layers.11.swin4.norm1.bias", "layers.11.swin4.attn.relative_position_bias_table", "layers.11.swin4.attn.relative_position_index", "layers.11.swin4.attn.qkv.weight", "layers.11.swin4.attn.qkv.bias", "layers.11.swin4.attn.proj.weight", "layers.11.swin4.attn.proj.bias", "layers.11.swin4.norm2.weight", "layers.11.swin4.norm2.bias", "layers.11.swin4.mlp.fc1.weight", "layers.11.swin4.mlp.fc1.bias", "layers.11.swin4.mlp.fc2.weight", "layers.11.swin4.mlp.fc2.bias", "layers.11.adjust4.weight", "layers.11.adjust4.bias", "layers.11.swin5.norm1.weight", "layers.11.swin5.norm1.bias", "layers.11.swin5.attn.relative_position_bias_table", "layers.11.swin5.attn.relative_position_index", "layers.11.swin5.attn.qkv.weight", "layers.11.swin5.attn.qkv.bias", "layers.11.swin5.attn.proj.weight", "layers.11.swin5.attn.proj.bias", "layers.11.swin5.norm2.weight", "layers.11.swin5.norm2.bias", "layers.11.swin5.mlp.fc1.weight", "layers.11.swin5.mlp.fc1.bias", "layers.11.swin5.mlp.fc2.weight", "layers.11.swin5.mlp.fc2.bias", "layers.11.adjust5.weight", "layers.11.adjust5.bias". 
Limingxing00 commented 4 months ago

Sorry, I find it.

Limingxing00 commented 4 months ago

Just run

python drct/test.py -opt options/test/DRCT_SRx4_ImageNet-LR.yml