如何加速多处理管理器?

问题描述

我创建了自己的管理器,因为我最终需要将类传递到不同的进程中。我使用以下代码做到了这一点。

class MyManager(BaseManager):
   pass
MyManager.register('modeling',modelingClass)
manager = MyManager()
manager.start()
model = manager.modeling()

for counter in count(start=0,step=1): # counts up infinitely starting at 0
   # get the latest image from the camera
   frame = get_latest_frame()
   if frame is None:
      break

   # run the model
   t1 = time.time()
   Boxes,confidences,classIDs = model.get_bounding_Boxes(frame,1,1)
   print("TIME",(time.time()-t1))

问题是模型的每次迭代大约需要 0.12 秒才能运行,但是如果我在没有多处理和管理器的情况下运行模型,并且只是类的正常初始化,它会在大约 0.07 秒内运行。知道如何加速多处理实现吗?谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)