From d5a26d595a8795a39c0b962fc10d3eb90decd1c9 Mon Sep 17 00:00:00 2001 From: homuler Date: Sat, 30 Jan 2021 15:30:51 +0900 Subject: [PATCH] use new calculators to detect iris landmarks --- mediapipe/graphs/iris_tracking/BUILD | 12 ++--- .../graphs/iris_tracking/iris_depth_cpu.pbtxt | 48 ++----------------- .../iris_tracking/iris_tracking_cpu.pbtxt | 48 ++----------------- .../iris_tracking_cpu_video_input.pbtxt | 48 ++----------------- .../iris_tracking/iris_tracking_gpu.pbtxt | 48 ++----------------- mediapipe/modules/iris_landmark/BUILD | 4 +- ...ft_and_right_from_face_landmarks_cpu.pbtxt | 4 +- ...ft_and_right_from_face_landmarks_gpu.pbtxt | 4 +- 8 files changed, 22 insertions(+), 194 deletions(-) diff --git a/mediapipe/graphs/iris_tracking/BUILD b/mediapipe/graphs/iris_tracking/BUILD index 86e667b80..e0062a1d4 100644 --- a/mediapipe/graphs/iris_tracking/BUILD +++ b/mediapipe/graphs/iris_tracking/BUILD @@ -30,10 +30,9 @@ cc_library( "//mediapipe/calculators/image:image_file_properties_calculator", "//mediapipe/calculators/image:opencv_encoded_image_to_image_frame_calculator", "//mediapipe/calculators/image:opencv_image_encoder_calculator", - "//mediapipe/graphs/iris_tracking/calculators:update_face_landmarks_calculator", "//mediapipe/graphs/iris_tracking/subgraphs:iris_and_depth_renderer_cpu", "//mediapipe/modules/face_landmark:face_landmark_front_cpu", - "//mediapipe/modules/iris_landmark:iris_landmark_left_and_right_cpu", + "//mediapipe/modules/iris_landmark:iris_landmark_left_and_right_from_face_landmarks_cpu", ], ) @@ -43,10 +42,9 @@ cc_library( "//mediapipe/calculators/core:constant_side_packet_calculator", "//mediapipe/calculators/core:flow_limiter_calculator", "//mediapipe/calculators/core:split_vector_calculator", - "//mediapipe/graphs/iris_tracking/calculators:update_face_landmarks_calculator", "//mediapipe/graphs/iris_tracking/subgraphs:iris_renderer_cpu", "//mediapipe/modules/face_landmark:face_landmark_front_cpu", - "//mediapipe/modules/iris_landmark:iris_landmark_left_and_right_cpu", + "//mediapipe/modules/iris_landmark:iris_landmark_left_and_right_from_face_landmarks_cpu", ], ) @@ -58,10 +56,9 @@ cc_library( "//mediapipe/calculators/core:split_vector_calculator", "//mediapipe/calculators/video:opencv_video_decoder_calculator", "//mediapipe/calculators/video:opencv_video_encoder_calculator", - "//mediapipe/graphs/iris_tracking/calculators:update_face_landmarks_calculator", "//mediapipe/graphs/iris_tracking/subgraphs:iris_renderer_cpu", "//mediapipe/modules/face_landmark:face_landmark_front_cpu", - "//mediapipe/modules/iris_landmark:iris_landmark_left_and_right_cpu", + "//mediapipe/modules/iris_landmark:iris_landmark_left_and_right_from_face_landmarks_cpu", ], ) @@ -71,10 +68,9 @@ cc_library( "//mediapipe/calculators/core:constant_side_packet_calculator", "//mediapipe/calculators/core:flow_limiter_calculator", "//mediapipe/calculators/core:split_vector_calculator", - "//mediapipe/graphs/iris_tracking/calculators:update_face_landmarks_calculator", "//mediapipe/graphs/iris_tracking/subgraphs:iris_and_depth_renderer_gpu", "//mediapipe/modules/face_landmark:face_landmark_front_gpu", - "//mediapipe/modules/iris_landmark:iris_landmark_left_and_right_gpu", + "//mediapipe/modules/iris_landmark:iris_landmark_left_and_right_from_face_landmarks_gpu", ], ) diff --git a/mediapipe/graphs/iris_tracking/iris_depth_cpu.pbtxt b/mediapipe/graphs/iris_tracking/iris_depth_cpu.pbtxt index 3597e7f53..8d67b5d07 100644 --- a/mediapipe/graphs/iris_tracking/iris_depth_cpu.pbtxt +++ b/mediapipe/graphs/iris_tracking/iris_depth_cpu.pbtxt @@ -82,40 +82,12 @@ node { } } -# Gets two landmarks which define left eye boundary. -node { - calculator: "SplitNormalizedLandmarkListCalculator" - input_stream: "face_landmarks" - output_stream: "left_eye_boundary_landmarks" - node_options: { - [type.googleapis.com/mediapipe.SplitVectorCalculatorOptions] { - ranges: { begin: 33 end: 34 } - ranges: { begin: 133 end: 134 } - combine_outputs: true - } - } -} - -# Gets two landmarks which define right eye boundary. -node { - calculator: "SplitNormalizedLandmarkListCalculator" - input_stream: "face_landmarks" - output_stream: "right_eye_boundary_landmarks" - node_options: { - [type.googleapis.com/mediapipe.SplitVectorCalculatorOptions] { - ranges: { begin: 362 end: 363 } - ranges: { begin: 263 end: 264 } - combine_outputs: true - } - } -} - # Detects iris landmarks, eye contour landmarks, and corresponding rect (ROI). node { - calculator: "IrisLandmarkLeftAndRightCpu" + calculator: "IrisLandmarkLeftAndRightFromFaceLandmarksCpu" input_stream: "IMAGE:input_image" - input_stream: "LEFT_EYE_BOUNDARY_LANDMARKS:left_eye_boundary_landmarks" - input_stream: "RIGHT_EYE_BOUNDARY_LANDMARKS:right_eye_boundary_landmarks" + input_stream: "FACE_LANDMARKS:face_landmarks" + output_stream: "UPDATED_FACE_LANDMARKS:updated_face_landmarks" output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks" output_stream: "LEFT_EYE_IRIS_LANDMARKS:left_iris_landmarks" output_stream: "LEFT_EYE_ROI:left_eye_rect_from_landmarks" @@ -124,20 +96,6 @@ node { output_stream: "RIGHT_EYE_ROI:right_eye_rect_from_landmarks" } -node { - calculator: "ConcatenateNormalizedLandmarkListCalculator" - input_stream: "left_eye_contour_landmarks" - input_stream: "right_eye_contour_landmarks" - output_stream: "refined_eye_landmarks" -} - -node { - calculator: "UpdateFaceLandmarksCalculator" - input_stream: "NEW_EYE_LANDMARKS:refined_eye_landmarks" - input_stream: "FACE_LANDMARKS:face_landmarks" - output_stream: "UPDATED_FACE_LANDMARKS:updated_face_landmarks" -} - # Renders annotations and overlays them on top of the input images. node { calculator: "IrisAndDepthRendererCpu" diff --git a/mediapipe/graphs/iris_tracking/iris_tracking_cpu.pbtxt b/mediapipe/graphs/iris_tracking/iris_tracking_cpu.pbtxt index c0a385757..cec2ff352 100644 --- a/mediapipe/graphs/iris_tracking/iris_tracking_cpu.pbtxt +++ b/mediapipe/graphs/iris_tracking/iris_tracking_cpu.pbtxt @@ -61,40 +61,12 @@ node { } } -# Gets two landmarks which define left eye boundary. -node { - calculator: "SplitNormalizedLandmarkListCalculator" - input_stream: "face_landmarks" - output_stream: "left_eye_boundary_landmarks" - node_options: { - [type.googleapis.com/mediapipe.SplitVectorCalculatorOptions] { - ranges: { begin: 33 end: 34 } - ranges: { begin: 133 end: 134 } - combine_outputs: true - } - } -} - -# Gets two landmarks which define right eye boundary. -node { - calculator: "SplitNormalizedLandmarkListCalculator" - input_stream: "face_landmarks" - output_stream: "right_eye_boundary_landmarks" - node_options: { - [type.googleapis.com/mediapipe.SplitVectorCalculatorOptions] { - ranges: { begin: 362 end: 363 } - ranges: { begin: 263 end: 264 } - combine_outputs: true - } - } -} - # Detects iris landmarks, eye contour landmarks, and corresponding rect (ROI). node { - calculator: "IrisLandmarkLeftAndRightCpu" + calculator: "IrisLandmarkLeftAndRightFromFaceLandmarksCpu" input_stream: "IMAGE:input_video" - input_stream: "LEFT_EYE_BOUNDARY_LANDMARKS:left_eye_boundary_landmarks" - input_stream: "RIGHT_EYE_BOUNDARY_LANDMARKS:right_eye_boundary_landmarks" + input_stream: "FACE_LANDMARKS:face_landmarks" + output_stream: "UPDATED_FACE_LANDMARKS:updated_face_landmarks" output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks" output_stream: "LEFT_EYE_IRIS_LANDMARKS:left_iris_landmarks" output_stream: "LEFT_EYE_ROI:left_eye_rect_from_landmarks" @@ -103,20 +75,6 @@ node { output_stream: "RIGHT_EYE_ROI:right_eye_rect_from_landmarks" } -node { - calculator: "ConcatenateNormalizedLandmarkListCalculator" - input_stream: "left_eye_contour_landmarks" - input_stream: "right_eye_contour_landmarks" - output_stream: "refined_eye_landmarks" -} - -node { - calculator: "UpdateFaceLandmarksCalculator" - input_stream: "NEW_EYE_LANDMARKS:refined_eye_landmarks" - input_stream: "FACE_LANDMARKS:face_landmarks" - output_stream: "UPDATED_FACE_LANDMARKS:updated_face_landmarks" -} - # Renders annotations and overlays them on top of the input images. node { calculator: "IrisRendererCpu" diff --git a/mediapipe/graphs/iris_tracking/iris_tracking_cpu_video_input.pbtxt b/mediapipe/graphs/iris_tracking/iris_tracking_cpu_video_input.pbtxt index 82229bdcb..bbbcea61d 100644 --- a/mediapipe/graphs/iris_tracking/iris_tracking_cpu_video_input.pbtxt +++ b/mediapipe/graphs/iris_tracking/iris_tracking_cpu_video_input.pbtxt @@ -64,40 +64,12 @@ node { } } -# Gets two landmarks which define left eye boundary. -node { - calculator: "SplitNormalizedLandmarkListCalculator" - input_stream: "face_landmarks" - output_stream: "left_eye_boundary_landmarks" - node_options: { - [type.googleapis.com/mediapipe.SplitVectorCalculatorOptions] { - ranges: { begin: 33 end: 34 } - ranges: { begin: 133 end: 134 } - combine_outputs: true - } - } -} - -# Gets two landmarks which define right eye boundary. -node { - calculator: "SplitNormalizedLandmarkListCalculator" - input_stream: "face_landmarks" - output_stream: "right_eye_boundary_landmarks" - node_options: { - [type.googleapis.com/mediapipe.SplitVectorCalculatorOptions] { - ranges: { begin: 362 end: 363 } - ranges: { begin: 263 end: 264 } - combine_outputs: true - } - } -} - # Detects iris landmarks, eye contour landmarks, and corresponding rect (ROI). node { - calculator: "IrisLandmarkLeftAndRightCpu" + calculator: "IrisLandmarkLeftAndRightFromFaceLandmarksCpu" input_stream: "IMAGE:input_video" - input_stream: "LEFT_EYE_BOUNDARY_LANDMARKS:left_eye_boundary_landmarks" - input_stream: "RIGHT_EYE_BOUNDARY_LANDMARKS:right_eye_boundary_landmarks" + input_stream: "FACE_LANDMARKS:face_landmarks" + output_stream: "UPDATED_FACE_LANDMARKS:updated_face_landmarks" output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks" output_stream: "LEFT_EYE_IRIS_LANDMARKS:left_iris_landmarks" output_stream: "LEFT_EYE_ROI:left_eye_rect_from_landmarks" @@ -106,20 +78,6 @@ node { output_stream: "RIGHT_EYE_ROI:right_eye_rect_from_landmarks" } -node { - calculator: "ConcatenateNormalizedLandmarkListCalculator" - input_stream: "left_eye_contour_landmarks" - input_stream: "right_eye_contour_landmarks" - output_stream: "refined_eye_landmarks" -} - -node { - calculator: "UpdateFaceLandmarksCalculator" - input_stream: "NEW_EYE_LANDMARKS:refined_eye_landmarks" - input_stream: "FACE_LANDMARKS:face_landmarks" - output_stream: "UPDATED_FACE_LANDMARKS:updated_face_landmarks" -} - # Renders annotations and overlays them on top of the input images. node { calculator: "IrisRendererCpu" diff --git a/mediapipe/graphs/iris_tracking/iris_tracking_gpu.pbtxt b/mediapipe/graphs/iris_tracking/iris_tracking_gpu.pbtxt index 505a9514d..944fb4586 100644 --- a/mediapipe/graphs/iris_tracking/iris_tracking_gpu.pbtxt +++ b/mediapipe/graphs/iris_tracking/iris_tracking_gpu.pbtxt @@ -81,40 +81,12 @@ node { } } -# Gets two landmarks which define left eye boundary. -node { - calculator: "SplitNormalizedLandmarkListCalculator" - input_stream: "face_landmarks" - output_stream: "left_eye_boundary_landmarks" - node_options: { - [type.googleapis.com/mediapipe.SplitVectorCalculatorOptions] { - ranges: { begin: 33 end: 34 } - ranges: { begin: 133 end: 134 } - combine_outputs: true - } - } -} - -# Gets two landmarks which define right eye boundary. -node { - calculator: "SplitNormalizedLandmarkListCalculator" - input_stream: "face_landmarks" - output_stream: "right_eye_boundary_landmarks" - node_options: { - [type.googleapis.com/mediapipe.SplitVectorCalculatorOptions] { - ranges: { begin: 362 end: 363 } - ranges: { begin: 263 end: 264 } - combine_outputs: true - } - } -} - # Detects iris landmarks, eye contour landmarks, and corresponding rect (ROI). node { - calculator: "IrisLandmarkLeftAndRightGpu" + calculator: "IrisLandmarkLeftAndRightFromFaceLandmarksGpu" input_stream: "IMAGE:throttled_input_video" - input_stream: "LEFT_EYE_BOUNDARY_LANDMARKS:left_eye_boundary_landmarks" - input_stream: "RIGHT_EYE_BOUNDARY_LANDMARKS:right_eye_boundary_landmarks" + input_stream: "FACE_LANDMARKS:face_landmarks" + output_stream: "UPDATED_FACE_LANDMARKS:updated_face_landmarks" output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks" output_stream: "LEFT_EYE_IRIS_LANDMARKS:left_iris_landmarks" output_stream: "LEFT_EYE_ROI:left_eye_rect_from_landmarks" @@ -123,20 +95,6 @@ node { output_stream: "RIGHT_EYE_ROI:right_eye_rect_from_landmarks" } -node { - calculator: "ConcatenateNormalizedLandmarkListCalculator" - input_stream: "left_eye_contour_landmarks" - input_stream: "right_eye_contour_landmarks" - output_stream: "refined_eye_landmarks" -} - -node { - calculator: "UpdateFaceLandmarksCalculator" - input_stream: "NEW_EYE_LANDMARKS:refined_eye_landmarks" - input_stream: "FACE_LANDMARKS:face_landmarks" - output_stream: "UPDATED_FACE_LANDMARKS:updated_face_landmarks" -} - # Renders annotations and overlays them on top of the input images. node { calculator: "IrisAndDepthRendererGpu" diff --git a/mediapipe/modules/iris_landmark/BUILD b/mediapipe/modules/iris_landmark/BUILD index 9f7eea1c3..6bf377a0a 100644 --- a/mediapipe/modules/iris_landmark/BUILD +++ b/mediapipe/modules/iris_landmark/BUILD @@ -78,7 +78,7 @@ mediapipe_simple_subgraph( register_as = "IrisLandmarkLeftAndRightFromFaceLandmarksGpu", deps = [ ":iris_landmark_left_and_right_gpu", - "//mediapipe/calculators/core:concateneate_normalized_landmark_list_calculator", + "//mediapipe/calculators/core:concatenate_normalized_landmark_list_calculator", "//mediapipe/calculators/core:split_normalized_landmark_list_calculator", "//mediapipe/graphs/iris_tracking/calculators:update_face_landmarks_calculator", ], @@ -103,7 +103,7 @@ mediapipe_simple_subgraph( register_as = "IrisLandmarkLeftAndRightFromFaceLandmarksCpu", deps = [ ":iris_landmark_left_and_right_cpu", - "//mediapipe/calculators/core:concateneate_normalized_landmark_list_calculator", + "//mediapipe/calculators/core:concatenate_normalized_landmark_list_calculator", "//mediapipe/calculators/core:split_normalized_landmark_list_calculator", "//mediapipe/graphs/iris_tracking/calculators:update_face_landmarks_calculator", ], diff --git a/mediapipe/modules/iris_landmark/iris_landmark_left_and_right_from_face_landmarks_cpu.pbtxt b/mediapipe/modules/iris_landmark/iris_landmark_left_and_right_from_face_landmarks_cpu.pbtxt index 47bdf87be..e7772d6ef 100644 --- a/mediapipe/modules/iris_landmark/iris_landmark_left_and_right_from_face_landmarks_cpu.pbtxt +++ b/mediapipe/modules/iris_landmark/iris_landmark_left_and_right_from_face_landmarks_cpu.pbtxt @@ -3,7 +3,7 @@ type: "IrisLandmarkLeftAndRightFromFaceLandmarksCpu" # CPU image. (ImageFrame) -input_stream: "IMAGE:input_video" +input_stream: "IMAGE:image" # Face landmarks. (NormalizedLandmarkList) input_stream: "FACE_LANDMARKS:face_landmarks" @@ -56,7 +56,7 @@ node { # Detects iris landmarks, eye contour landmarks, and corresponding rect (ROI). node { calculator: "IrisLandmarkLeftAndRightCpu" - input_stream: "IMAGE:input_video" + input_stream: "IMAGE:image" input_stream: "LEFT_EYE_BOUNDARY_LANDMARKS:left_eye_boundary_landmarks" input_stream: "RIGHT_EYE_BOUNDARY_LANDMARKS:right_eye_boundary_landmarks" output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks" diff --git a/mediapipe/modules/iris_landmark/iris_landmark_left_and_right_from_face_landmarks_gpu.pbtxt b/mediapipe/modules/iris_landmark/iris_landmark_left_and_right_from_face_landmarks_gpu.pbtxt index 600c55769..f0a4ce938 100644 --- a/mediapipe/modules/iris_landmark/iris_landmark_left_and_right_from_face_landmarks_gpu.pbtxt +++ b/mediapipe/modules/iris_landmark/iris_landmark_left_and_right_from_face_landmarks_gpu.pbtxt @@ -3,7 +3,7 @@ type: "IrisLandmarkLeftAndRightFromFaceLandmarksGpu" # GPU image. (GpuBuffer) -input_stream: "IMAGE:input_video" +input_stream: "IMAGE:image" # Face landmarks. (NormalizedLandmarkList) input_stream: "FACE_LANDMARKS:face_landmarks" @@ -55,7 +55,7 @@ node { # Detects iris landmarks, eye contour landmarks, and corresponding rect (ROI). node { calculator: "IrisLandmarkLeftAndRightGpu" - input_stream: "IMAGE:input_image" + input_stream: "IMAGE:image" input_stream: "LEFT_EYE_BOUNDARY_LANDMARKS:left_eye_boundary_landmarks" input_stream: "RIGHT_EYE_BOUNDARY_LANDMARKS:right_eye_boundary_landmarks" output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks"