-
Notifications
You must be signed in to change notification settings - Fork 665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Got error when running on Windows 10. #91
Comments
Hi I got the same issue. With the following instruction, I createda new function main() which wrap the whole code except for import part (see below) and called it. here. it is noted a variable name (model) needs to be changes to avoid error (
The issue problem disappered in my windows 10 environment. Good. However when running the example line I just got the following
when running
in demo.sh |
The repored additional issue (cannot test even if fixing windows) was solved as I mentioned in #115. i.e.
|
My merge requst fixed the following error. It works fine if we don't specify --save_results.
However, if I included --save_results, we had the following error even if with the patch.
When I commented out self.ckp.begin_background() and self.ckp.end_background() as mentioned in #105 and set --save_results --n_threads 1, I got
It seems not suprising because if we commented out self.ckp.begin_background() , we don't create queue in the first place. If I set --n_threads 0 in stead of --n_threads 1 in addition to the above changes, I got
In summary, I think my merge request is valid, but it seems more modifications would be necesary if we want to save results. So it works if we don't specift --save_results
|
I also can't save images when using --save_results which could call a multiprocess module in win10. def test(self):
torch.set_grad_enabled(False)
epoch = self.optimizer.get_last_epoch() + 1
self.ckp.write_log('\nEvaluation:')
self.ckp.add_log(
torch.zeros(1, len(self.loader_test), len(self.scale))
)
self.model.eval()
timer_test = utility.timer()
if self.args.save_results: self.ckp.begin_background()
for idx_data, d in enumerate(self.loader_test):
for idx_scale, scale in enumerate(self.scale):
d.dataset.set_scale(idx_scale)
for lr, hr, filename, _ in tqdm(d, ncols=80):
lr, hr = self.prepare(lr, hr)
sr = self.model(lr, idx_scale)
sr = utility.quantize(sr, self.args.rgb_range)
save_list = [sr]
self.ckp.log[-1, idx_data, idx_scale] += utility.calc_psnr(
sr, hr, scale, self.args.rgb_range, dataset=d
)
if self.args.save_gt:
save_list.extend([lr, hr])
if self.args.save_results:
self.ckp.save_results(d, filename[0], save_list, scale)
#add by wfli
postfix = ('SR', 'LR', 'HR')
for v, p in zip(save_list, postfix):
normalized = v[0].mul(255 / self.args.rgb_range)
tensor_cpu = normalized.byte().permute(1, 2, 0).cpu()
imageio.imwrite(('..\\experiment\\test\\results-{}\\{}_x{}_{}.png'.format(d.dataset.name,filename[0],scale, p)), tensor_cpu.numpy())
#add by wfli
self.ckp.log[-1, idx_data, idx_scale] /= len(d)
best = self.ckp.log.max(0)
self.ckp.write_log(
'[{} x{}]\tPSNR: {:.3f} (Best: {:.3f} @epoch {})'.format(
d.dataset.name,
scale,
self.ckp.log[-1, idx_data, idx_scale],
best[0][idx_data, idx_scale],
best[1][idx_data, idx_scale] + 1
)
)
self.ckp.write_log('Forward: {:.2f}s\n'.format(timer_test.toc()))
self.ckp.write_log('Saving...')]
|
same issue in win10 python 3.7.8 torch 1.2, |
Hi, I tried to run These are the works I have done so far to fix the errors :error 1: AttributeError: Can't pickle local object 'checkpoint.begin_background..bg_target' error 2 : AttributeError: 'checkpoint' object has no attribute 'queue' error 3 : [WinError 1455] The paging file is too small for this operation to complete. also my system settings :windows 8.1 The result i get now is this :
Question :Why the psnr is always zero even if I put a few images in the file or it would be nan if i use benchmark data? Thank you for your help |
I have same question,Why the psnr is always zero even? train:--model EDSR --scale 2 --patch_size 96 --save edsr_baseline_x2 --reset |
Hi, I got some error when I ran the test process on Windows 10 system with python 3.6.5 + pytorch 0.4.1 + cuda9.2.
I'm using this line of the demo file:
python main.py --data_test Demo --scale 4 --pre_train download --test_only --save_results --n_threads 0
The error message is:
Making model...
Download the model
Evaluation:
Traceback (most recent call last):
File "main.py", line 23, in
while not t.terminate():
File "D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src\trainer.py", line 139, in terminate
self.test()
File "D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src\trainer.py", line 83, in test
if self.args.save_results: self.ckp.begin_background()
File "D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src\utility.py", line 141, in begin_background
for p in self.process: p.start()
File "C:\Users\Zz\Anaconda3\lib\multiprocessing\process.py", line 105, in start
self._popen = self._Popen(self)
File "C:\Users\Zz\Anaconda3\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Users\Zz\Anaconda3\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "C:\Users\Zz\Anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 65, in init
reduction.dump(process_obj, to_child)
File "C:\Users\Zz\Anaconda3\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'checkpoint.begin_background..bg_target'
(C:\Users\Zz\Anaconda3) D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src>Making model...
Download the model
Evaluation:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Zz\Anaconda3\lib\multiprocessing\spawn.py", line 105, in spawn_main
exitcode = _main(fd)
File "C:\Users\Zz\Anaconda3\lib\multiprocessing\spawn.py", line 114, in _main
prepare(preparation_data)
File "C:\Users\Zz\Anaconda3\lib\multiprocessing\spawn.py", line 225, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "C:\Users\Zz\Anaconda3\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
run_name="mp_main")
File "C:\Users\Zz\Anaconda3\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "C:\Users\Zz\Anaconda3\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\Users\Zz\Anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src\main.py", line 23, in
while not t.terminate():
File "D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src\trainer.py", line 139, in terminate
self.test()
File "D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src\trainer.py", line 83, in test
if self.args.save_results: self.ckp.begin_background()
File "D:\EDSR-PyTorch-master\EDSR-PyTorch-master\src\utility.py", line 141, in begin_background
for p in self.process: p.start()
File "C:\Users\Zz\Anaconda3\lib\multiprocessing\process.py", line 105, in start
self._popen = self._Popen(self)
File "C:\Users\Zz\Anaconda3\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Users\Zz\Anaconda3\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "C:\Users\Zz\Anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 33, in init
prep_data = spawn.get_preparation_data(process_obj._name)
File "C:\Users\Zz\Anaconda3\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
_check_not_importing_main()
File "C:\Users\Zz\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.
Please give some suggestion to help me deal with it. Thanks.
The text was updated successfully, but these errors were encountered: