class AgeApiRunner(object): def __init__(self, session_runner): self.__detection = AgeDetection() self.__detector_ip = self.__detection.get_in_pipe() self.__detector_op = self.__detection.get_out_pipe() self.__session_runner = session_runner self.__detection.use_session_runner(self.__session_runner) self.__detection.use_threading() self.__session_runner.start() self.__detection.run() def get_detector_ip(self): return self.__detector_ip def get_detector_op(self): return self.__detector_op
from tf_session.tf_session_runner import SessionRunner from tf_session.tf_session_utils import Inference import numpy as np cap = cv2.VideoCapture(-1) # cap = cv2.VideoCapture(videos_path.get()+'/Hitman Agent 47 - car chase scene HD.mp4') session_runner = SessionRunner() while True: ret, image = cap.read() if ret: break detection = AgeDetection() detector_ip = detection.get_in_pipe() detector_op = detection.get_out_pipe() detection.use_session_runner(session_runner) detection.use_threading() session_runner.start() detection.run() tracker = Sort() frame_no = 0 def read_video(): # start = time.time() while True: ret, image = cap.read() if not ret: continue