Open JeffreyYANGS opened 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
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
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.
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.
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.
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
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.
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?
Hi, you can use the powerful python package pyiqa to calculate LPIPS, we will add these to our code, thanks for your advice!
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
What's your error message?
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
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'])"
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
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
File "F:\SeD-main\datasets\srdata.py", line 29, in __getitem__
lr = cv2.imread(self.images_lr[idx])
~~~~~~~~~~~~~~^^^^^
IndexError: list index out of range
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
It seems nothing wrong.
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'