def infer_loop(q_input, q_output): global nn, pre_process, post_process nn.init() while True: img_orig, fps = q_input.get() img = cv2.cvtColor(img_orig, cv2.COLOR_BGR2RGB) result, _, _ = run_inference(img, nn, pre_process, post_process) q_output.put((result, fps, img_orig))
def _run_inference(inputs): global nn, pre_process, post_process res, fps, fps_only_network = run_inference(inputs, nn, pre_process, post_process) return res, fps, fps_only_network
def _run_inference(img): global nn, pre_process, post_process img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) result, fps, _ = run_inference(img, nn, pre_process, post_process) return result, fps