71 lines
2.5 KiB
Plaintext
71 lines
2.5 KiB
Plaintext
# MediaPipe graph that performs pose tracking with TensorFlow Lite on CPU.
|
|
|
|
# CPU buffer. (ImageFrame)
|
|
input_stream: "input_video"
|
|
|
|
|
|
# Transfers the input image from GPU to CPU memory for the purpose of
|
|
# demonstrating a CPU-based pipeline. Note that the input image on GPU has the
|
|
# origin defined at the bottom-left corner (OpenGL convention). As a result,
|
|
# the transferred image on CPU also shares the same representation.
|
|
node: {
|
|
calculator: "GpuBufferToImageFrameCalculator"
|
|
input_stream: "input_video"
|
|
output_stream: "input_video_cpu"
|
|
}
|
|
|
|
|
|
# Output image with rendered results. (ImageFrame)
|
|
output_stream: "output_video"
|
|
# Pose landmarks. (NormalizedLandmarkList)
|
|
output_stream: "pose_landmarks"
|
|
|
|
# Throttles the images flowing downstream for flow control. It passes through
|
|
# the very first incoming image unaltered, and waits for downstream nodes
|
|
# (calculators and subgraphs) in the graph to finish their tasks before it
|
|
# passes through another image. All images that come in while waiting are
|
|
# dropped, limiting the number of in-flight images in most part of the graph to
|
|
# 1. This prevents the downstream nodes from queuing up incoming images and data
|
|
# excessively, which leads to increased latency and memory usage, unwanted in
|
|
# real-time mobile applications. It also eliminates unnecessarily computation,
|
|
# e.g., the output produced by a node may get dropped downstream if the
|
|
# subsequent nodes are still busy processing previous inputs.
|
|
node {
|
|
calculator: "FlowLimiterCalculator"
|
|
input_stream: "input_video_cpu"
|
|
input_stream: "FINISHED:output_video"
|
|
input_stream_info: {
|
|
tag_index: "FINISHED"
|
|
back_edge: true
|
|
}
|
|
output_stream: "throttled_input_video"
|
|
}
|
|
|
|
# Subgraph that detects poses and corresponding landmarks.
|
|
node {
|
|
calculator: "PoseLandmarkCpu"
|
|
input_stream: "IMAGE:throttled_input_video"
|
|
output_stream: "LANDMARKS:pose_landmarks"
|
|
output_stream: "DETECTION:pose_detection"
|
|
output_stream: "ROI_FROM_LANDMARKS:roi_from_landmarks"
|
|
}
|
|
|
|
# Subgraph that renders pose-landmark annotation onto the input image.
|
|
node {
|
|
calculator: "PoseRendererCpu"
|
|
input_stream: "IMAGE:throttled_input_video"
|
|
input_stream: "LANDMARKS:pose_landmarks"
|
|
input_stream: "ROI:roi_from_landmarks"
|
|
input_stream: "DETECTION:pose_detection"
|
|
output_stream: "IMAGE:output_video_cpu"
|
|
}
|
|
|
|
|
|
# Transfers the annotated image from CPU back to GPU memory, to be sent out of
|
|
# the graph.
|
|
node: {
|
|
calculator: "ImageFrameToGpuBufferCalculator"
|
|
input_stream: "output_video_cpu"
|
|
output_stream: "output_video"
|
|
}
|