set different graph for solution api

This commit is contained in:
Mautisim Munir 2022-09-26 17:39:06 +05:00
parent 517bb70212
commit 065571100c
3 changed files with 32 additions and 25 deletions

View File

@ -38,6 +38,13 @@ mediapipe_binary_graph(
deps = [":pose_tracking_gpu_deps"], 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( cc_library(
name = "pose_tracking_cpu_deps", name = "pose_tracking_cpu_deps",
deps = [ deps = [

View File

@ -1,16 +1,12 @@
# MediaPipe graph that performs pose tracking with TensorFlow Lite on GPU. # MediaPipe graph that performs pose tracking with TensorFlow Lite on GPU.
# GPU buffer. (GpuBuffer) # GPU buffer. (GpuBuffer)
input_stream: "IMAGE:input_video" input_stream: "input_video"
# Output image with rendered results. (GpuBuffer) # Output image with rendered results. (GpuBuffer)
output_stream: "output_video" output_stream: "output_video"
# Pose landmarks. (NormalizedLandmarkList) # 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. # Generates side packet to enable segmentation.
node { node {
@ -18,12 +14,11 @@ node {
output_side_packet: "PACKET:enable_segmentation" output_side_packet: "PACKET:enable_segmentation"
node_options: { node_options: {
[type.googleapis.com/mediapipe.ConstantSidePacketCalculatorOptions]: { [type.googleapis.com/mediapipe.ConstantSidePacketCalculatorOptions]: {
packet { bool_value: false } packet { bool_value: true }
} }
} }
} }
# Throttles the images flowing downstream for flow control. It passes through # Throttles the images flowing downstream for flow control. It passes through
# the very first incoming image unaltered, and waits for downstream nodes # the very first incoming image unaltered, and waits for downstream nodes
# (calculators and subgraphs) in the graph to finish their tasks before it # (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, # real-time mobile applications. It also eliminates unnecessarily computation,
# e.g., the output produced by a node may get dropped downstream if the # e.g., the output produced by a node may get dropped downstream if the
# subsequent nodes are still busy processing previous inputs. # subsequent nodes are still busy processing previous inputs.
node { node {
calculator: "FlowLimiterCalculator" calculator: "FlowLimiterCalculator"
input_stream: "input_video" input_stream: "input_video"
@ -45,18 +37,9 @@ node {
tag_index: "FINISHED" tag_index: "FINISHED"
back_edge: true 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. # Subgraph that detects poses and corresponding landmarks.
node { node {
calculator: "PoseLandmarkGpu" calculator: "PoseLandmarkGpu"

View File

@ -1,12 +1,16 @@
# MediaPipe graph that performs pose tracking with TensorFlow Lite on GPU. # MediaPipe graph that performs pose tracking with TensorFlow Lite on GPU.
# GPU buffer. (GpuBuffer) # GPU buffer. (GpuBuffer)
input_stream: "input_video" input_stream: "IMAGE:input_video"
# Output image with rendered results. (GpuBuffer) # Output image with rendered results. (GpuBuffer)
output_stream: "output_video" output_stream: "output_video"
# Pose landmarks. (NormalizedLandmarkList) # 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. # Generates side packet to enable segmentation.
node { node {
@ -14,11 +18,12 @@ node {
output_side_packet: "PACKET:enable_segmentation" output_side_packet: "PACKET:enable_segmentation"
node_options: { node_options: {
[type.googleapis.com/mediapipe.ConstantSidePacketCalculatorOptions]: { [type.googleapis.com/mediapipe.ConstantSidePacketCalculatorOptions]: {
packet { bool_value: true } packet { bool_value: false }
} }
} }
} }
# Throttles the images flowing downstream for flow control. It passes through # Throttles the images flowing downstream for flow control. It passes through
# the very first incoming image unaltered, and waits for downstream nodes # the very first incoming image unaltered, and waits for downstream nodes
# (calculators and subgraphs) in the graph to finish their tasks before it # (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, # real-time mobile applications. It also eliminates unnecessarily computation,
# e.g., the output produced by a node may get dropped downstream if the # e.g., the output produced by a node may get dropped downstream if the
# subsequent nodes are still busy processing previous inputs. # subsequent nodes are still busy processing previous inputs.
node { node {
calculator: "FlowLimiterCalculator" calculator: "FlowLimiterCalculator"
input_stream: "input_video" input_stream: "input_video"
@ -37,9 +45,18 @@ node {
tag_index: "FINISHED" tag_index: "FINISHED"
back_edge: true 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. # Subgraph that detects poses and corresponding landmarks.
node { node {
calculator: "PoseLandmarkGpu" calculator: "PoseLandmarkGpu"