diff --git a/mediapipe/graphs/pose_tracking/BUILD b/mediapipe/graphs/pose_tracking/BUILD index 26f607c45..a8419cfbd 100644 --- a/mediapipe/graphs/pose_tracking/BUILD +++ b/mediapipe/graphs/pose_tracking/BUILD @@ -38,6 +38,13 @@ mediapipe_binary_graph( deps = [":pose_tracking_gpu_deps"], ) +mediapipe_binary_graph( + name = "pose_tracking_gpu_image_binary_graph", + graph = "pose_tracking_gpu_image.pbtxt", + output_name = "pose_tracking_gpu_image.binarypb", + deps = [":pose_tracking_gpu_deps"], +) + cc_library( name = "pose_tracking_cpu_deps", deps = [ diff --git a/mediapipe/graphs/pose_tracking/pose_tracking_gpu.pbtxt b/mediapipe/graphs/pose_tracking/pose_tracking_gpu.pbtxt index fa3ed97f5..35be3f0e0 100644 --- a/mediapipe/graphs/pose_tracking/pose_tracking_gpu.pbtxt +++ b/mediapipe/graphs/pose_tracking/pose_tracking_gpu.pbtxt @@ -1,16 +1,12 @@ # MediaPipe graph that performs pose tracking with TensorFlow Lite on GPU. # GPU buffer. (GpuBuffer) -input_stream: "IMAGE:input_video" +input_stream: "input_video" # Output image with rendered results. (GpuBuffer) output_stream: "output_video" # Pose landmarks. (NormalizedLandmarkList) -#output_stream: "pose_landmarks" - -output_stream: "IMAGE:throttled_input_video" -output_stream: "DETECTION:pose_detection" -output_stream: "output_video" +output_stream: "pose_landmarks" # Generates side packet to enable segmentation. node { @@ -18,12 +14,11 @@ node { output_side_packet: "PACKET:enable_segmentation" node_options: { [type.googleapis.com/mediapipe.ConstantSidePacketCalculatorOptions]: { - packet { bool_value: false } + packet { bool_value: true } } } } - # 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 @@ -34,9 +29,6 @@ node { # 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" @@ -45,18 +37,9 @@ node { tag_index: "FINISHED" back_edge: true } - output_stream: "throttled_input_video_cpu" + output_stream: "throttled_input_video" } -# Converts Image to GpuBuffer for PoseLandmarkGPU to consume. -node { - calculator: "FromImageCalculator" - input_stream: "IMAGE:throttled_input_video_cpu" - output_stream: "IMAGE_GPU:throttled_input_video" - output_stream: "SOURCE_ON_GPU:is_gpu_image" -} - - # Subgraph that detects poses and corresponding landmarks. node { calculator: "PoseLandmarkGpu" diff --git a/mediapipe/graphs/pose_tracking/pose_tracking_solution_gpu.pbtxt b/mediapipe/graphs/pose_tracking/pose_tracking_gpu_image.pbtxt similarity index 80% rename from mediapipe/graphs/pose_tracking/pose_tracking_solution_gpu.pbtxt rename to mediapipe/graphs/pose_tracking/pose_tracking_gpu_image.pbtxt index 35be3f0e0..fa3ed97f5 100644 --- a/mediapipe/graphs/pose_tracking/pose_tracking_solution_gpu.pbtxt +++ b/mediapipe/graphs/pose_tracking/pose_tracking_gpu_image.pbtxt @@ -1,12 +1,16 @@ # MediaPipe graph that performs pose tracking with TensorFlow Lite on GPU. # GPU buffer. (GpuBuffer) -input_stream: "input_video" +input_stream: "IMAGE:input_video" # Output image with rendered results. (GpuBuffer) output_stream: "output_video" # Pose landmarks. (NormalizedLandmarkList) -output_stream: "pose_landmarks" +#output_stream: "pose_landmarks" + +output_stream: "IMAGE:throttled_input_video" +output_stream: "DETECTION:pose_detection" +output_stream: "output_video" # Generates side packet to enable segmentation. node { @@ -14,11 +18,12 @@ node { output_side_packet: "PACKET:enable_segmentation" node_options: { [type.googleapis.com/mediapipe.ConstantSidePacketCalculatorOptions]: { - packet { bool_value: true } + packet { bool_value: false } } } } + # 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 @@ -29,6 +34,9 @@ node { # 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" @@ -37,9 +45,18 @@ node { tag_index: "FINISHED" back_edge: true } - output_stream: "throttled_input_video" + output_stream: "throttled_input_video_cpu" } +# Converts Image to GpuBuffer for PoseLandmarkGPU to consume. +node { + calculator: "FromImageCalculator" + input_stream: "IMAGE:throttled_input_video_cpu" + output_stream: "IMAGE_GPU:throttled_input_video" + output_stream: "SOURCE_ON_GPU:is_gpu_image" +} + + # Subgraph that detects poses and corresponding landmarks. node { calculator: "PoseLandmarkGpu"