示例#1
0
		continue
	elif len(right_eye) == []:
		print('Right eye not detected')
		continue
	
	#HeadPoseEstimation
	head_inf, output_hp = net3.predict(fd_image, hp_shape)
	p, r, y, hp_vis = HeadPoseEstimation.preprocess_output(output_hp, frame.copy())
	head_time.append(head_inf)
	if args['hpv']:
		cv2.imshow('FD Vis', cv2.resize(hp_vis, (700, 500)))
		cv2.waitKey(1)
	head_pose_angles = np.array([[y, p, r]])

	#GazeEstimation
	out, gaze_inf = net4.ge_predict(head_pose_angles, left_eye, right_eye, hp_shape)
	gaze_time.append(gaze_inf)
	mouse.move(out[0][0], out[0][1])

	
avg_face_time =  sum(face_time) / len(face_time)
avg_land_time =  sum(land_time) / len(land_time)
avg_head_time =  sum(head_time) / len(head_time)
avg_gaze_time =  sum(gaze_time) / len(gaze_time)

# Write load time, inference time, and fps to txt file
with open(f"output/{args['output']}.txt", "w") as f:
	f.write(str(avg_face_time)+'\n')     #Average Face Detection Inference Time
	f.write(str(1/avg_face_time)+'\n')   #Face Detection FPS
	f.write(str(sum(face_time))+'\n')    #Total Face Detection Inference Time