0

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

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 秒内运行。知道如何加快多处理实现吗?谢谢你。

4

0 回答 0