Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add blueprint to Face Tracking example #5616

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 66 additions & 44 deletions examples/python/face_tracking/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import numpy.typing as npt
import requests
import rerun as rr # pip install rerun-sdk
import rerun.blueprint as rrb
import tqdm
from mediapipe.tasks.python import vision

Expand All @@ -29,58 +30,58 @@

# uncomment blendshapes of interest
BLENDSHAPES_CATEGORIES = {
# "_neutral",
# "browDownLeft",
# "browDownRight",
# "browInnerUp",
# "browOuterUpLeft",
# "browOuterUpRight",
# "cheekPuff",
# "cheekSquintLeft",
# "cheekSquintRight",
"_neutral",
"browDownLeft",
"browDownRight",
"browInnerUp",
"browOuterUpLeft",
"browOuterUpRight",
"cheekPuff",
"cheekSquintLeft",
"cheekSquintRight",
"eyeBlinkLeft",
"eyeBlinkRight",
# "eyeLookDownLeft",
# "eyeLookDownRight",
# "eyeLookInLeft",
# "eyeLookInRight",
# "eyeLookOutLeft",
# "eyeLookOutRight",
# "eyeLookUpLeft",
# "eyeLookUpRight",
"eyeLookDownLeft",
"eyeLookDownRight",
"eyeLookInLeft",
"eyeLookInRight",
"eyeLookOutLeft",
"eyeLookOutRight",
"eyeLookUpLeft",
"eyeLookUpRight",
"eyeSquintLeft",
"eyeSquintRight",
"eyeWideLeft",
"eyeWideRight",
# "jawForward",
# "jawLeft",
"jawForward",
"jawLeft",
"jawOpen",
# "jawRight",
# "mouthClose",
# "mouthDimpleLeft",
# "mouthDimpleRight",
# "mouthFrownLeft",
# "mouthFrownRight",
# "mouthFunnel",
# "mouthLeft",
# "mouthLowerDownLeft",
# "mouthLowerDownRight",
# "mouthPressLeft",
# "mouthPressRight",
# "mouthPucker",
# "mouthRight",
# "mouthRollLower",
# "mouthRollUpper",
# "mouthShrugLower",
# "mouthShrugUpper",
"jawRight",
"mouthClose",
"mouthDimpleLeft",
"mouthDimpleRight",
"mouthFrownLeft",
"mouthFrownRight",
"mouthFunnel",
"mouthLeft",
"mouthLowerDownLeft",
"mouthLowerDownRight",
"mouthPressLeft",
"mouthPressRight",
"mouthPucker",
"mouthRight",
"mouthRollLower",
"mouthRollUpper",
"mouthShrugLower",
"mouthShrugUpper",
"mouthSmileLeft",
"mouthSmileRight",
# "mouthStretchLeft",
# "mouthStretchRight",
# "mouthUpperUpLeft",
# "mouthUpperUpRight",
# "noseSneerLeft",
# "noseSneerRight",
"mouthStretchLeft",
"mouthStretchRight",
"mouthUpperUpLeft",
"mouthUpperUpRight",
"noseSneerLeft",
"noseSneerRight",
}


Expand Down Expand Up @@ -430,7 +431,28 @@ def main() -> None:
args, unknown = parser.parse_known_args()
for arg in unknown:
logging.warning(f"unknown arg: {arg}")
rr.script_setup(args, "rerun_example_mp_face_detection")

rr.script_setup(
args,
"rerun_example_mp_face_detection",
blueprint=rrb.Horizontal(
rrb.Spatial3DView(origin="reconstruction"),
rrb.Vertical(
rrb.Spatial2DView(origin="video"),
rrb.TimeSeriesView(
origin="blendshapes",
# Enable only certain blend shapes by default. More can be added in the viewer ui
contents=[
"+ blendshapes/0/eyeBlinkLeft",
"+ blendshapes/0/eyeBlinkRight",
"+ blendshapes/0/jawOpen",
"+ blendshapes/0/mouthSmileLeft",
"+ blendshapes/0/mouthSmileRight",
],
),
),
),
)

if args.demo_image:
if not SAMPLE_IMAGE_PATH.exists():
Expand Down
Loading