sanghyun-son / EDSR-PyTorch

PyTorch version of the paper 'Enhanced Deep Residual Networks for Single Image Super-Resolution' (CVPRW 2017)
MIT License
2.42k stars 668 forks source link

ValueError: not enough values to unpack (expected 4, got 3) #25

Closed f11894 closed 6 years ago

f11894 commented 6 years ago

Hi, Thank you for providing excellent super resolution technology. I wanted to test the behavior and I ran the following command and I got an error.

C:\Users\yusuke\EDSR-PyTorch\code>python main.py --data_test Demo --cpu --scale 4 --n_threads 0 --pre_train ../experiment/model/EDSR_baseline_x4.pt --test_only --save_results Making model... Loading model from ../experiment/model/EDSR_baseline_x4.pt

Evaluation: 0%| | 0/1 [00:00<?, ?it/s] Traceback (most recent call last): File "main.py", line 18, in while not t.terminate(): File "C:\Users\yusuke\EDSR-PyTorch\code\trainer.py", line 136, in terminate self.test() File "C:\Users\yusuke\EDSR-PyTorch\code\trainer.py", line 88, in test for idximg, (lr, hr, filename, ) in enumerate(tqdm_test): ValueError: not enough values to unpack (expected 4, got 3)

Windows 10 64bit

Anaconda 4.5.0 Python 3.6.4 pytorch 0.3.1.post2 torchvision 0.2.0

sanghyun-son commented 6 years ago

Hello.

I tested your script, and found that --n_threads 0 is the problem.

Would you try --n_threads 1? (I checked that it works without any error on Ubuntu 16.04.)

Because I do not use PyTorch@Windows, it may take some times to fix this problem.

Thank you.

f11894 commented 6 years ago

I tried --n_threads 1 but the operation stopped.

C:\Users\yusuke\EDSR-PyTorch\code>python main.py --data_test Demo --cpu --scale 4 --n_threads 1 --pre_train ../experiment/model/EDSR_baseline_x4.pt --test_only --save_results Making model... Loading model from ../experiment/model/EDSR_baseline_x4.pt

Evaluation: 0%| | 0/1 [00:00<?, ?it/s]Making model... Loading model from ../experiment/model/EDSR_baseline_x4.pt

Evaluation: 0%| | 0/1 [00:00<?, ?it/s]Traceback (most recent call last): File "", line 1, in File "C:\Users\yusuke\Anaconda3\lib\multiprocessing\spawn.py", line 105, in spawn_main exitcode = _main(fd) File "C:\Users\yusuke\Anaconda3\lib\multiprocessing\spawn.py", line 114, in _main prepare(preparation_data) File "C:\Users\yusuke\Anaconda3\lib\multiprocessing\spawn.py", line 225, in prepare _fixup_main_from_path(data['init_main_from_path']) File "C:\Users\yusuke\Anaconda3\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path run_name="mp_main__") File "C:\Users\yusuke\Anaconda3\lib\runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname) File "C:\Users\yusuke\Anaconda3\lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "C:\Users\yusuke\Anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\yusuke\EDSR-PyTorch\code\main.py", line 18, in while not t.terminate(): File "C:\Users\yusuke\EDSR-PyTorch\code\trainer.py", line 136, in terminate self.test() File "C:\Users\yusuke\EDSR-PyTorch\code\trainer.py", line 88, in test for idximg, (lr, hr, filename, ) in enumerate(tqdm_test): File "C:\Users\yusuke\Anaconda3\lib\site-packages\tqdm_tqdm.py", line 897, in iter for obj in iterable: File "C:\Users\yusuke\EDSR-PyTorch\code\dataloader.py", line 133, in iter return MSDataLoaderIter(self) File "C:\Users\yusuke\EDSR-PyTorch\code\dataloader.py", line 106, in init w.start() File "C:\Users\yusuke\Anaconda3\lib\multiprocessing\process.py", line 105, in start self._popen = self._Popen(self) File "C:\Users\yusuke\Anaconda3\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "C:\Users\yusuke\Anaconda3\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "C:\Users\yusuke\Anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 33, in init__ prep_data = spawn.get_preparation_data(process_obj._name) File "C:\Users\yusuke\Anaconda3\lib\multiprocessing\spawn.py", line 143, in get_preparation_data _check_not_importing_main() File "C:\Users\yusuke\Anaconda3\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main is not going to be frozen to produce an executable.''') RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.
ABDOELSHEMY commented 6 years ago

@f11894 to solve this you should return used {--nthreads 0 } as you in windows, and in trainer.py line 88 change (lr, hr, filename, ) to (lr, hr, filename), to get rid not enough values to unpack (expected 4, got 3) error, then every thing will work as he should.

f11894 commented 6 years ago

@ABDOELSHEMY That went well. Thank you.