Now i find solution and want to share with you:
def callback(self, infer_request, info):
frame, input_hw = info
res = infer_request.get_output_tensor(0).data
detections = self.postprocess(pred_boxes=res, input_hw=input_hw, orig_img=frame)
self.det_storage.append(detections[0]["det"])
def draw_bounding_boxes(self, frame: Any) -> Any:
frame_copy = frame.copy()
fg_mask = self.back_sub.apply(frame_copy)
preprocess_image = self.preprocess_image(frame_copy)
input_tensor = self.image_to_tensor(preprocess_image)
input_hw = input_tensor.shape[2:]
infer_queue = AsyncInferQueue(self.model, 4)
infer_queue.set_callback(self.callback)
infer_queue.start_async(inputs={0: input_tensor}, userdata=(frame_copy, input_hw))
infer_queue.wait_all()
model_detections = self.det_storage.pop(0)
detections = []
for result in model_detections: