lbc12345 / SeD

Semantic-Aware Discriminator for Image Super-Resolution
117 stars 5 forks source link

I encountered the following error while attempting to reproduce the steps you provided. Could you please tell me why this error occurred? #3

Open JeffreyYANGS opened 7 months ago

JeffreyYANGS commented 7 months ago

Traceback (most recent call last): File "F:\pythonProject1\SeD-main\train.py", line 15, in from models import model_rrdb, model_swinir, sed File "F:\pythonProject1\venv\Lib\site-packages\models__init.py", line 37, in import project ModuleNotFoundError: No module named 'project' Traceback (most recent call last): File "F:\pythonProject1\SeD-main\train.py", line 15, in from models import model_rrdb, model_swinir, sed File "F:\pythonProject1\venv\Lib\site-packages\models\init__.py", line 37, in import project ModuleNotFoundError: No module named 'project'

lbc12345 commented 7 months ago

Hello! Thanks for your interest in our work! It seems like you have 'models' package installed in your venv, which causes conflicts with 'from models import model_rrdb...', please uninstall this package if possible! Refer to this link

JeffreyYANGS commented 7 months ago

Thanks for the answer, I have deleted the models file as requested, but the following error appears, please answer again, thank you very much

Traceback (most recent call last): File "F:\pythonProject1\SeD-main\train.py", line 15, in from models import model_rrdb, model_swinir, sed File "F:\pythonProject1\SeD-main\models\model_swinir.py", line 11, in from timm.models.layers import DropPath, to_2tuple, truncnormal File "F:\pythonProject1\venv\Lib\site-packages\timminit.py", line 2, in from .models import create_model, list_models, is_model, list_modules, model_entrypoint, File "F:\pythonProject1\venv\Lib\site-packages\timm\modelsinit.py", line 28, in from .maxxvit import File "F:\pythonProject1\venv\Lib\site-packages\timm\models\maxxvit.py", line 225, in @DataClass Traceback (most recent call last): File "F:\pythonProject1\SeD-main\train.py", line 15, in from models import model_rrdb, model_swinir, sed File "F:\pythonProject1\SeD-main\models\model_swinir.py", line 11, in from timm.models.layers import DropPath, to_2tuple, truncnormal File "F:\pythonProject1\venv\Lib\site-packages\timminit.py", line 2, in from .models import create_model, list_models, is_model, list_modules, model_entrypoint, File "F:\pythonProject1\venv\Lib\site-packages\timm\modelsinit.py", line 28, in from .maxxvit import File "F:\pythonProject1\venv\Lib\site-packages\timm\models\maxxvit.py", line 225, in ^^^^^^ @DataClass^ ^ ^^ File "D:\python\Lib\dataclasses.py", line 1230, in dataclass return wrap(cls) ^^^^^^^^^ File "D:\python\Lib\dataclasses.py", line 1220, in wrap ^^ ^return _process_class(cls, init, repr, eq, order, unsafe_hash,^ ^ ^ ^^^^ File "D:\python\Lib\dataclasses.py", line 1230, in dataclass ^^^^^^^^^^^^^^^^^^^ ^return wrap(cls)^ ^ ^ ^ ^ ^ ^^^^^^^^^^^^^^^^^^^ File "D:\python\Lib\dataclasses.py", line 1220, in wrap return _process_class(cls, init, repr, eq, order, unsafe_hash, ^ ^ ^ ^ ^ ^ ^ ^^^^^^^^^^^^^^^^^ File "D:\python\Lib\dataclasses.py", line 958, in _process_class ^^^^^^^^^^ ^cls_fields.append(_get_field(cls, name, type, kw_only))^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^^ ^ ^ ^ ^ ^ ^ ^ ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\python\Lib\dataclasses.py", line 958, in _process_class cls_fields.append(_get_field(cls, name, type, kw_only)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\python\Lib\dataclasses.py", line 815, in _get_field raise ValueError(f'mutable default {type(f.default)} for field ' ValueError: mutable default <class 'timm.models.maxxvit.MaxxVitConvCfg'> for field conv_cfg is not allowed: use default_fact ory ^^^^^^^^^^^^^^^^^^^^ File "D:\python\Lib\dataclasses.py", line 815, in _get_field raise ValueError(f'mutable default {type(f.default)} for field ' ValueError: mutable default <class 'timm.models.maxxvit.MaxxVitConvCfg'> for field conv_cfg is not allowed: use default_fact ory [2024-04-13 11:35:26,796] torch.distributed.elastic.multiprocessing.api: [ERROR] failed (exitcode: 1) local_rank: 0 (pid: 49 24) of binary: F:\pythonProject1\venv\Scripts\python.exe Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "F:\pythonProject1\venv\Lib\site-packages\torch\distributed\launch.py", line 198, in main() File "F:\pythonProject1\venv\Lib\site-packages\torch\distributed\launch.py", line 194, in main launch(args) File "F:\pythonProject1\venv\Lib\site-packages\torch\distributed\launch.py", line 179, in launch run(args) File "F:\pythonProject1\venv\Lib\site-packages\torch\distributed\run.py", line 803, in run elastic_launch( File "F:\pythonProject1\venv\Lib\site-packages\torch\distributed\launcher\api.py", line 135, in call return launch_agent(self._config, self._entrypoint, list(args)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\pythonProject1\venv\Lib\site-packages\torch\distributed\launcher\api.py", line 268, in launch_agent raise ChildFailedError( torch.distributed.elastic.multiprocessing.errors.ChildFailedError: train.py FAILED Failures: [1]: time : 2024-04-13_11:35:26 host : DESKTOP-AJ9M488 rank : 1 (local_rank: 1) exitcode : 1 (pid: 3048) error_file: <N/A> traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html [2]: time : 2024-04-13_11:35:26 host : DESKTOP-AJ9M488 rank : 2 (local_rank: 2) exitcode : 1 (pid: 13436) error_file: <N/A> traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html [3]: time : 2024-04-13_11:35:26 host : DESKTOP-AJ9M488 rank : 3 (local_rank: 3) exitcode : 1 (pid: 2008) error_file: <N/A> Root Cause (first observed failure): [0]: time : 2024-04-13_11:35:26 host : DESKTOP-AJ9M488 rank : 0 (local_rank: 0) exitcode : 1 (pid: 4924) error_file: <N/A> traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html

lbc12345 commented 7 months ago

Hi, It looks like the problem with your environment, would you please try to build a new environment following our guidance? We do not meet such problems during training.

JeffreyYANGS commented 6 months ago

Thanks. The environment has been reconfigured as required, and the code shows that there is a problem with the clip package, and I didn't find the ModifiedResNet module it needs, please let me know, thank you. At the same time I'm not very clear about the meaning of these two in your training code, -m torch.distributed.launch --nproc_per_node=4.

lbc12345 commented 6 months ago

For the first problem, did you install clip package correctly? Would you please run 'pip list' and check the version of clip package? We do not meet such problem. Make sure you do not meet network problem during installing of clip package. For the second problem, please refer to pytorch DDP training. It means use 4 GPUs in parallel to train our model.

JeffreyYANGS commented 6 months ago

Thanks for the answer, the model has run successfully. I also want to ask, I see that this model does not have an evaluation index, how to judge the effect of super-score, and there is no log record to show the training progress, will these be considered to be added? Thank you

lbc12345 commented 6 months ago

In our implementation, we will evaluate the performance of the trained model every 5000 iterations on the Set5 benchmark, as set in yml file. If you want to evaluate it on another dataset, you may change it by yourself~ If I haven't misunderstood your meaning, our "evaluation index" is PSNR and SSIM.

JeffreyYANGS commented 5 months ago

Hello, I found that there are three evaluation indicators in your paper: LPIPS, PSNR, and SSIM, but there is no LPIPS in the code, can you add it?

lbc12345 commented 5 months ago

Hi, you can use the powerful python package pyiqa to calculate LPIPS, we will add these to our code, thanks for your advice!

JeffreyYANGS commented 5 months ago

I see that the generator type in your code is currently RRDB, I want to use the SwinIR you provided, please how can I do it, only modify the model_type will give an error, thanks for the answer

lbc12345 commented 5 months ago

What's your error message?

JeffreyYANGS commented 5 months ago

I first modified the weight file as follows: parser.add_argument( "--resume", type=str, default='./pretrained/001_classicalSR_DF2K_s64w8_SwinIR-M_x4.pth', help="path to the checkpoints for pretrained model", ) Then modify the model type: model_type: SwinIR The command to perform the training is: python train.py --opt options/train_rrdb_P+SeD.yml The following error message is displayed: F:\SeD-main\venv\Lib\site-packages\torch\functional.py:507: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ..\aten\src\ATen\native\TensorShape.cpp:3550.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] 24-05-28 17:01:24.978 : load pretrained model: ./pretrained/001_classicalSR_DF2K_s64w8_SwinIR-M_x4.pth Traceback (most recent call last): File "F:\SeD-main\train.py", line 359, in main() File "F:\SeD-main\train.py", line 126, in main model.load_state_dict(ckpt) File "F:\SeD-main\venv\Lib\site-packages\torch\nn\modules\module.py", line 2153, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for SwinIR: Missing key(s) in state_dict: "conv_first.weight", "conv_first.bias", "patch_embed.norm.weight", "patch_embed.norm.b ias", "layers.0.residual_group.blocks.0.norm1.weight", "layers.0.residual_group.blocks.0.norm1.bias", "layers.0.residual_gro up.blocks.0.attn.relative_position_bias_table", "layers.0.residual_group.blocks.0.attn.relative_position_index", "layers.0.r esidual_group.blocks.0.attn.qkv.weight", "layers.0.residual_group.blocks.0.attn.qkv.bias", "layers.0.residual_group.blocks.0 .attn.proj.weight", "layers.0.residual_group.blocks.0.attn.proj.bias", "layers.0.residual_group.blocks.0.norm2.weight", "lay ers.0.residual_group.blocks.0.norm2.bias", "layers.0.residual_group.blocks.0.mlp.fc1.weight", "layers.0.residual_group.block s.0.mlp.fc1.bias", "layers.0.residual_group.blocks.0.mlp.fc2.weight", "layers.0.residual_group.blocks.0.mlp.fc2.bias", "laye rs.0.residual_group.blocks.1.attn_mask", "layers.0.residual_group.blocks.1.norm1.weight", "layers.0.residual_group.blocks.1. norm1.bias", "layers.0.residual_group.blocks.1.attn.relative_position_bias_table", "layers.0.residual_group.blocks.1.attn.re lative_position_index", "layers.0.residual_group.blocks.1.attn.qkv.weight", "layers.0.residual_group.blocks.1.attn.qkv.bias" , "layers.0.residual_group.blocks.1.attn.proj.weight", "layers.0.residual_group.blocks.1.attn.proj.bias", "layers.0.residual _group.blocks.1.norm2.weight", "layers.0.residual_group.blocks.1.norm2.bias", "layers.0.residual_group.blocks.1.mlp.fc1.weig ht", "layers.0.residual_group.blocks.1.mlp.fc1.bias", "layers.0.residualgroup.blocks.1.mlp.fc2.weight", "layers.0.residual group.blocks.1.mlp.fc2.bias", "layers.0.residual_group.blocks.2.norm1.weight", "layers.0.residual_group.blocks.2.norm1.bias" , "layers.0.residual_group.blocks.2.attn.relative_position_bias_table", "layers.0.residual_group.blocks.2.attn.relative_posi tion_index", "layers.0.residual_group.blocks.2.attn.qkv.weight", "layers.0.residual_group.blocks.2.attn.qkv.bias", "layers.0 .residual_group.blocks.2.attn.proj.weight", "layers.0.residual_group.blocks.2.attn.proj.bias", "layers.0.residual_group.bloc ks.2.norm2.weight", "layers.0.residual_group.blocks.2.norm2.bias", "layers.0.residual_group.blocks.2.mlp.fc1.weight", "layer s.0.residual_group.blocks.2.mlp.fc1.bias", "layers.0.residual_group.blocks.2.mlp.fc2.weight", "layers.0.residual_group.block s.2.mlp.fc2.bias", "layers.0.residual_group.blocks.3.attn_mask", "layers.0.residual_group.blocks.3.norm1.weight", "layers.0. residual_group.blocks.3.norm1.bias", "layers.0.residual_group.blocks.3.attn.relative_position_bias_table", "layers.0.residua l_group.blocks.3.attn.relative_position_index", "layers.0.residual_group.blocks.3.attn.qkv.weight", "layers.0.residual_group .blocks.3.attn.qkv.bias", "layers.0.residual_group.blocks.3.attn.proj.weight", "layers.0.residual_group.blocks.3.attn.proj.b ias", "layers.0.residual_group.blocks.3.norm2.weight", "layers.0.residual_group.blocks.3.norm2.bias", "layers.0.residual_gro up.blocks.3.mlp.fc1.weight", "layers.0.residual_group.blocks.3.mlp.fc1.bias", "layers.0.residual_group.blocks.3.mlp.fc2.weig ht", "layers.0.residual_group.blocks.3.mlp.fc2.bias", "layers.0.residual_group.blocks.4.norm1.weight", "layers.0.residual_gr oup.blocks.4.norm1.bias", "layers.0.residual_group.blocks.4.attn.relative_position_bias_table", "layers.0.residual_group.blo cks.4.attn.relative_position_index", "layers.0.residual_group.blocks.4.attn.qkv.weight", "layers.0.residual_group.blocks.4.a ttn.qkv.bias", "layers.0.residual_group.blocks.4.attn.proj.weight", "layers.0.residual_group.blocks.4.attn.proj.bias", "laye rs.0.residual_group.blocks.4.norm2.weight", "layers.0.residual_group.blocks.4.norm2.bias", "layers.0.residual_group.blocks.4 .mlp.fc1.weight", "layers.0.residual_group.blocks.4.mlp.fc1.bias", "layers.0.residual_group.blocks.4.mlp.fc2.weight", "layer s.0.residual_group.blocks.4.mlp.fc2.bias", "layers.0.residual_group.blocks.5.attn_mask", "layers.0.residual_group.blocks.5.n orm1.weight", "layers.0.residual_group.blocks.5.norm1.bias", "layers.0.residual_group.blocks.5.attn.relative_position_bias_t able", "layers.0.residual_group.blocks.5.attn.relative_position_index", "layers.0.residual_group.blocks.5.attn.qkv.weight", "layers.0.residual_group.blocks.5.attn.qkv.bias", "layers.0.residual_group.blocks.5.attn.proj.weight", "layers.0.residual_gr oup.blocks.5.attn.proj.bias", "layers.0.residual_group.blocks.5.norm2.weight", "layers.0.residual_group.blocks.5.norm2.bias" , "layers.0.residual_group.blocks.5.mlp.fc1.weight", "layers.0.residual_group.blocks.5.mlp.fc1.bias", "layers.0.residual_gro up.blocks.5.mlp.fc2.weight", "layers.0.residual_group.blocks.5.mlp.fc2.bias", "layers.0.conv.weight", "layers.0.conv.bias", "layers.1.residual_group.blocks.0.norm1.weight", "layers.1.residual_group.blocks.0.norm1.bias", "layers.1.residual_group.blo cks.0.attn.relative_position_bias_table", "layers.1.residual_group.blocks.0.attn.relative_position_index", "layers.1.residua l_group.blocks.0.attn.qkv.weight", "layers.1.residual_group.blocks.0.attn.qkv.bias", "layers.1.residual_group.blocks.0.attn. proj.weight", "layers.1.residual_group.blocks.0.attn.proj.bias", "layers.1.residual_group.blocks.0.norm2.weight", "layers.1. residual_group.blocks.0.norm2.bias", "layers.1.residual_group.blocks.0.mlp.fc1.weight", "layers.1.residual_group.blocks.0.ml p.fc1.bias", "layers.1.residual_group.blocks.0.mlp.fc2.weight", "layers.1.residual_group.blocks.0.mlp.fc2.bias", "layers.1.r esidual_group.blocks.1.attn_mask", "layers.1.residual_group.blocks.1.norm1.weight", "layers.1.residual_group.blocks.1.norm1. bias", "layers.1.residual_group.blocks.1.attn.relative_position_bias_table", "layers.1.residual_group.blocks.1.attn.relative _position_index", "layers.1.residual_group.blocks.1.attn.qkv.weight", "layers.1.residual_group.blocks.1.attn.qkv.bias", "lay ers.1.residual_group.blocks.1.attn.proj.weight", "layers.1.residual_group.blocks.1.attn.proj.bias", "layers.1.residual_group .blocks.1.norm2.weight", "layers.1.residual_group.blocks.1.norm2.bias", "layers.1.residual_group.blocks.1.mlp.fc1.weight", " layers.1.residual_group.blocks.1.mlp.fc1.bias", "layers.1.residual_group.blocks.1.mlp.fc2.weight", "layers.1.residual_group. blocks.1.mlp.fc2.bias", "layers.1.residual_group.blocks.2.norm1.weight", "layers.1.residual_group.blocks.2.norm1.bias", "lay ers.1.residual_group.blocks.2.attn.relative_position_bias_table", "layers.1.residual_group.blocks.2.attn.relative_position_i ndex", "layers.1.residual_group.blocks.2.attn.qkv.weight", "layers.1.residual_group.blocks.2.attn.qkv.bias", "layers.1.resid ual_group.blocks.2.attn.proj.weight", "layers.1.residual_group.blocks.2.attn.proj.bias", "layers.1.residual_group.blocks.2.n orm2.weight", "layers.1.residual_group.blocks.2.norm2.bias", "layers.1.residual_group.blocks.2.mlp.fc1.weight", "layers.1.re sidual_group.blocks.2.mlp.fc1.bias", "layers.1.residual_group.blocks.2.mlp.fc2.weight", "layers.1.residual_group.blocks.2.ml p.fc2.bias", "layers.1.residual_group.blocks.3.attn_mask", "layers.1.residual_group.blocks.3.norm1.weight", "layers.1.residu al_group.blocks.3.norm1.bias", "layers.1.residual_group.blocks.3.attn.relative_position_bias_table", "layers.1.residual_grou p.blocks.3.attn.relative_position_index", "layers.1.residual_group.blocks.3.attn.qkv.weight", "layers.1.residual_group.block s.3.attn.qkv.bias", "layers.1.residual_group.blocks.3.attn.proj.weight", "layers.1.residual_group.blocks.3.attn.proj.bias", "layers.1.residual_group.blocks.3.norm2.weight", "layers.1.residual_group.blocks.3.norm2.bias", "layers.1.residual_group.blo cks.3.mlp.fc1.weight", "layers.1.residual_group.blocks.3.mlp.fc1.bias", "layers.1.residual_group.blocks.3.mlp.fc2.weight", " layers.1.residual_group.blocks.3.mlp.fc2.bias", "layers.1.residual_group.blocks.4.norm1.weight", "layers.1.residual_group.bl ocks.4.norm1.bias", "layers.1.residual_group.blocks.4.attn.relative_position_bias_table", "layers.1.residual_group.blocks.4. attn.relative_position_index", "layers.1.residual_group.blocks.4.attn.qkv.weight", "layers.1.residual_group.blocks.4.attn.qk v.bias", "layers.1.residual_group.blocks.4.attn.proj.weight", "layers.1.residual_group.blocks.4.attn.proj.bias", "layers.1.r esidual_group.blocks.4.norm2.weight", "layers.1.residual_group.blocks.4.norm2.bias", "layers.1.residual_group.blocks.4.mlp.f c1.weight", "layers.1.residual_group.blocks.4.mlp.fc1.bias", "layers.1.residual_group.blocks.4.mlp.fc2.weight", "layers.1.re sidual_group.blocks.4.mlp.fc2.bias", "layers.1.residual_group.blocks.5.attn_mask", "layers.1.residual_group.blocks.5.norm1.w eight", "layers.1.residual_group.blocks.5.norm1.bias", "layers.1.residual_group.blocks.5.attn.relative_position_bias_table", "layers.1.residual_group.blocks.5.attn.relative_position_index", "layers.1.residual_group.blocks.5.attn.qkv.weight", "layer s.1.residual_group.blocks.5.attn.qkv.bias", "layers.1.residual_group.blocks.5.attn.proj.weight", "layers.1.residual_group.bl ocks.5.attn.proj.bias", "layers.1.residual_group.blocks.5.norm2.weight", "layers.1.residual_group.blocks.5.norm2.bias", "lay ers.1.residual_group.blocks.5.mlp.fc1.weight", "layers.1.residual_group.blocks.5.mlp.fc1.bias", "layers.1.residual_group.blo cks.5.mlp.fc2.weight", "layers.1.residual_group.blocks.5.mlp.fc2.bias", "layers.1.conv.weight", "layers.1.conv.bias", "layer s.2.residual_group.blocks.0.norm1.weight", "layers.2.residual_group.blocks.0.norm1.bias", "layers.2.residual_group.blocks.0. attn.relative_position_bias_table", "layers.2.residual_group.blocks.0.attn.relative_position_index", "layers.2.residual_grou p.blocks.0.attn.qkv.weight", "layers.2.residual_group.blocks.0.attn.qkv.bias", "layers.2.residual_group.blocks.0.attn.proj.w eight", "layers.2.residual_group.blocks.0.attn.proj.bias", "layers.2.residual_group.blocks.0.norm2.weight", "layers.2.residu al_group.blocks.0.norm2.bias", "layers.2.residual_group.blocks.0.mlp.fc1.weight", "layers.2.residual_group.blocks.0.mlp.fc1. bias", "layers.2.residual_group.blocks.0.mlp.fc2.weight", "layers.2.residual_group.blocks.0.mlp.fc2.bias", "layers.2.residua l_group.blocks.1.attn_mask", "layers.2.residual_group.blocks.1.norm1.weight", "layers.2.residual_group.blocks.1.norm1.bias", "layers.2.residual_group.blocks.1.attn.relative_position_bias_table", "layers.2.residual_group.blocks.1.attn.relative_posit ion_index", "layers.2.residual_group.blocks.1.attn.qkv.weight", "layers.2.residual_group.blocks.1.attn.qkv.bias", "layers.2. residual_group.blocks.1.attn.proj.weight", "layers.2.residual_group.blocks.1.attn.proj.bias", "layers.2.residual_group.block s.1.norm2.weight", "layers.2.residual_group.blocks.1.norm2.bias", "layers.2.residual_group.blocks.1.mlp.fc1.weight", "layers .2.residual_group.blocks.1.mlp.fc1.bias", "layers.2.residual_group.blocks.1.mlp.fc2.weight", "layers.2.residual_group.blocks .1.mlp.fc2.bias", "layers.2.residual_group.blocks.2.norm1.weight", "layers.2.residual_group.blocks.2.norm1.bias", "layers.2. residual_group.blocks.2.attn.relative_position_bias_table", "layers.2.residual_group.blocks.2.attn.relative_position_index", "layers.2.residual_group.blocks.2.attn.qkv.weight", "layers.2.residual_group.blocks.2.attn.qkv.bias", "layers.2.residual_gr oup.blocks.2.attn.proj.weight", "layers.2.residual_group.blocks.2.attn.proj.bias", "layers.2.residual_group.blocks.2.norm2.w eight", "layers.2.residual_group.blocks.2.norm2.bias", "layers.2.residual_group.blocks.2.mlp.fc1.weight", "layers.2.residual _group.blocks.2.mlp.fc1.bias", "layers.2.residual_group.blocks.2.mlp.fc2.weight", "layers.2.residual_group.blocks.2.mlp.fc2. bias", "layers.2.residual_group.blocks.3.attn_mask", "layers.2.residual_group.blocks.3.norm1.weight", "layers.2.residual_gro up.blocks.3.norm1.bias", "layers.2.residual_group.blocks.3.attn.relative_position_bias_table", "layers.2.residual_group.bloc ks.3.attn.relative_position_index", "layers.2.residual_group.blocks.3.attn.qkv.weight", "layers.2.residual_group.blocks.3.at tn.qkv.bias", "layers.2.residual_group.blocks.3.attn.proj.weight", "layers.2.residual_group.blocks.3.attn.proj.bias", "layer s.2.residual_group.blocks.3.norm2.weight", "layers.2.residual_group.blocks.3.norm2.bias", "layers.2.residual_group.blocks.3. mlp.fc1.weight", "layers.2.residual_group.blocks.3.mlp.fc1.bias", "layers.2.residual_group.blocks.3.mlp.fc2.weight", "layers .2.residual_group.blocks.3.mlp.fc2.bias", "layers.2.residual_group.blocks.4.norm1.weight", "layers.2.residual_group.blocks.4 .norm1.bias", "layers.2.residual_group.blocks.4.attn.relative_position_bias_table", "layers.2.residual_group.blocks.4.attn.r elative_position_index", "layers.2.residual_group.blocks.4.attn.qkv.weight", "layers.2.residual_group.blocks.4.attn.qkv.bias ", "layers.2.residual_group.blocks.4.attn.proj.weight", "layers.2.residual_group.blocks.4.attn.proj.bias", "layers.2.residua l_group.blocks.4.norm2.weight", "layers.2.residual_group.blocks.4.norm2.bias", "layers.2.residual_group.blocks.4.mlp.fc1.wei ght", "layers.2.residual_group.blocks.4.mlp.fc1.bias", "layers.2.residual_group.blocks.4.mlp.fc2.weight", "layers.2.residual _group.blocks.4.mlp.fc2.bias", "layers.2.residual_group.blocks.5.attn_mask", "layers.2.residual_group.blocks.5.norm1.weight" , "layers.2.residual_group.blocks.5.norm1.bias", "layers.2.residual_group.blocks.5.attn.relative_position_bias_table", "laye rs.2.residual_group.blocks.5.attn.relative_position_index", "layers.2.residual_group.blocks.5.attn.qkv.weight", "layers.2.re sidual_group.blocks.5.attn.qkv.bias", "layers.2.residual_group.blocks.5.attn.proj.weight", "layers.2.residual_group.blocks.5 .attn.proj.bias", "layers.2.residual_group.blocks.5.norm2.weight", "layers.2.residual_group.blocks.5.norm2.bias", "layers.2. residual_group.blocks.5.mlp.fc1.weight", "layers.2.residual_group.blocks.5.mlp.fc1.bias", "layers.2.residual_group.blocks.5. mlp.fc2.weight", "layers.2.residual_group.blocks.5.mlp.fc2.bias", "layers.2.conv.weight", "layers.2.conv.bias", "layers.3.re sidual_group.blocks.0.norm1.weight", "layers.3.residual_group.blocks.0.norm1.bias", "layers.3.residual_group.blocks.0.attn.r elative_position_bias_table", "layers.3.residual_group.blocks.0.attn.relative_position_index", "layers.3.residual_group.bloc ks.0.attn.qkv.weight", "layers.3.residual_group.blocks.0.attn.qkv.bias", "layers.3.residual_group.blocks.0.attn.proj.weight" , "layers.3.residual_group.blocks.0.attn.proj.bias", "layers.3.residual_group.blocks.0.norm2.weight", "layers.3.residual_gro up.blocks.0.norm2.bias", "layers.3.residual_group.blocks.0.mlp.fc1.weight", "layers.3.residual_group.blocks.0.mlp.fc1.bias", "layers.3.residual_group.blocks.0.mlp.fc2.weight", "layers.3.residual_group.blocks.0.mlp.fc2.bias", "layers.3.residual_grou p.blocks.1.attn_mask", "layers.3.residual_group.blocks.1.norm1.weight", "layers.3.residual_group.blocks.1.norm1.bias", "laye rs.3.residual_group.blocks.1.attn.relative_position_bias_table", "layers.3.residual_group.blocks.1.attn.relative_position_in dex", "layers.3.residual_group.blocks.1.attn.qkv.weight", "layers.3.residual_group.blocks.1.attn.qkv.bias", "layers.3.residu al_group.blocks.1.attn.proj.weight", "layers.3.residual_group.blocks.1.attn.proj.bias", "layers.3.residual_group.blocks.1.no rm2.weight", "layers.3.residual_group.blocks.1.norm2.bias", "layers.3.residual_group.blocks.1.mlp.fc1.weight", "layers.3.res idual_group.blocks.1.mlp.fc1.bias", "layers.3.residual_group.blocks.1.mlp.fc2.weight", "layers.3.residual_group.blocks.1.mlp .fc2.bias", "layers.3.residual_group.blocks.2.norm1.weight", "layers.3.residual_group.blocks.2.norm1.bias", "layers.3.residu al_group.blocks.2.attn.relative_position_bias_table", "layers.3.residual_group.blocks.2.attn.relative_position_index", "laye rs.3.residual_group.blocks.2.attn.qkv.weight", "layers.3.residual_group.blocks.2.attn.qkv.bias", "layers.3.residual_group.bl ocks.2.attn.proj.weight", "layers.3.residual_group.blocks.2.attn.proj.bias", "layers.3.residual_group.blocks.2.norm2.weight" , "layers.3.residual_group.blocks.2.norm2.bias", "layers.3.residual_group.blocks.2.mlp.fc1.weight", "layers.3.residual_group .blocks.2.mlp.fc1.bias", "layers.3.residual_group.blocks.2.mlp.fc2.weight", "layers.3.residual_group.blocks.2.mlp.fc2.bias", "layers.3.residual_group.blocks.3.attn_mask", "layers.3.residual_group.blocks.3.norm1.weight", "layers.3.residual_group.blo cks.3.norm1.bias", "layers.3.residual_group.blocks.3.attn.relative_position_bias_table", "layers.3.residual_group.blocks.3.a ttn.relative_position_index", "layers.3.residual_group.blocks.3.attn.qkv.weight", "layers.3.residual_group.blocks.3.attn.qkv .bias", "layers.3.residual_group.blocks.3.attn.proj.weight", "layers.3.residual_group.blocks.3.attn.proj.bias", "layers.3.re sidual_group.blocks.3.norm2.weight", "layers.3.residual_group.blocks.3.norm2.bias", "layers.3.residual_group.blocks.3.mlp.fc 1.weight", "layers.3.residual_group.blocks.3.mlp.fc1.bias", "layers.3.residual_group.blocks.3.mlp.fc2.weight", "layers.3.res idual_group.blocks.3.mlp.fc2.bias", "layers.3.residual_group.blocks.4.norm1.weight", "layers.3.residual_group.blocks.4.norm1 .bias", "layers.3.residual_group.blocks.4.attn.relative_position_bias_table", "layers.3.residual_group.blocks.4.attn.relativ e_position_index", "layers.3.residual_group.blocks.4.attn.qkv.weight", "layers.3.residual_group.blocks.4.attn.qkv.bias", "la yers.3.residual_group.blocks.4.attn.proj.weight", "layers.3.residual_group.blocks.4.attn.proj.bias", "layers.3.residual_grou p.blocks.4.norm2.weight", "layers.3.residual_group.blocks.4.norm2.bias", "layers.3.residual_group.blocks.4.mlp.fc1.weight", "layers.3.residual_group.blocks.4.mlp.fc1.bias", "layers.3.residual_group.blocks.4.mlp.fc2.weight", "layers.3.residual_group .blocks.4.mlp.fc2.bias", "layers.3.residual_group.blocks.5.attn_mask", "layers.3.residual_group.blocks.5.norm1.weight", "lay ers.3.residual_group.blocks.5.norm1.bias", "layers.3.residual_group.blocks.5.attn.relative_position_bias_table", "layers.3.r esidual_group.blocks.5.attn.relative_position_index", "layers.3.residual_group.blocks.5.attn.qkv.weight", "layers.3.residual _group.blocks.5.attn.qkv.bias", "layers.3.residual_group.blocks.5.attn.proj.weight", "layers.3.residual_group.blocks.5.attn. proj.bias", "layers.3.residual_group.blocks.5.norm2.weight", "layers.3.residual_group.blocks.5.norm2.bias", "layers.3.residu al_group.blocks.5.mlp.fc1.weight", "layers.3.residual_group.blocks.5.mlp.fc1.bias", "layers.3.residual_group.blocks.5.mlp.fc 2.weight", "layers.3.residual_group.blocks.5.mlp.fc2.bias", "layers.3.conv.weight", "layers.3.conv.bias", "layers.4.residual _group.blocks.0.norm1.weight", "layers.4.residual_group.blocks.0.norm1.bias", "layers.4.residual_group.blocks.0.attn.relativ e_position_bias_table", "layers.4.residual_group.blocks.0.attn.relative_position_index", "layers.4.residual_group.blocks.0.a ttn.qkv.weight", "layers.4.residual_group.blocks.0.attn.qkv.bias", "layers.4.residual_group.blocks.0.attn.proj.weight", "lay ers.4.residual_group.blocks.0.attn.proj.bias", "layers.4.residual_group.blocks.0.norm2.weight", "layers.4.residual_group.blo cks.0.norm2.bias", "layers.4.residual_group.blocks.0.mlp.fc1.weight", "layers.4.residual_group.blocks.0.mlp.fc1.bias", "laye rs.4.residual_group.blocks.0.mlp.fc2.weight", "layers.4.residual_group.blocks.0.mlp.fc2.bias", "layers.4.residual_group.bloc ks.1.attn_mask", "layers.4.residual_group.blocks.1.norm1.weight", "layers.4.residual_group.blocks.1.norm1.bias", "layers.4.r esidual_group.blocks.1.attn.relative_position_bias_table", "layers.4.residual_group.blocks.1.attn.relative_position_index", "layers.4.residual_group.blocks.1.attn.qkv.weight", "layers.4.residual_group.blocks.1.attn.qkv.bias", "layers.4.residual_gro up.blocks.1.attn.proj.weight", "layers.4.residual_group.blocks.1.attn.proj.bias", "layers.4.residual_group.blocks.1.norm2.we ight", "layers.4.residual_group.blocks.1.norm2.bias", "layers.4.residualgroup.blocks.1.mlp.fc1.weight", "layers.4.residual group.blocks.1.mlp.fc1.bias", "layers.4.residual_group.blocks.1.mlp.fc2.weight", "layers.4.residual_group.blocks.1.mlp.fc2.b ias", "layers.4.residual_group.blocks.2.norm1.weight", "layers.4.residual_group.blocks.2.norm1.bias", "layers.4.residual_gro up.blocks.2.attn.relative_position_bias_table", "layers.4.residual_group.blocks.2.attn.relative_position_index", "layers.4.r esidual_group.blocks.2.attn.qkv.weight", "layers.4.residual_group.blocks.2.attn.qkv.bias", "layers.4.residual_group.blocks.2 .attn.proj.weight", "layers.4.residual_group.blocks.2.attn.proj.bias", "layers.4.residual_group.blocks.2.norm2.weight", "lay ers.4.residual_group.blocks.2.norm2.bias", "layers.4.residual_group.blocks.2.mlp.fc1.weight", "layers.4.residual_group.block s.2.mlp.fc1.bias", "layers.4.residual_group.blocks.2.mlp.fc2.weight", "layers.4.residual_group.blocks.2.mlp.fc2.bias", "laye rs.4.residual_group.blocks.3.attn_mask", "layers.4.residual_group.blocks.3.norm1.weight", "layers.4.residual_group.blocks.3. norm1.bias", "layers.4.residual_group.blocks.3.attn.relative_position_bias_table", "layers.4.residual_group.blocks.3.attn.re lative_position_index", "layers.4.residual_group.blocks.3.attn.qkv.weight", "layers.4.residual_group.blocks.3.attn.qkv.bias" , "layers.4.residual_group.blocks.3.attn.proj.weight", "layers.4.residual_group.blocks.3.attn.proj.bias", "layers.4.residual _group.blocks.3.norm2.weight", "layers.4.residual_group.blocks.3.norm2.bias", "layers.4.residual_group.blocks.3.mlp.fc1.weig ht", "layers.4.residual_group.blocks.3.mlp.fc1.bias", "layers.4.residualgroup.blocks.3.mlp.fc2.weight", "layers.4.residual group.blocks.3.mlp.fc2.bias", "layers.4.residual_group.blocks.4.norm1.weight", "layers.4.residual_group.blocks.4.norm1.bias" , "layers.4.residual_group.blocks.4.attn.relative_position_bias_table", "layers.4.residual_group.blocks.4.attn.relative_posi tion_index", "layers.4.residual_group.blocks.4.attn.qkv.weight", "layers.4.residual_group.blocks.4.attn.qkv.bias", "layers.4 .residual_group.blocks.4.attn.proj.weight", "layers.4.residual_group.blocks.4.attn.proj.bias", "layers.4.residual_group.bloc ks.4.norm2.weight", "layers.4.residual_group.blocks.4.norm2.bias", "layers.4.residual_group.blocks.4.mlp.fc1.weight", "layer s.4.residual_group.blocks.4.mlp.fc1.bias", "layers.4.residual_group.blocks.4.mlp.fc2.weight", "layers.4.residual_group.block s.4.mlp.fc2.bias", "layers.4.residual_group.blocks.5.attn_mask", "layers.4.residual_group.blocks.5.norm1.weight", "layers.4. residual_group.blocks.5.norm1.bias", "layers.4.residual_group.blocks.5.attn.relative_position_bias_table", "layers.4.residua l_group.blocks.5.attn.relative_position_index", "layers.4.residual_group.blocks.5.attn.qkv.weight", "layers.4.residual_group .blocks.5.attn.qkv.bias", "layers.4.residual_group.blocks.5.attn.proj.weight", "layers.4.residual_group.blocks.5.attn.proj.b ias", "layers.4.residual_group.blocks.5.norm2.weight", "layers.4.residual_group.blocks.5.norm2.bias", "layers.4.residual_gro up.blocks.5.mlp.fc1.weight", "layers.4.residual_group.blocks.5.mlp.fc1.bias", "layers.4.residual_group.blocks.5.mlp.fc2.weig ht", "layers.4.residual_group.blocks.5.mlp.fc2.bias", "layers.4.conv.weight", "layers.4.conv.bias", "layers.5.residual_group .blocks.0.norm1.weight", "layers.5.residual_group.blocks.0.norm1.bias", "layers.5.residual_group.blocks.0.attn.relative_posi tion_bias_table", "layers.5.residual_group.blocks.0.attn.relative_position_index", "layers.5.residual_group.blocks.0.attn.qk v.weight", "layers.5.residual_group.blocks.0.attn.qkv.bias", "layers.5.residual_group.blocks.0.attn.proj.weight", "layers.5. residual_group.blocks.0.attn.proj.bias", "layers.5.residual_group.blocks.0.norm2.weight", "layers.5.residual_group.blocks.0. norm2.bias", "layers.5.residual_group.blocks.0.mlp.fc1.weight", "layers.5.residual_group.blocks.0.mlp.fc1.bias", "layers.5.r esidual_group.blocks.0.mlp.fc2.weight", "layers.5.residual_group.blocks.0.mlp.fc2.bias", "layers.5.residual_group.blocks.1.a ttn_mask", "layers.5.residual_group.blocks.1.norm1.weight", "layers.5.residual_group.blocks.1.norm1.bias", "layers.5.residua l_group.blocks.1.attn.relative_position_bias_table", "layers.5.residual_group.blocks.1.attn.relative_position_index", "layer s.5.residual_group.blocks.1.attn.qkv.weight", "layers.5.residual_group.blocks.1.attn.qkv.bias", "layers.5.residual_group.blo cks.1.attn.proj.weight", "layers.5.residual_group.blocks.1.attn.proj.bias", "layers.5.residual_group.blocks.1.norm2.weight", "layers.5.residual_group.blocks.1.norm2.bias", "layers.5.residual_group.blocks.1.mlp.fc1.weight", "layers.5.residual_group. blocks.1.mlp.fc1.bias", "layers.5.residual_group.blocks.1.mlp.fc2.weight", "layers.5.residual_group.blocks.1.mlp.fc2.bias", "layers.5.residual_group.blocks.2.norm1.weight", "layers.5.residual_group.blocks.2.norm1.bias", "layers.5.residual_group.blo cks.2.attn.relative_position_bias_table", "layers.5.residual_group.blocks.2.attn.relative_position_index", "layers.5.residua l_group.blocks.2.attn.qkv.weight", "layers.5.residual_group.blocks.2.attn.qkv.bias", "layers.5.residual_group.blocks.2.attn. proj.weight", "layers.5.residual_group.blocks.2.attn.proj.bias", "layers.5.residual_group.blocks.2.norm2.weight", "layers.5. residual_group.blocks.2.norm2.bias", "layers.5.residual_group.blocks.2.mlp.fc1.weight", "layers.5.residual_group.blocks.2.ml p.fc1.bias", "layers.5.residual_group.blocks.2.mlp.fc2.weight", "layers.5.residual_group.blocks.2.mlp.fc2.bias", "layers.5.r esidual_group.blocks.3.attn_mask", "layers.5.residual_group.blocks.3.norm1.weight", "layers.5.residual_group.blocks.3.norm1. bias", "layers.5.residual_group.blocks.3.attn.relative_position_bias_table", "layers.5.residual_group.blocks.3.attn.relative _position_index", "layers.5.residual_group.blocks.3.attn.qkv.weight", "layers.5.residual_group.blocks.3.attn.qkv.bias", "lay ers.5.residual_group.blocks.3.attn.proj.weight", "layers.5.residual_group.blocks.3.attn.proj.bias", "layers.5.residual_group .blocks.3.norm2.weight", "layers.5.residual_group.blocks.3.norm2.bias", "layers.5.residual_group.blocks.3.mlp.fc1.weight", " layers.5.residual_group.blocks.3.mlp.fc1.bias", "layers.5.residual_group.blocks.3.mlp.fc2.weight", "layers.5.residual_group. blocks.3.mlp.fc2.bias", "layers.5.residual_group.blocks.4.norm1.weight", "layers.5.residual_group.blocks.4.norm1.bias", "lay ers.5.residual_group.blocks.4.attn.relative_position_bias_table", "layers.5.residual_group.blocks.4.attn.relative_position_i ndex", "layers.5.residual_group.blocks.4.attn.qkv.weight", "layers.5.residual_group.blocks.4.attn.qkv.bias", "layers.5.resid ual_group.blocks.4.attn.proj.weight", "layers.5.residual_group.blocks.4.attn.proj.bias", "layers.5.residual_group.blocks.4.n orm2.weight", "layers.5.residual_group.blocks.4.norm2.bias", "layers.5.residual_group.blocks.4.mlp.fc1.weight", "layers.5.re sidual_group.blocks.4.mlp.fc1.bias", "layers.5.residual_group.blocks.4.mlp.fc2.weight", "layers.5.residual_group.blocks.4.ml p.fc2.bias", "layers.5.residual_group.blocks.5.attn_mask", "layers.5.residual_group.blocks.5.norm1.weight", "layers.5.residu al_group.blocks.5.norm1.bias", "layers.5.residual_group.blocks.5.attn.relative_position_bias_table", "layers.5.residual_grou p.blocks.5.attn.relative_position_index", "layers.5.residual_group.blocks.5.attn.qkv.weight", "layers.5.residual_group.block s.5.attn.qkv.bias", "layers.5.residual_group.blocks.5.attn.proj.weight", "layers.5.residual_group.blocks.5.attn.proj.bias", "layers.5.residual_group.blocks.5.norm2.weight", "layers.5.residual_group.blocks.5.norm2.bias", "layers.5.residual_group.blo cks.5.mlp.fc1.weight", "layers.5.residual_group.blocks.5.mlp.fc1.bias", "layers.5.residual_group.blocks.5.mlp.fc2.weight", " layers.5.residual_group.blocks.5.mlp.fc2.bias", "layers.5.conv.weight", "layers.5.conv.bias", "norm.weight", "norm.bias", "c onv_after_body.weight", "conv_after_body.bias", "conv_before_upsample.0.weight", "conv_before_upsample.0.bias", "upsample.0. weight", "upsample.0.bias", "upsample.2.weight", "upsample.2.bias", "conv_last.weight", "conv_last.bias". Unexpected key(s) in state_dict: "params".

lbc12345 commented 5 months ago

This is because official SwinIR code stores their weights using an extra key called "params". You can modify the line 107 of train.py into "model.load_state_dict(ckpt['params'])"

JeffreyYANGS commented 5 months ago

Thanks for the answer, pls if there is a problem with my data_root and data_test_root: parser.add_argument('--data_root', type=str, default='./datasets/DF2K') parser.add_argument('--data_test_root', type=str, default='./Evaluation') When doing testing, can you only test one dataset at a time? The following error was reported: Traceback (most recent call last): File "F:\SeD-main\train.py", line 359, in main()
File "F:\SeD-main\train.py", line 194, in main for lr, hr, filename in data_loader: # 遍历数据加载器返回的每个批次数据 File "F:\SeD-main\venv\Lib\site-packages\torch\utils\data\dataloader.py", line 631, in next data = self._next_data() ^^^^^^^^^^^^^^^^^ File "F:\SeD-main\venv\Lib\site-packages\torch\utils\data\dataloader.py", line 1346, in _next_data return self._process_data(data) ^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\SeD-main\venv\Lib\site-packages\torch\utils\data\dataloader.py", line 1372, in _process_data data.reraise() File "F:\SeD-main\venv\Lib\site-packages\torch_utils.py", line 722, in reraise raise exception IndexError: Caught IndexError in DataLoader worker process 0. Original Traceback (most recent call last): File "F:\SeD-main\venv\Lib\site-packages\torch\utils\data_utils\worker.py", line 308, in _worker_loop data = fetcher.fetch(index) ^^^^^^^^^^^^^^^^^^^^ File "F:\SeD-main\venv\Lib\site-packages\torch\utils\data_utils\fetch.py", line 51, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\SeD-main\venv\Lib\site-packages\torch\utils\data_utils\fetch.py", line 51, in data = [self.dataset[idx] for idx in possibly_batched_index]


  File "F:\SeD-main\datasets\srdata.py", line 29, in __getitem__
    lr = cv2.imread(self.images_lr[idx])
                    ~~~~~~~~~~~~~~^^^^^
IndexError: list index out of range
JeffreyYANGS commented 5 months ago

The dataset used to run me can run through。 If I use the weights you provided for SwinIR to train my dataset, please ask if this result is valid, below is the log file that I just ran through: 24-05-28 17:23:14.282 : Epoch: 0, Step: 500, psnr: 30.512115462428902. ssim: 0.812429659841052. 24-05-28 17:23:14.282 : Max_psnr: 30.512115462428902. Max_ssim: 0.8126843511865521. 24-05-28 17:23:15.677 : Training Done

lbc12345 commented 5 months ago

It seems nothing wrong.