You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HI
I will ask you a new question.
When i tried to use this code to test my own images, one error happened:
matplotlib.use('Agg')
Making model...
Download the model
Evaluation:
Traceback (most recent call last):
File "", line 1, in
runfile('F:/代码/EDSR-PyTorch-master/src/main.py', args='--data_test Demo --scale 4 --pre_train download --test_only --save_results', wdir='F:/代码/EDSR-PyTorch-master/src')
File "F:\anaconda\conda\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 668, in runfile
execfile(filename, namespace)
File "F:\anaconda\conda\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "F:/代码/EDSR-PyTorch-master/src/main.py", line 24, in
while not t.terminate():
File "F:\代码\EDSR-PyTorch-master\src\trainer.py", line 139, in terminate
self.test()
File "F:\代码\EDSR-PyTorch-master\src\trainer.py", line 83, in test
if self.args.save_results: self.ckp.begin_background()
File "F:\代码\EDSR-PyTorch-master\src\utility.py", line 141, in begin_background
for p in self.process: p.start()
File "F:\anaconda\conda\lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "F:\anaconda\conda\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "F:\anaconda\conda\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "F:\anaconda\conda\lib\multiprocessing\popen_spawn_win32.py", line 65, in init
reduction.dump(process_obj, to_child)
File "F:\anaconda\conda\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'checkpoint.begin_background..bg_target'
The text was updated successfully, but these errors were encountered:
Hello,
I had the same error and worked it around by taking out the bg_target method inside begin_background() and making it a static method of the checkpoint class (in src/utility.py around line 130)
Code sample :
@staticmethod
def bg_target(queue):
while True:
if not queue.empty():
filename, tensor = queue.get()
if filename is None: break
imageio.imwrite(filename, tensor.numpy())
def begin_background(self):
self.queue = Queue()
self.process = [
Process(target=self.bg_target, args=(self.queue,)) \
for _ in range(self.n_processes)
]
for p in self.process: p.start()
HI
I will ask you a new question.
When i tried to use this code to test my own images, one error happened:
matplotlib.use('Agg')
Making model...
Download the model
Evaluation:
Traceback (most recent call last):
File "", line 1, in
runfile('F:/代码/EDSR-PyTorch-master/src/main.py', args='--data_test Demo --scale 4 --pre_train download --test_only --save_results', wdir='F:/代码/EDSR-PyTorch-master/src')
File "F:\anaconda\conda\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 668, in runfile
execfile(filename, namespace)
File "F:\anaconda\conda\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "F:/代码/EDSR-PyTorch-master/src/main.py", line 24, in
while not t.terminate():
File "F:\代码\EDSR-PyTorch-master\src\trainer.py", line 139, in terminate
self.test()
File "F:\代码\EDSR-PyTorch-master\src\trainer.py", line 83, in test
if self.args.save_results: self.ckp.begin_background()
File "F:\代码\EDSR-PyTorch-master\src\utility.py", line 141, in begin_background
for p in self.process: p.start()
File "F:\anaconda\conda\lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "F:\anaconda\conda\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "F:\anaconda\conda\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "F:\anaconda\conda\lib\multiprocessing\popen_spawn_win32.py", line 65, in init
reduction.dump(process_obj, to_child)
File "F:\anaconda\conda\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'checkpoint.begin_background..bg_target'
The text was updated successfully, but these errors were encountered: