ckkelvinchan / BasicVSR_PlusPlus

Official repository of "BasicVSR++: Improving Video Super-Resolution with Enhanced Propagation and Alignment"
Apache License 2.0
589 stars 64 forks source link

Can't deblur and denoise #24

Open CarlGao4 opened 1 year ago

CarlGao4 commented 1 year ago

Command and error message:

> python .\BasicVSR_PlusPlus\demo\restoration_video_demo.py .\BasicVSR_PlusPlus\configs\basicvsr_plusplus_denoise.py .\basicvsr_plusplus_denoise-28f6920c.pth .\1_3s_super_resolution\input .\1_3s_super_resolution\output1 --max-seq-len 1
2023-01-27 18:46:25,484 - mmedit - INFO - load checkpoint from http path: https://download.openmmlab.com/mmediting/restorers/basicvsr/spynet_20210409-c6c1bd09.pth
load checkpoint from local path: .\basicvsr_plusplus_denoise-28f6920c.pth
...\envs\BasicVSR\lib\site-packages\torch\functional.py:504: 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:3191.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
Traceback (most recent call last):
  File "...\BasicVSR_PlusPlus\demo\restoration_video_demo.py", line 86, in <module>
    main()
  File "...\BasicVSR_PlusPlus\demo\restoration_video_demo.py", line 62, in main
    output = restoration_video_inference(model, args.input_dir,
  File "...\basicvsr_plusplus\mmedit\apis\restoration_video_inference.py", line 125, in restoration_video_inference
    model(
  File "...\envs\BasicVSR\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "...\envs\BasicVSR\lib\site-packages\mmcv\runner\fp16_utils.py", line 116, in new_func
    return old_func(*args, **kwargs)
  File "...\basicvsr_plusplus\mmedit\models\restorers\basic_restorer.py", line 75, in forward
    return self.forward_test(lq, gt, **kwargs)
  File "...\basicvsr_plusplus\mmedit\models\restorers\basicvsr.py", line 175, in forward_test
    output = self.generator(lq)
  File "...\envs\BasicVSR\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "...\basicvsr_plusplus\mmedit\models\backbones\sr_backbones\basicvsr_pp.py", line 348, in forward
    feats = self.propagate(feats, flows, module)
  File "...\basicvsr_plusplus\mmedit\models\backbones\sr_backbones\basicvsr_pp.py", line 228, in propagate
    feat = torch.cat(feat, dim=1)
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 135 but got size 134 for tensor number 1 in the list.

I've changed some private paths to "...", some of them contain Chinese characters, but I think this doesn't cause this error.

CarlGao4 commented 1 year ago

pip list:

Package                 Version      Editable project location
----------------------- ------------ ----------------------------------
absl-py                 1.4.0
addict                  2.4.0
asttokens               2.2.1
av                      10.0.0
backcall                0.2.0
cachetools              5.3.0
certifi                 2022.12.7
charset-normalizer      3.0.1
click                   8.1.3
colorama                0.4.6
contourpy               1.0.7
cycler                  0.11.0
decorator               5.1.1
executing               1.2.0
facexlib                0.2.5
filterpy                1.4.5
fonttools               4.38.0
google-auth             2.16.0
google-auth-oauthlib    0.4.6
grpcio                  1.51.1
idna                    3.4
ipython                 8.8.0
jedi                    0.18.2
kiwisolver              1.4.4
llvmlite                0.39.1
lmdb                    1.4.0
Markdown                3.4.1
markdown-it-py          2.1.0
MarkupSafe              2.1.2
matplotlib              3.6.3
matplotlib-inline       0.1.6
mdurl                   0.1.2
mmcv-full               1.6.0
mmedit                  0.14.0
model-index             0.1.11
numba                   0.56.4
numpy                   1.23.5
oauthlib                3.2.2
opencv-python           4.5.4.60
openmim                 0.3.5
ordered-set             4.1.0
packaging               23.0
pandas                  1.5.3
parso                   0.8.3
pickleshare             0.7.5
Pillow                  9.4.0
pip                     22.3.1
prompt-toolkit          3.0.36
protobuf                3.20.3
pure-eval               0.2.2
pyasn1                  0.4.8
pyasn1-modules          0.2.8
Pygments                2.14.0
pyparsing               3.0.9
python-dateutil         2.8.2
pytz                    2022.7.1
PyYAML                  6.0
regex                   2022.10.31
requests                2.28.2
requests-oauthlib       1.3.1
rich                    13.2.0
rsa                     4.9
scipy                   1.10.0
setuptools              66.1.1
six                     1.16.0
stack-data              0.6.2
tabulate                0.9.0
tensorboard             2.11.2
tensorboard-data-server 0.6.1
tensorboard-plugin-wit  1.8.1
torch                   1.13.1+cu117
torchaudio              0.13.1+cu117
torchvision             0.14.1+cu117
tqdm                    4.64.1
traitlets               5.8.1
typing_extensions       4.4.0
urllib3                 1.26.14
wcwidth                 0.2.6
Werkzeug                2.2.2
wheel                   0.38.4
yapf                    0.32.0
ckkelvinchan commented 1 year ago

This is related to the padding. You can first pad the input resolution to a multiple of 4, then crop it back after processing. I may modify it later when I have time.