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