微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何加速多处理管理器?

如何解决如何加速多处理管理器?

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

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 举报,一经查实,本站将立刻删除。