forked from homuler/MediaPipeUnityPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: define IrisLandmarksFromFaceLandmarks calculators
- Loading branch information
Showing
11 changed files
with
213 additions
and
719 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
load( | ||
"@com_google_mediapipe//mediapipe/framework/tool:mediapipe_graph.bzl", | ||
"mediapipe_simple_subgraph", | ||
) | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
mediapipe_simple_subgraph( | ||
name = "iris_landmarks_from_face_landmarks_gpu", | ||
graph = "iris_landmarks_from_face_landmarks_gpu.pbtxt", | ||
register_as = "IrisLandmarksFromFaceLandmarksGpu", | ||
deps = [ | ||
"@com_google_mediapipe//mediapipe/modules/iris_landmark:iris_landmark_left_and_right_gpu", | ||
"@com_google_mediapipe//mediapipe/calculators/core:concatenate_normalized_landmark_list_calculator", | ||
"@com_google_mediapipe//mediapipe/calculators/core:split_normalized_landmark_list_calculator", | ||
"@com_google_mediapipe//mediapipe/graphs/iris_tracking/calculators:update_face_landmarks_calculator", | ||
], | ||
) | ||
|
||
mediapipe_simple_subgraph( | ||
name = "iris_landmarks_from_face_landmarks_cpu", | ||
graph = "iris_landmarks_from_face_landmarks_cpu.pbtxt", | ||
register_as = "IrisLandmarksFromFaceLandmarksCpu", | ||
deps = [ | ||
"@com_google_mediapipe//mediapipe/modules/iris_landmark:iris_landmark_left_and_right_cpu", | ||
"@com_google_mediapipe//mediapipe/calculators/core:concatenate_normalized_landmark_list_calculator", | ||
"@com_google_mediapipe//mediapipe/calculators/core:split_normalized_landmark_list_calculator", | ||
"@com_google_mediapipe//mediapipe/graphs/iris_tracking/calculators:update_face_landmarks_calculator", | ||
], | ||
) |
82 changes: 82 additions & 0 deletions
82
mediapipe_api/modules/iris_landmark/iris_landmarks_from_face_landmarks_cpu.pbtxt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Detects iris landmarks, eye contour landmarks, and corresponding rect (ROI) from face landmarks. | ||
|
||
type: "IrisLandmarkLeftAndRightFromFaceLandmarksCpu" | ||
|
||
# CPU image. (ImageFrame) | ||
input_stream: "IMAGE:image" | ||
# Face landmarks. (NormalizedLandmarkList) | ||
input_stream: "FACE_LANDMARKS:face_landmarks" | ||
|
||
# Refined face landmarks. (NormalizedLandmarkList) | ||
output_stream: "UPDATED_FACE_LANDMARKS:refined_face_landmarks" | ||
|
||
# 71 normalized eye contour landmarks. (NormalizedLandmarkList) | ||
output_stream: "LEFT_EYE_CONTOUR_LANDMARKS:left_eye_contour_landmarks" | ||
# 5 normalized iris landmarks. (NormalizedLandmarkList) | ||
output_stream: "LEFT_EYE_IRIS_LANDMARKS:left_iris_landmarks" | ||
# Region of interest used to do calculations for the left eye. (NormalizedRect) | ||
output_stream: "LEFT_EYE_ROI:left_eye_rect_from_landmarks" | ||
|
||
# 71 normalized eye contour landmarks. (NormalizedLandmarkList) | ||
output_stream: "RIGHT_EYE_CONTOUR_LANDMARKS:right_eye_contour_landmarks" | ||
# 5 normalized iris landmarks. (NormalizedLandmarkList) | ||
output_stream: "RIGHT_EYE_IRIS_LANDMARKS:right_iris_landmarks" | ||
# Region of interest used to do calculations for the right eye. (NormalizedRect) | ||
output_stream: "RIGHT_EYE_ROI:right_eye_rect_from_landmarks" | ||
|
||
|
||
# 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" | ||
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" | ||
output_stream: "LEFT_EYE_IRIS_LANDMARKS:left_iris_landmarks" | ||
output_stream: "LEFT_EYE_ROI:left_eye_rect_from_landmarks" | ||
output_stream: "RIGHT_EYE_CONTOUR_LANDMARKS:right_eye_contour_landmarks" | ||
output_stream: "RIGHT_EYE_IRIS_LANDMARKS:right_iris_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:refined_face_landmarks" | ||
} |
Oops, something went wrong.