use new calculators to detect iris landmarks

This commit is contained in:
homuler 2021-01-30 15:30:51 +09:00
parent 7dc6638f42
commit d5a26d595a
8 changed files with 22 additions and 194 deletions

View File

@ -30,10 +30,9 @@ cc_library(
"//mediapipe/calculators/image:image_file_properties_calculator", "//mediapipe/calculators/image:image_file_properties_calculator",
"//mediapipe/calculators/image:opencv_encoded_image_to_image_frame_calculator", "//mediapipe/calculators/image:opencv_encoded_image_to_image_frame_calculator",
"//mediapipe/calculators/image:opencv_image_encoder_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/graphs/iris_tracking/subgraphs:iris_and_depth_renderer_cpu",
"//mediapipe/modules/face_landmark:face_landmark_front_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:constant_side_packet_calculator",
"//mediapipe/calculators/core:flow_limiter_calculator", "//mediapipe/calculators/core:flow_limiter_calculator",
"//mediapipe/calculators/core:split_vector_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/graphs/iris_tracking/subgraphs:iris_renderer_cpu",
"//mediapipe/modules/face_landmark:face_landmark_front_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/core:split_vector_calculator",
"//mediapipe/calculators/video:opencv_video_decoder_calculator", "//mediapipe/calculators/video:opencv_video_decoder_calculator",
"//mediapipe/calculators/video:opencv_video_encoder_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/graphs/iris_tracking/subgraphs:iris_renderer_cpu",
"//mediapipe/modules/face_landmark:face_landmark_front_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:constant_side_packet_calculator",
"//mediapipe/calculators/core:flow_limiter_calculator", "//mediapipe/calculators/core:flow_limiter_calculator",
"//mediapipe/calculators/core:split_vector_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/graphs/iris_tracking/subgraphs:iris_and_depth_renderer_gpu",
"//mediapipe/modules/face_landmark:face_landmark_front_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",
], ],
) )

View File

