caiyuanhao1998 / Retinexformer

"Retinexformer: One-stage Retinex-based Transformer for Low-light Image Enhancement" (ICCV 2023) & (NTIRE 2024 Challenge)
https://arxiv.org/abs/2303.06705
MIT License
828 stars 64 forks source link

Fix for code #80

Closed zelenooki87 closed 3 months ago

zelenooki87 commented 3 months ago

Getting this error for some files.

===>Testing using weights:  pretrained_weights/FiveK.pth
C:\Users\Miki\Retinexformer\input
C:\Users\Miki\Retinexformer\input
  0%|                                                                                            | 0/3 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "C:\Users\Miki\Retinexformer\Enhancement\test_from_dataset.py", line 251, in <module>
    restored_1 = model_restoration(input_1, model_restoration)
  File "C:\Users\Miki\anaconda3\envs\mika\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\Users\Miki\anaconda3\envs\mika\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\Users\Miki\anaconda3\envs\mika\lib\site-packages\torch\nn\parallel\data_parallel.py", line 183, in forward
    return self.module(*inputs[0], **module_kwargs[0])
  File "C:\Users\Miki\anaconda3\envs\mika\lib\site-packages\torch\nn\modules\module.py", line 1532, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\Users\Miki\anaconda3\envs\mika\lib\site-packages\torch\nn\modules\module.py", line 1541, in _call_impl
    return forward_call(*args, **kwargs)
TypeError: RetinexFormer.forward() takes 2 positional arguments but 3 were given

part of code which causes error that need to be change: test_from_dataset.py

else: restored_1 = model_restoration(input_1, model_restoration) restored_2 = model_restoration(input_2, model_restoration)

Need to be changed to:

else: restored_1 = model_restoration(input_1) restored_2 = model_restoration(input_2)

Now code perfectly runs on windows for all size of images. :)

caiyuanhao1998 commented 3 months ago

Hi, thanks for letting me know. This is a copy-paste typo when I reorganize the testing code. Appreciate it, bro.