def main_thread():
# Build the model and load the pre-trained weights on MPII
model = posereg.build(input_shape, pa16j.num_joints, export_heatmaps=True)
weights_path = get_file(weights_file, TF_WEIGHTS_PATH, md5_hash=md5_hash,
cache_subdir=cache_subdir)
model.load_weights(weights_path)
queue_frames = queue.Queue(2)
queue_poses = queue.Queue(2)
proc = threading.Thread(target=thread_grab_frames,
args=(queue_frames, queue_poses))
proc.daemon = True
proc.start()
clock = pygame.time.Clock()
show_fps_cnt = 0
while True:
x = queue_frames.get()
pred = model.predict(x)
pred.append(x) # Append the input frame
queue_poses.put(pred)
clock.tick()
show_fps_cnt += 1
if show_fps_cnt == 10:
show_fps_cnt = 0
print ('fps: ' + str(clock.get_fps()))
评论列表
文章目录