Open dkluffy opened 4 years ago
更改之后,不用numpy
def shift_coords(func):
def shifter(*args):
co,st = func(*args)
# if ON_DEBUG:
# return co,st
#co = np.array(co)
#co_dalt = np.random.randint(0,20,co.shape)
for i in range(len(co)):
co[i] = (co[i][0]+random.randint(1,20),co[i][1]+random.randint(1,20))
#co = co + co_dalt
return co,st
return shifter
@shift_coords
def matcher_comm(input_img,targets):
coords = []
status = []
for t in targets.keys():
pts = match_gray(input_img,targets[t])
if len(pts)>0:
coords+=pts
status+=([t]*len(pts))
return coords,status
Warning: some status, don't have valide image
Traceback (most recent call last):
File "i:/Code_Public/Gamescripts/main.py", line 62, in <module>
p_list.append(comm_task_on_pc(["test01"],10))
File "i:/Code_Public/Gamescripts/main.py", line 43, in comm_task_on_pc
p0.start()
File "I:\Anaconda3\lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "I:\Anaconda3\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "I:\Anaconda3\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "I:\Anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 89, in __init__
reduction.dump(process_obj, to_child)
File "I:\Anaconda3\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'shift_coords.<locals>.shifter'
(base) I:\Code_Public\Gamescripts>Traceback (most recent call last):
File "<string>", line 1, in <module>
File "I:\Anaconda3\lib\multiprocessing\spawn.py", line 99, in spawn_main
new_handle = reduction.steal_handle(parent_pid, pipe_handle)
File "I:\Anaconda3\lib\multiprocessing\reduction.py", line 82, in steal_handle
_winapi.PROCESS_DUP_HANDLE, False, source_pid)
OSError: [WinError 87] 参数错误。
去掉这个 装饰函数@shift_coords
就不会有这个错误~~~~
多进程下的报错,多线程模式没有