@ -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). # Detects iris landmarks, eye contour landmarks, and corresponding rect (ROI).
node { node {
calculator: "IrisLandmarkLeftAndRightCpu" calculator: "IrisLandmarkLeftAndRightFromFaceLandmarksCpu"
input_stream: "IMAGE:input_image" input_stream: "IMAGE:input_image"
input_stream: "LEFT_EYE_BOUNDARY_LANDMARKS:left_eye_boundary_landmarks" input_stream: "FACE_LANDMARKS:face_landmarks"
input_stream: "RIGHT_EYE_BOUNDARY_LANDMARKS:right_eye_boundary_landmarks" output_stream: "UPDATED_FACE_LANDMARKS:updated_face_landmarks"
output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks" output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks"
output_stream: "LEFT_EYE_IRIS_LANDMARKS:left_iris_landmarks" output_stream: "LEFT_EYE_IRIS_LANDMARKS:left_iris_landmarks"
output_stream: "LEFT_EYE_ROI:left_eye_rect_from_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" 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. # Renders annotations and overlays them on top of the input images.
node { node {
calculator: "IrisAndDepthRendererCpu" calculator: "IrisAndDepthRendererCpu"

View File

@ -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). # Detects iris landmarks, eye contour landmarks, and corresponding rect (ROI).
node { node {
calculator: "IrisLandmarkLeftAndRightCpu" calculator: "IrisLandmarkLeftAndRightFromFaceLandmarksCpu"
input_stream: "IMAGE:input_video" input_stream: "IMAGE:input_video"
input_stream: "LEFT_EYE_BOUNDARY_LANDMARKS:left_eye_boundary_landmarks" input_stream: "FACE_LANDMARKS:face_landmarks"
input_stream: "RIGHT_EYE_BOUNDARY_LANDMARKS:right_eye_boundary_landmarks" output_stream: "UPDATED_FACE_LANDMARKS:updated_face_landmarks"
output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks" output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks"
output_stream: "LEFT_EYE_IRIS_LANDMARKS:left_iris_landmarks" output_stream: "LEFT_EYE_IRIS_LANDMARKS:left_iris_landmarks"
output_stream: "LEFT_EYE_ROI:left_eye_rect_from_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" 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. # Renders annotations and overlays them on top of the input images.
node { node {
calculator: "IrisRendererCpu" calculator: "IrisRendererCpu"

View File

@ -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). # Detects iris landmarks, eye contour landmarks, and corresponding rect (ROI).
node { node {
calculator: "IrisLandmarkLeftAndRightCpu" calculator: "IrisLandmarkLeftAndRightFromFaceLandmarksCpu"
input_stream: "IMAGE:input_video" input_stream: "IMAGE:input_video"
input_stream: "LEFT_EYE_BOUNDARY_LANDMARKS:left_eye_boundary_landmarks" input_stream: "FACE_LANDMARKS:face_landmarks"
input_stream: "RIGHT_EYE_BOUNDARY_LANDMARKS:right_eye_boundary_landmarks" output_stream: "UPDATED_FACE_LANDMARKS:updated_face_landmarks"
output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks" output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks"
output_stream: "LEFT_EYE_IRIS_LANDMARKS:left_iris_landmarks" output_stream: "LEFT_EYE_IRIS_LANDMARKS:left_iris_landmarks"
output_stream: "LEFT_EYE_ROI:left_eye_rect_from_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" 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. # Renders annotations and overlays them on top of the input images.
node { node {
calculator: "IrisRendererCpu" calculator: "IrisRendererCpu"

View File

@ -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). # Detects iris landmarks, eye contour landmarks, and corresponding rect (ROI).
node { node {
calculator: "IrisLandmarkLeftAndRightGpu" calculator: "IrisLandmarkLeftAndRightFromFaceLandmarksGpu"
input_stream: "IMAGE:throttled_input_video" input_stream: "IMAGE:throttled_input_video"
input_stream: "LEFT_EYE_BOUNDARY_LANDMARKS:left_eye_boundary_landmarks" input_stream: "FACE_LANDMARKS:face_landmarks"
input_stream: "RIGHT_EYE_BOUNDARY_LANDMARKS:right_eye_boundary_landmarks" output_stream: "UPDATED_FACE_LANDMARKS:updated_face_landmarks"
output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks" output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks"
output_stream: "LEFT_EYE_IRIS_LANDMARKS:left_iris_landmarks" output_stream: "LEFT_EYE_IRIS_LANDMARKS:left_iris_landmarks"
output_stream: "LEFT_EYE_ROI:left_eye_rect_from_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" 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. # Renders annotations and overlays them on top of the input images.
node { node {
calculator: "IrisAndDepthRendererGpu" calculator: "IrisAndDepthRendererGpu"

View File

@ -78,7 +78,7 @@ mediapipe_simple_subgraph(
register_as = "IrisLandmarkLeftAndRightFromFaceLandmarksGpu", register_as = "IrisLandmarkLeftAndRightFromFaceLandmarksGpu",
deps = [ deps = [
":iris_landmark_left_and_right_gpu", ":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/calculators/core:split_normalized_landmark_list_calculator",
"//mediapipe/graphs/iris_tracking/calculators:update_face_landmarks_calculator", "//mediapipe/graphs/iris_tracking/calculators:update_face_landmarks_calculator",
], ],
@ -103,7 +103,7 @@ mediapipe_simple_subgraph(
register_as = "IrisLandmarkLeftAndRightFromFaceLandmarksCpu", register_as = "IrisLandmarkLeftAndRightFromFaceLandmarksCpu",
deps = [ deps = [
":iris_landmark_left_and_right_cpu", ":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/calculators/core:split_normalized_landmark_list_calculator",
"//mediapipe/graphs/iris_tracking/calculators:update_face_landmarks_calculator", "//mediapipe/graphs/iris_tracking/calculators:update_face_landmarks_calculator",
], ],

View File

@ -3,7 +3,7 @@
type: "IrisLandmarkLeftAndRightFromFaceLandmarksCpu" type: "IrisLandmarkLeftAndRightFromFaceLandmarksCpu"
# CPU image. (ImageFrame) # CPU image. (ImageFrame)
input_stream: "IMAGE:input_video" input_stream: "IMAGE:image"
# Face landmarks. (NormalizedLandmarkList) # Face landmarks. (NormalizedLandmarkList)
input_stream: "FACE_LANDMARKS:face_landmarks" input_stream: "FACE_LANDMARKS:face_landmarks"
@ -56,7 +56,7 @@ node {
# Detects iris landmarks, eye contour landmarks, and corresponding rect (ROI). # Detects iris landmarks, eye contour landmarks, and corresponding rect (ROI).
node { node {
calculator: "IrisLandmarkLeftAndRightCpu" calculator: "IrisLandmarkLeftAndRightCpu"
input_stream: "IMAGE:input_video" input_stream: "IMAGE:image"
input_stream: "LEFT_EYE_BOUNDARY_LANDMARKS:left_eye_boundary_landmarks" input_stream: "LEFT_EYE_BOUNDARY_LANDMARKS:left_eye_boundary_landmarks"
input_stream: "RIGHT_EYE_BOUNDARY_LANDMARKS:right_eye_boundary_landmarks" input_stream: "RIGHT_EYE_BOUNDARY_LANDMARKS:right_eye_boundary_landmarks"
output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks" output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks"

View File

@ -3,7 +3,7 @@
type: "IrisLandmarkLeftAndRightFromFaceLandmarksGpu" type: "IrisLandmarkLeftAndRightFromFaceLandmarksGpu"
# GPU image. (GpuBuffer) # GPU image. (GpuBuffer)
input_stream: "IMAGE:input_video" input_stream: "IMAGE:image"
# Face landmarks. (NormalizedLandmarkList) # Face landmarks. (NormalizedLandmarkList)
input_stream: "FACE_LANDMARKS:face_landmarks" input_stream: "FACE_LANDMARKS:face_landmarks"
@ -55,7 +55,7 @@ node {
# Detects iris landmarks, eye contour landmarks, and corresponding rect (ROI). # Detects iris landmarks, eye contour landmarks, and corresponding rect (ROI).
node { node {
calculator: "IrisLandmarkLeftAndRightGpu" calculator: "IrisLandmarkLeftAndRightGpu"
input_stream: "IMAGE:input_image" input_stream: "IMAGE:image"
input_stream: "LEFT_EYE_BOUNDARY_LANDMARKS:left_eye_boundary_landmarks" input_stream: "LEFT_EYE_BOUNDARY_LANDMARKS:left_eye_boundary_landmarks"
input_stream: "RIGHT_EYE_BOUNDARY_LANDMARKS:right_eye_boundary_landmarks" input_stream: "RIGHT_EYE_BOUNDARY_LANDMARKS:right_eye_boundary_landmarks"
output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks" output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks"