MediaPipe即使在安装MacBook M1之后也无法运行
我正在尝试使MediaPipe姿势估计在MacBook M1上的VS代码上运行。我使用PIP安装MediaPipe-Silicon
安装了它,并成功安装了它。 我正在运行通用的MediaPipe代码而没有修改:
import cv2
import mediapipe as mp
import numpy as np
mp_drawing = mp.solutions.drawing_utils
mp_drawing_styles = mp.solutions.drawing_styles
mp_pose = mp.solutions.pose
cap = cv2.VideoCapture(0)
with mp_pose.Pose(
min_detection_confidence=0.5,
min_tracking_confidence=0.5) as pose:
while cap.isOpened():
success, image = cap.read()
if not success:
print("Ignoring empty camera frame.")
# If loading a video, use 'break' instead of 'continue'.
continue
# To improve performance, optionally mark the image as not writeable to
# pass by reference.
image.flags.writeable = False
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
results = pose.process(image)
# Draw the pose annotation on the image.
image.flags.writeable = True
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
mp_drawing.draw_landmarks(
image,
results.pose_landmarks,
mp_pose.POSE_CONNECTIONS,
landmark_drawing_spec=mp_drawing_styles.get_default_pose_landmarks_style())
# Flip the image horizontally for a selfie-view display.
cv2.imshow('MediaPipe Pose', cv2.flip(image, 1))
if cv2.waitKey(5) & 0xFF == 27:
break
cap.release()
当我运行此代码时,网络摄像头灯打开2秒钟,然后关闭。我没有弹出窗口来查看网络摄像头。我也将其在终端上得到:
objc[90068]: Class CaptureDelegate is implemented in both /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/cv2.cpython-310-darwin.so (0x10abe6458) and /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mediapipe/.dylibs/libopencv_videoio.3.4.16.dylib (0x10d4cc860). One of the two will be used. Which one is undefined.
objc[90068]: Class CVWindow is implemented in both /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/cv2.cpython-310-darwin.so (0x10abe64a8) and /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mediapipe/.dylibs/libopencv_highgui.3.4.16.dylib (0x10c430a68). One of the two will be used. Which one is undefined.
objc[90068]: Class CVView is implemented in both /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/cv2.cpython-310-darwin.so (0x10abe64d0) and /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mediapipe/.dylibs/libopencv_highgui.3.4.16.dylib (0x10c430a90). One of the two will be used. Which one is undefined.
objc[90068]: Class CVSlider is implemented in both /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/cv2.cpython-310-darwin.so (0x10abe64f8) and /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mediapipe/.dylibs/libopencv_highgui.3.4.16.dylib (0x10c430ab8). One of the two will be used. Which one is undefined.
[libprotobuf ERROR external/com_google_protobuf/src/google/protobuf/text_format.cc:335] Error parsing text-format mediapipe.CalculatorGraphConfig: 22:9: Message type "mediapipe.CalculatorOptions" has no field named "ext".
Traceback (most recent call last):
File "/Users/jana/Documents/GitHub/AS2-MLC-Project/multi_pose.py", line 7, in <module>
with mp_pose.Pose(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mediapipe/python/solutions/pose.py", line 146, in __init__
super().__init__(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mediapipe/python/solution_base.py", line 247, in __init__
self._graph = calculator_graph.CalculatorGraph(
RuntimeError: Failed to parse: node {
calculator: "ImagePropertiesCalculator"
input_stream: "IMAGE_CPU:image"
output_stream: "SIZE:image_size"
}
node {
calculator: "PreviousLoopbackCalculator"
input_stream: "MAIN:image"
input_stream: "LOOP:pose_rect_from_landmarks"
output_stream: "PREV_LOOP:prev_pose_rect_from_landmarks"
input_stream_info {
tag_index: "LOOP"
back_edge: true
}
}
node {
calculator: "GateCalculator"
input_stream: "prev_pose_rect_from_landmarks"
output_stream: "gated_prev_pose_rect_from_landmarks"
input_side_packet: "ALLOW:use_prev_landmarks"
options {
ext {
allow: true
}
}
}
node {
calculator: "PacketPresenceCalculator"
input_stream: "PACKET:gated_prev_pose_rect_from_landmarks"
output_stream: "PRESENCE:prev_pose_rect_from_landmarks_is_present"
}
node {
calculator: "GateCalculator"
input_stream: "image"
input_stream: "image_size"
input_stream: "DISALLOW:prev_pose_rect_from_landmarks_is_present"
output_stream: "image_for_pose_detection"
output_stream: "image_size_for_pose_detection"
options {
ext {
empty_packets_as_allow: true
}
}
}
node {
name: "posedetectioncpu__ImageToTensorCalculator"
calculator: "ImageToTensorCalculator"
input_stream: "IMAGE:image_for_pose_detection"
output_stream: "TENSORS:posedetectioncpu__input_tensors"
output_stream: "LETTERBOX_PADDING:posedetectioncpu__letterbox_padding"
options {
ext {
output_tensor_width: 224
output_tensor_height: 224
keep_aspect_ratio: true
output_tensor_float_range {
min: -1
max: 1
}
gpu_origin: TOP_LEFT
border_mode: BORDER_ZERO
}
}
}
node {
name: "posedetectioncpu__SsdAnchorsCalculator"
calculator: "SsdAnchorsCalculator"
output_side_packet: "posedetectioncpu__anchors"
options {
ext {
input_size_width: 224
input_size_height: 224
min_scale: 0.1484375
max_scale: 0.75
anchor_offset_x: 0.5
anchor_offset_y: 0.5
num_layers: 5
strides: 8
strides: 16
strides: 32
strides: 32
strides: 32
aspect_ratios: 1
fixed_anchor_size: true
}
}
}
node {
name: "poselandmarkbyroicpu__ImagePropertiesCalculator"
calculator: "ImagePropertiesCalculator"
input_stream: "IMAGE_CPU:image"
output_stream: "SIZE:poselandmarkbyroicpu__image_size"
}
node {
name: "posedetectioncpu__inferencecalculator__posedetectioncpu__InferenceCalculator"
calculator: "InferenceCalculatorCpu"
input_stream: "TENSORS:posedetectioncpu__input_tensors"
output_stream: "TENSORS:posedetectioncpu__detection_tensors"
options {
ext {
model_path: "mediapipe/modules/pose_detection/pose_detection.tflite"
delegate {
xnnpack {
}
}
}
}
}
node {
name: "posedetectioncpu__TensorsToDetectionsCalculator"
calculator: "TensorsToDetectionsCalculator"
input_stream: "TENSORS:posedetectioncpu__detection_tensors"
output_stream: "DETECTIONS:posedetectioncpu__unfiltered_detections"
input_side_packet: "ANCHORS:posedetectioncpu__anchors"
options {
ext {
num_classes: 1
num_boxes: 2254
num_coords: 12
keypoint_coord_offset: 4
num_keypoints: 4
num_values_per_keypoint: 2
box_coord_offset: 0
x_scale: 224
y_scale: 224
w_scale: 224
h_scale: 224
reverse_output_order: true
sigmoid_score: true
score_clipping_thresh: 100
min_score_thresh: 0.5
}
}
}
node {
name: "posedetectioncpu__NonMaxSuppressionCalculator"
calculator: "NonMaxSuppressionCalculator"
input_stream: "posedetectioncpu__unfiltered_detections"
output_stream: "posedetectioncpu__filtered_detections"
options {
ext {
min_suppression_threshold: 0.3
overlap_type: INTERSECTION_OVER_UNION
algorithm: WEIGHTED
}
}
}
node {
name: "posedetectioncpu__DetectionLetterboxRemovalCalculator"
calculator: "DetectionLetterboxRemovalCalculator"
input_stream: "DETECTIONS:posedetectioncpu__filtered_detections"
input_stream: "LETTERBOX_PADDING:posedetectioncpu__letterbox_padding"
output_stream: "DETECTIONS:pose_detections"
}
node {
calculator: "SplitDetectionVectorCalculator"
input_stream: "pose_detections"
output_stream: "pose_detection"
options {
ext {
ranges {
begin: 0
end: 1
}
element_only: true
}
}
}
node {
name: "posedetectiontoroi__AlignmentPointsRectsCalculator"
calculator: "AlignmentPointsRectsCalculator"
input_stream: "DETECTION:pose_detection"
input_stream: "IMAGE_SIZE:image_size_for_pose_detection"
output_stream: "NORM_RECT:posedetectiontoroi__raw_roi"
options {
ext {
rotation_vector_start_keypoint_index: 0
rotation_vector_end_keypoint_index: 1
rotation_vector_target_angle_degrees: 90
}
}
}
node {
name: "posedetectiontoroi__RectTransformationCalculator"
calculator: "RectTransformationCalculator"
input_stream: "NORM_RECT:posedetectiontoroi__raw_roi"
input_stream: "IMAGE_SIZE:image_size_for_pose_detection"
output_stream: "pose_rect_from_detection"
options {
ext {
scale_x: 1.25
scale_y: 1.25
square_long: true
}
}
}
node {
calculator: "MergeCalculator"
input_stream: "pose_rect_from_detection"
input_stream: "gated_prev_pose_rect_from_landmarks"
output_stream: "pose_rect"
}
node {
name: "poselandmarkbyroicpu__ImageToTensorCalculator"
calculator: "ImageToTensorCalculator"
input_stream: "IMAGE:image"
input_stream: "NORM_RECT:pose_rect"
output_stream: "TENSORS:poselandmarkbyroicpu__input_tensors"
output_stream: "LETTERBOX_PADDING:poselandmarkbyroicpu__letterbox_padding"
output_stream: "MATRIX:poselandmarkbyroicpu__transformation_matrix"
options {
ext {
output_tensor_width: 256
output_tensor_height: 256
keep_aspect_ratio: true
output_tensor_float_range {
min: 0
max: 1
}
}
}
}
node {
name: "poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__InverseMatrixCalculator"
calculator: "InverseMatrixCalculator"
input_stream: "MATRIX:poselandmarkbyroicpu__transformation_matrix"
output_stream: "MATRIX:poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__inverse_transformation_matrix"
}
node {
name: "poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__SwitchDemuxCalculator"
calculator: "SwitchDemuxCalculator"
input_side_packet: "SELECT:model_complexity"
options {
ext {
select: 1
}
}
input_stream_handler {
input_stream_handler: "ImmediateInputStreamHandler"
}
}
node {
name: "poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__ConstantSidePacketCalculator_1"
calculator: "ConstantSidePacketCalculator"
output_side_packet: "PACKET:poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__c0__poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
options {
ext {
packet {
string_value: "mediapipe/modules/pose_landmark/pose_landmark_lite.tflite"
}
}
}
}
node {
name: "poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__ConstantSidePacketCalculator_2"
calculator: "ConstantSidePacketCalculator"
output_side_packet: "PACKET:poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__c1__poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
options {
ext {
packet {
string_value: "mediapipe/modules/pose_landmark/pose_landmark_full.tflite"
}
}
}
}
node {
name: "poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__ConstantSidePacketCalculator_3"
calculator: "ConstantSidePacketCalculator"
output_side_packet: "PACKET:poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__c2__poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
options {
ext {
packet {
string_value: "mediapipe/modules/pose_landmark/pose_landmark_heavy.tflite"
}
}
}
}
node {
name: "poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__SwitchMuxCalculator"
calculator: "SwitchMuxCalculator"
input_side_packet: "SELECT:model_complexity"
input_side_packet: "C0__PACKET:poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__c0__poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
input_side_packet: "C1__PACKET:poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__c1__poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
input_side_packet: "C2__PACKET:poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__c2__poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
output_side_packet: "PACKET:poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
options {
ext {
select: 1
}
}
input_stream_handler {
input_stream_handler: "ImmediateInputStreamHandler"
}
}
node {
name: "poselandmarkbyroicpu__poselandmarkmodelloader__LocalFileContentsCalculator"
calculator: "LocalFileContentsCalculator"
input_side_packet: "FILE_PATH:poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
output_side_packet: "CONTENTS:poselandmarkbyroicpu__poselandmarkmodelloader__model_blob"
options {
ext {
text_mode: false
}
}
}
node {
name: "poselandmarkbyroicpu__poselandmarkmodelloader__TfLiteModelCalculator"
calculator: "TfLiteModelCalculator"
input_side_packet: "MODEL_BLOB:poselandmarkbyroicpu__poselandmarkmodelloader__model_blob"
output_side_packet: "MODEL:poselandmarkbyroicpu__model"
}
node {
name: "poselandmarkbyroicpu__inferencecalculator__poselandmarkbyroicpu__InferenceCalculator"
calculator: "InferenceCalculatorCpu"
input_stream: "TENSORS:poselandmarkbyroicpu__input_tensors"
output_stream: "TENSORS:poselandmarkbyroicpu__output_tensors"
input_side_packet: "MODEL:poselandmarkbyroicpu__model"
options {
ext {
delegate {
xnnpack {
}
}
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__SplitTensorVectorCalculator"
calculator: "SplitTensorVectorCalculator"
input_stream: "poselandmarkbyroicpu__output_tensors"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__landmark_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__pose_flag_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__segmentation_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__heatmap_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__world_landmark_tensor"
options {
ext {
ranges {
begin: 0
end: 1
}
ranges {
begin: 1
end: 2
}
ranges {
begin: 2
end: 3
}
ranges {
begin: 3
end: 4
}
ranges {
begin: 4
end: 5
}
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__TensorsToFloatsCalculator"
calculator: "TensorsToFloatsCalculator"
input_stream: "TENSORS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__pose_flag_tensor"
output_stream: "FLOAT:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__pose_presence_score"
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ThresholdingCalculator"
calculator: "ThresholdingCalculator"
input_stream: "FLOAT:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__pose_presence_score"
output_stream: "FLAG:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__pose_presence"
options {
ext {
threshold: 0.5
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__GateCalculator_1"
calculator: "GateCalculator"
input_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__landmark_tensor"
input_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__world_landmark_tensor"
input_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__segmentation_tensor"
input_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__heatmap_tensor"
input_stream: "ALLOW:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__pose_presence"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_landmark_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_world_landmark_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_segmentation_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_heatmap_tensor"
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__TensorsToLandmarksCalculator_1"
calculator: "TensorsToLandmarksCalculator"
input_stream: "TENSORS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_landmark_tensor"
output_stream: "NORM_LANDMARKS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__raw_landmarks"
options {
ext {
num_landmarks: 39
input_image_width: 256
input_image_height: 256
visibility_activation: SIGMOID
presence_activation: SIGMOID
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__RefineLandmarksFromHeatmapCalculator"
calculator: "RefineLandmarksFromHeatmapCalculator"
input_stream: "NORM_LANDMARKS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__raw_landmarks"
input_stream: "TENSORS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_heatmap_tensor"
output_stream: "NORM_LANDMARKS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__all_landmarks"
options {
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__SplitNormalizedLandmarkListCalculator"
calculator: "SplitNormalizedLandmarkListCalculator"
input_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__all_landmarks"
output_stream: "poselandmarkbyroicpu__roi_landmarks"
output_stream: "poselandmarkbyroicpu__roi_auxiliary_landmarks"
options {
ext {
ranges {
begin: 0
end: 33
}
ranges {
begin: 33
end: 35
}
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__TensorsToLandmarksCalculator_2"
calculator: "TensorsToLandmarksCalculator"
input_stream: "TENSORS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_world_landmark_tensor"
output_stream: "LANDMARKS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__all_world_landmarks"
options {
ext {
num_landmarks: 39
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__SplitLandmarkListCalculator"
calculator: "SplitLandmarkListCalculator"
input_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__all_world_landmarks"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__world_landmarks_without_visibility"
options {
ext {
ranges {
begin: 0
end: 33
}
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__VisibilityCopyCalculator"
calculator: "VisibilityCopyCalculator"
input_stream: "NORM_LANDMARKS_FROM:poselandmarkbyroicpu__roi_landmarks"
input_stream: "LANDMARKS_TO:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__world_landmarks_without_visibility"
output_stream: "LANDMARKS_TO:poselandmarkbyroicpu__roi_world_landmarks"
options {
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__GateCalculator_2"
calculator: "GateCalculator"
input_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_segmentation_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__enabled_segmentation_tensor"
input_side_packet: "ALLOW:enable_segmentation"
options {
ext {
allow: false
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__TensorsToSegmentationCalculator"
calculator: "TensorsToSegmentationCalculator"
input_stream: "TENSORS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__enabled_segmentation_tensor"
output_stream: "MASK:poselandmarkbyroicpu__roi_segmentation_mask"
options {
ext {
gpu_origin: TOP_LEFT
activation: SIGMOID
}
}
}
node {
name: "poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__LandmarkLetterboxRemovalCalculator_1"
calculator: "LandmarkLetterboxRemovalCalculator"
input_stream: "LANDMARKS:poselandmarkbyroicpu__roi_landmarks"
input_stream: "LETTERBOX_PADDING:poselandmarkbyroicpu__letterbox_padding"
output_stream: "LANDMARKS:poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__adjusted_landmarks"
}
node {
name: "poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__LandmarkLetterboxRemovalCalculator_2"
calculator: "LandmarkLetterboxRemovalCalculator"
input_stream: "LANDMARKS:poselandmarkbyroicpu__roi_auxiliary_landmarks"
input_stream: "LETTERBOX_PADDING:poselandmarkbyroicpu__letterbox_padding"
output_stream: "LANDMARKS:poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__adjusted_auxiliary_landmarks"
}
node {
name: "poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__LandmarkProjectionCalculator_1"
calculator: "LandmarkProjectionCalculator"
input_stream: "NORM_LANDMARKS:poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__adjusted_landmarks"
input_stream: "NORM_RECT:pose_rect"
output_stream: "NORM_LANDMARKS:unfiltered_pose_landmarks"
}
node {
name: "poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__LandmarkProjectionCalculator_2"
calculator: "LandmarkProjectionCalculator"
input_stream: "NORM_LANDMARKS:poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__adjusted_auxiliary_landmarks"
input_stream: "NORM_RECT:pose_rect"
output_stream: "NORM_LANDMARKS:unfiltered_auxiliary_landmarks"
}
node {
name: "poselandmarkfiltering__LandmarksToDetectionCalculator"
calculator: "LandmarksToDetectionCalculator"
input_stream: "NORM_LANDMARKS:unfiltered_auxiliary_landmarks"
output_stream: "DETECTION:poselandmarkfiltering__aux_detection"
}
node {
name: "poselandmarkfiltering__AlignmentPointsRectsCalculator"
calculator: "AlignmentPointsRectsCalculator"
input_stream: "DETECTION:poselandmarkfiltering__aux_detection"
input_stream: "IMAGE_SIZE:image_size"
output_stream: "NORM_RECT:poselandmarkfiltering__roi"
options {
ext {
rotation_vector_start_keypoint_index: 0
rotation_vector_end_keypoint_index: 1
rotation_vector_target_angle_degrees: 90
}
}
}
node {
name: "poselandmarkfiltering__VisibilitySmoothingCalculator"
calculator: "VisibilitySmoothingCalculator"
input_stream: "NORM_LANDMARKS:unfiltered_auxiliary_landmarks"
output_stream: "NORM_FILTERED_LANDMARKS:poselandmarkfiltering__filtered_aux_visibility"
options {
ext {
low_pass_filter {
alpha: 0.1
}
}
}
}
node {
name: "poselandmarkfiltering__LandmarksSmoothingCalculator"
calculator: "LandmarksSmoothingCalculator"
input_stream: "NORM_LANDMARKS:poselandmarkfiltering__filtered_aux_visibility"
input_stream: "IMAGE_SIZE:image_size"
input_stream: "OBJECT_SCALE_ROI:poselandmarkfiltering__roi"
output_stream: "NORM_FILTERED_LANDMARKS:auxiliary_landmarks"
options {
ext {
one_euro_filter {
min_cutoff: 0.01
beta: 10
derivate_cutoff: 1
}
}
}
}
node {
name: "poselandmarkstoroi__LandmarksToDetectionCalculator"
calculator: "LandmarksToDetectionCalculator"
input_stream: "NORM_LANDMARKS:auxiliary_landmarks"
output_stream: "DETECTION:poselandmarkstoroi__detection"
}
node {
name: "poselandmarkstoroi__AlignmentPointsRectsCalculator"
calculator: "AlignmentPointsRectsCalculator"
input_stream: "DETECTION:poselandmarkstoroi__detection"
input_stream: "IMAGE_SIZE:image_size"
output_stream: "NORM_RECT:poselandmarkstoroi__raw_roi"
options {
ext {
rotation_vector_start_keypoint_index: 0
rotation_vector_end_keypoint_index: 1
rotation_vector_target_angle_degrees: 90
}
}
}
node {
name: "poselandmarkstoroi__RectTransformationCalculator"
calculator: "RectTransformationCalculator"
input_stream: "NORM_RECT:poselandmarkstoroi__raw_roi"
input_stream: "IMAGE_SIZE:image_size"
output_stream: "pose_rect_from_landmarks"
options {
ext {
scale_x: 1.25
scale_y: 1.25
square_long: true
}
}
}
node {
name: "poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__WorldLandmarkProjectionCalculator"
calculator: "WorldLandmarkProjectionCalculator"
input_stream: "LANDMARKS:poselandmarkbyroicpu__roi_world_landmarks"
input_stream: "NORM_RECT:pose_rect"
output_stream: "LANDMARKS:unfiltered_world_landmarks"
}
node {
name: "poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__WarpAffineCalculator"
calculator: "WarpAffineCalculator"
input_stream: "IMAGE:poselandmarkbyroicpu__roi_segmentation_mask"
input_stream: "MATRIX:poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__inverse_transformation_matrix"
input_stream: "OUTPUT_SIZE:poselandmarkbyroicpu__image_size"
output_stream: "IMAGE:unfiltered_segmentation_mask"
options {
ext {
border_mode: BORDER_ZERO
gpu_origin: TOP_LEFT
}
}
}
node {
name: "posesegmentationfiltering__PreviousLoopbackCalculator"
calculator: "PreviousLoopbackCalculator"
input_stream: "MAIN:unfiltered_segmentation_mask"
input_stream: "LOOP:filtered_segmentation_mask"
output_stream: "PREV_LOOP:posesegmentationfiltering__prev_filtered_segmentation_mask"
input_stream_info {
tag_index: "LOOP"
back_edge: true
}
}
node {
name: "posesegmentationfiltering__GateCalculator"
calculator: "GateCalculator"
input_stream: "posesegmentationfiltering__prev_filtered_segmentation_mask"
output_stream: "posesegmentationfiltering__gated_prev_filtered_segmentation_mask"
input_side_packet: "ALLOW:smooth_segmentation"
options {
ext {
allow: true
}
}
}
node {
name: "posesegmentationfiltering__SegmentationSmoothingCalculator"
calculator: "SegmentationSmoothingCalculator"
input_stream: "MASK:unfiltered_segmentation_mask"
input_stream: "MASK_PREVIOUS:posesegmentationfiltering__gated_prev_filtered_segmentation_mask"
output_stream: "MASK_SMOOTHED:filtered_segmentation_mask"
options {
}
}
node {
calculator: "FromImageCalculator"
input_stream: "IMAGE:filtered_segmentation_mask"
output_stream: "IMAGE_CPU:segmentation_mask"
}
node {
name: "poselandmarkfiltering__switchcontainer_1__SwitchDemuxCalculator"
calculator: "SwitchDemuxCalculator"
input_stream: "NORM_LANDMARKS:unfiltered_pose_landmarks"
output_stream: "C0__NORM_LANDMARKS:poselandmarkfiltering__switchcontainer_1__c0__unfiltered_pose_landmarks"
output_stream: "C1__NORM_LANDMARKS:poselandmarkfiltering__switchcontainer_1__c1__unfiltered_pose_landmarks"
input_side_packet: "ENABLE:smooth_landmarks"
options {
ext {
enable: true
}
}
input_stream_handler {
input_stream_handler: "ImmediateInputStreamHandler"
}
}
node {
name: "poselandmarkfiltering__switchcontainer_1__VisibilitySmoothingCalculator_1"
calculator: "VisibilitySmoothingCalculator"
input_stream: "NORM_LANDMARKS:poselandmarkfiltering__switchcontainer_1__c0__unfiltered_pose_landmarks"
output_stream: "NORM_FILTERED_LANDMARKS:poselandmarkfiltering__switchcontainer_1__c0__poselandmarkfiltering__filtered_visibility"
options {
ext {
no_filter {
}
}
}
}
node {
name: "poselandmarkfiltering__switchcontainer_1__VisibilitySmoothingCalculator_2"
calculator: "VisibilitySmoothingCalculator"
input_stream: "NORM_LANDMARKS:poselandmarkfiltering__switchcontainer_1__c1__unfiltered_pose_landmarks"
output_stream: "NORM_FILTERED_LANDMARKS:poselandmarkfiltering__switchcontainer_1__c1__poselandmarkfiltering__filtered_visibility"
options {
ext {
low_pass_filter {
alpha: 0.1
}
}
}
}
......(could not paste all due to character limit)
input_stream_handler {
input_stream_handler: "ImmediateInputStreamHandler"
}
}
input_stream: "IMAGE:image"
output_stream: "LANDMARKS:pose_landmarks"
output_stream: "WORLD_LANDMARKS:pose_world_landmarks"
output_stream: "SEGMENTATION_MASK:segmentation_mask"
output_stream: "DETECTION:pose_detection"
output_stream: "ROI_FROM_LANDMARKS:pose_rect_from_landmarks"
output_stream: "ROI_FROM_DETECTION:pose_rect_from_detection"
input_side_packet: "SMOOTH_LANDMARKS:smooth_landmarks"
input_side_packet: "ENABLE_SEGMENTATION:enable_segmentation"
input_side_packet: "SMOOTH_SEGMENTATION:smooth_segmentation"
input_side_packet: "MODEL_COMPLEXITY:model_complexity"
input_side_packet: "USE_PREV_LANDMARKS:use_prev_landmarks"
executor {
}
type: "PoseLandmarkCpu"
您是否知道为什么它无法正常工作?
I am trying to get MediaPipe Pose estimation running on VS code on my MacBook M1. I installed it using pip install mediapipe-silicon
and it installed successfully.
I am running the generic MediaPipe code without modifications:
import cv2
import mediapipe as mp
import numpy as np
mp_drawing = mp.solutions.drawing_utils
mp_drawing_styles = mp.solutions.drawing_styles
mp_pose = mp.solutions.pose
cap = cv2.VideoCapture(0)
with mp_pose.Pose(
min_detection_confidence=0.5,
min_tracking_confidence=0.5) as pose:
while cap.isOpened():
success, image = cap.read()
if not success:
print("Ignoring empty camera frame.")
# If loading a video, use 'break' instead of 'continue'.
continue
# To improve performance, optionally mark the image as not writeable to
# pass by reference.
image.flags.writeable = False
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
results = pose.process(image)
# Draw the pose annotation on the image.
image.flags.writeable = True
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
mp_drawing.draw_landmarks(
image,
results.pose_landmarks,
mp_pose.POSE_CONNECTIONS,
landmark_drawing_spec=mp_drawing_styles.get_default_pose_landmarks_style())
# Flip the image horizontally for a selfie-view display.
cv2.imshow('MediaPipe Pose', cv2.flip(image, 1))
if cv2.waitKey(5) & 0xFF == 27:
break
cap.release()
When I run this code, the webcam light turns on for 2 seconds and then off. I do not get a pop up window to see the webcam. I also get this on the terminal:
objc[90068]: Class CaptureDelegate is implemented in both /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/cv2.cpython-310-darwin.so (0x10abe6458) and /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mediapipe/.dylibs/libopencv_videoio.3.4.16.dylib (0x10d4cc860). One of the two will be used. Which one is undefined.
objc[90068]: Class CVWindow is implemented in both /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/cv2.cpython-310-darwin.so (0x10abe64a8) and /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mediapipe/.dylibs/libopencv_highgui.3.4.16.dylib (0x10c430a68). One of the two will be used. Which one is undefined.
objc[90068]: Class CVView is implemented in both /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/cv2.cpython-310-darwin.so (0x10abe64d0) and /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mediapipe/.dylibs/libopencv_highgui.3.4.16.dylib (0x10c430a90). One of the two will be used. Which one is undefined.
objc[90068]: Class CVSlider is implemented in both /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/cv2.cpython-310-darwin.so (0x10abe64f8) and /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mediapipe/.dylibs/libopencv_highgui.3.4.16.dylib (0x10c430ab8). One of the two will be used. Which one is undefined.
[libprotobuf ERROR external/com_google_protobuf/src/google/protobuf/text_format.cc:335] Error parsing text-format mediapipe.CalculatorGraphConfig: 22:9: Message type "mediapipe.CalculatorOptions" has no field named "ext".
Traceback (most recent call last):
File "/Users/jana/Documents/GitHub/AS2-MLC-Project/multi_pose.py", line 7, in <module>
with mp_pose.Pose(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mediapipe/python/solutions/pose.py", line 146, in __init__
super().__init__(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mediapipe/python/solution_base.py", line 247, in __init__
self._graph = calculator_graph.CalculatorGraph(
RuntimeError: Failed to parse: node {
calculator: "ImagePropertiesCalculator"
input_stream: "IMAGE_CPU:image"
output_stream: "SIZE:image_size"
}
node {
calculator: "PreviousLoopbackCalculator"
input_stream: "MAIN:image"
input_stream: "LOOP:pose_rect_from_landmarks"
output_stream: "PREV_LOOP:prev_pose_rect_from_landmarks"
input_stream_info {
tag_index: "LOOP"
back_edge: true
}
}
node {
calculator: "GateCalculator"
input_stream: "prev_pose_rect_from_landmarks"
output_stream: "gated_prev_pose_rect_from_landmarks"
input_side_packet: "ALLOW:use_prev_landmarks"
options {
ext {
allow: true
}
}
}
node {
calculator: "PacketPresenceCalculator"
input_stream: "PACKET:gated_prev_pose_rect_from_landmarks"
output_stream: "PRESENCE:prev_pose_rect_from_landmarks_is_present"
}
node {
calculator: "GateCalculator"
input_stream: "image"
input_stream: "image_size"
input_stream: "DISALLOW:prev_pose_rect_from_landmarks_is_present"
output_stream: "image_for_pose_detection"
output_stream: "image_size_for_pose_detection"
options {
ext {
empty_packets_as_allow: true
}
}
}
node {
name: "posedetectioncpu__ImageToTensorCalculator"
calculator: "ImageToTensorCalculator"
input_stream: "IMAGE:image_for_pose_detection"
output_stream: "TENSORS:posedetectioncpu__input_tensors"
output_stream: "LETTERBOX_PADDING:posedetectioncpu__letterbox_padding"
options {
ext {
output_tensor_width: 224
output_tensor_height: 224
keep_aspect_ratio: true
output_tensor_float_range {
min: -1
max: 1
}
gpu_origin: TOP_LEFT
border_mode: BORDER_ZERO
}
}
}
node {
name: "posedetectioncpu__SsdAnchorsCalculator"
calculator: "SsdAnchorsCalculator"
output_side_packet: "posedetectioncpu__anchors"
options {
ext {
input_size_width: 224
input_size_height: 224
min_scale: 0.1484375
max_scale: 0.75
anchor_offset_x: 0.5
anchor_offset_y: 0.5
num_layers: 5
strides: 8
strides: 16
strides: 32
strides: 32
strides: 32
aspect_ratios: 1
fixed_anchor_size: true
}
}
}
node {
name: "poselandmarkbyroicpu__ImagePropertiesCalculator"
calculator: "ImagePropertiesCalculator"
input_stream: "IMAGE_CPU:image"
output_stream: "SIZE:poselandmarkbyroicpu__image_size"
}
node {
name: "posedetectioncpu__inferencecalculator__posedetectioncpu__InferenceCalculator"
calculator: "InferenceCalculatorCpu"
input_stream: "TENSORS:posedetectioncpu__input_tensors"
output_stream: "TENSORS:posedetectioncpu__detection_tensors"
options {
ext {
model_path: "mediapipe/modules/pose_detection/pose_detection.tflite"
delegate {
xnnpack {
}
}
}
}
}
node {
name: "posedetectioncpu__TensorsToDetectionsCalculator"
calculator: "TensorsToDetectionsCalculator"
input_stream: "TENSORS:posedetectioncpu__detection_tensors"
output_stream: "DETECTIONS:posedetectioncpu__unfiltered_detections"
input_side_packet: "ANCHORS:posedetectioncpu__anchors"
options {
ext {
num_classes: 1
num_boxes: 2254
num_coords: 12
keypoint_coord_offset: 4
num_keypoints: 4
num_values_per_keypoint: 2
box_coord_offset: 0
x_scale: 224
y_scale: 224
w_scale: 224
h_scale: 224
reverse_output_order: true
sigmoid_score: true
score_clipping_thresh: 100
min_score_thresh: 0.5
}
}
}
node {
name: "posedetectioncpu__NonMaxSuppressionCalculator"
calculator: "NonMaxSuppressionCalculator"
input_stream: "posedetectioncpu__unfiltered_detections"
output_stream: "posedetectioncpu__filtered_detections"
options {
ext {
min_suppression_threshold: 0.3
overlap_type: INTERSECTION_OVER_UNION
algorithm: WEIGHTED
}
}
}
node {
name: "posedetectioncpu__DetectionLetterboxRemovalCalculator"
calculator: "DetectionLetterboxRemovalCalculator"
input_stream: "DETECTIONS:posedetectioncpu__filtered_detections"
input_stream: "LETTERBOX_PADDING:posedetectioncpu__letterbox_padding"
output_stream: "DETECTIONS:pose_detections"
}
node {
calculator: "SplitDetectionVectorCalculator"
input_stream: "pose_detections"
output_stream: "pose_detection"
options {
ext {
ranges {
begin: 0
end: 1
}
element_only: true
}
}
}
node {
name: "posedetectiontoroi__AlignmentPointsRectsCalculator"
calculator: "AlignmentPointsRectsCalculator"
input_stream: "DETECTION:pose_detection"
input_stream: "IMAGE_SIZE:image_size_for_pose_detection"
output_stream: "NORM_RECT:posedetectiontoroi__raw_roi"
options {
ext {
rotation_vector_start_keypoint_index: 0
rotation_vector_end_keypoint_index: 1
rotation_vector_target_angle_degrees: 90
}
}
}
node {
name: "posedetectiontoroi__RectTransformationCalculator"
calculator: "RectTransformationCalculator"
input_stream: "NORM_RECT:posedetectiontoroi__raw_roi"
input_stream: "IMAGE_SIZE:image_size_for_pose_detection"
output_stream: "pose_rect_from_detection"
options {
ext {
scale_x: 1.25
scale_y: 1.25
square_long: true
}
}
}
node {
calculator: "MergeCalculator"
input_stream: "pose_rect_from_detection"
input_stream: "gated_prev_pose_rect_from_landmarks"
output_stream: "pose_rect"
}
node {
name: "poselandmarkbyroicpu__ImageToTensorCalculator"
calculator: "ImageToTensorCalculator"
input_stream: "IMAGE:image"
input_stream: "NORM_RECT:pose_rect"
output_stream: "TENSORS:poselandmarkbyroicpu__input_tensors"
output_stream: "LETTERBOX_PADDING:poselandmarkbyroicpu__letterbox_padding"
output_stream: "MATRIX:poselandmarkbyroicpu__transformation_matrix"
options {
ext {
output_tensor_width: 256
output_tensor_height: 256
keep_aspect_ratio: true
output_tensor_float_range {
min: 0
max: 1
}
}
}
}
node {
name: "poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__InverseMatrixCalculator"
calculator: "InverseMatrixCalculator"
input_stream: "MATRIX:poselandmarkbyroicpu__transformation_matrix"
output_stream: "MATRIX:poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__inverse_transformation_matrix"
}
node {
name: "poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__SwitchDemuxCalculator"
calculator: "SwitchDemuxCalculator"
input_side_packet: "SELECT:model_complexity"
options {
ext {
select: 1
}
}
input_stream_handler {
input_stream_handler: "ImmediateInputStreamHandler"
}
}
node {
name: "poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__ConstantSidePacketCalculator_1"
calculator: "ConstantSidePacketCalculator"
output_side_packet: "PACKET:poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__c0__poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
options {
ext {
packet {
string_value: "mediapipe/modules/pose_landmark/pose_landmark_lite.tflite"
}
}
}
}
node {
name: "poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__ConstantSidePacketCalculator_2"
calculator: "ConstantSidePacketCalculator"
output_side_packet: "PACKET:poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__c1__poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
options {
ext {
packet {
string_value: "mediapipe/modules/pose_landmark/pose_landmark_full.tflite"
}
}
}
}
node {
name: "poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__ConstantSidePacketCalculator_3"
calculator: "ConstantSidePacketCalculator"
output_side_packet: "PACKET:poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__c2__poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
options {
ext {
packet {
string_value: "mediapipe/modules/pose_landmark/pose_landmark_heavy.tflite"
}
}
}
}
node {
name: "poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__SwitchMuxCalculator"
calculator: "SwitchMuxCalculator"
input_side_packet: "SELECT:model_complexity"
input_side_packet: "C0__PACKET:poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__c0__poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
input_side_packet: "C1__PACKET:poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__c1__poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
input_side_packet: "C2__PACKET:poselandmarkbyroicpu__poselandmarkmodelloader__switchcontainer__c2__poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
output_side_packet: "PACKET:poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
options {
ext {
select: 1
}
}
input_stream_handler {
input_stream_handler: "ImmediateInputStreamHandler"
}
}
node {
name: "poselandmarkbyroicpu__poselandmarkmodelloader__LocalFileContentsCalculator"
calculator: "LocalFileContentsCalculator"
input_side_packet: "FILE_PATH:poselandmarkbyroicpu__poselandmarkmodelloader__model_path"
output_side_packet: "CONTENTS:poselandmarkbyroicpu__poselandmarkmodelloader__model_blob"
options {
ext {
text_mode: false
}
}
}
node {
name: "poselandmarkbyroicpu__poselandmarkmodelloader__TfLiteModelCalculator"
calculator: "TfLiteModelCalculator"
input_side_packet: "MODEL_BLOB:poselandmarkbyroicpu__poselandmarkmodelloader__model_blob"
output_side_packet: "MODEL:poselandmarkbyroicpu__model"
}
node {
name: "poselandmarkbyroicpu__inferencecalculator__poselandmarkbyroicpu__InferenceCalculator"
calculator: "InferenceCalculatorCpu"
input_stream: "TENSORS:poselandmarkbyroicpu__input_tensors"
output_stream: "TENSORS:poselandmarkbyroicpu__output_tensors"
input_side_packet: "MODEL:poselandmarkbyroicpu__model"
options {
ext {
delegate {
xnnpack {
}
}
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__SplitTensorVectorCalculator"
calculator: "SplitTensorVectorCalculator"
input_stream: "poselandmarkbyroicpu__output_tensors"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__landmark_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__pose_flag_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__segmentation_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__heatmap_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__world_landmark_tensor"
options {
ext {
ranges {
begin: 0
end: 1
}
ranges {
begin: 1
end: 2
}
ranges {
begin: 2
end: 3
}
ranges {
begin: 3
end: 4
}
ranges {
begin: 4
end: 5
}
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__TensorsToFloatsCalculator"
calculator: "TensorsToFloatsCalculator"
input_stream: "TENSORS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__pose_flag_tensor"
output_stream: "FLOAT:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__pose_presence_score"
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ThresholdingCalculator"
calculator: "ThresholdingCalculator"
input_stream: "FLOAT:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__pose_presence_score"
output_stream: "FLAG:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__pose_presence"
options {
ext {
threshold: 0.5
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__GateCalculator_1"
calculator: "GateCalculator"
input_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__landmark_tensor"
input_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__world_landmark_tensor"
input_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__segmentation_tensor"
input_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__heatmap_tensor"
input_stream: "ALLOW:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__pose_presence"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_landmark_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_world_landmark_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_segmentation_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_heatmap_tensor"
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__TensorsToLandmarksCalculator_1"
calculator: "TensorsToLandmarksCalculator"
input_stream: "TENSORS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_landmark_tensor"
output_stream: "NORM_LANDMARKS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__raw_landmarks"
options {
ext {
num_landmarks: 39
input_image_width: 256
input_image_height: 256
visibility_activation: SIGMOID
presence_activation: SIGMOID
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__RefineLandmarksFromHeatmapCalculator"
calculator: "RefineLandmarksFromHeatmapCalculator"
input_stream: "NORM_LANDMARKS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__raw_landmarks"
input_stream: "TENSORS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_heatmap_tensor"
output_stream: "NORM_LANDMARKS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__all_landmarks"
options {
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__SplitNormalizedLandmarkListCalculator"
calculator: "SplitNormalizedLandmarkListCalculator"
input_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__all_landmarks"
output_stream: "poselandmarkbyroicpu__roi_landmarks"
output_stream: "poselandmarkbyroicpu__roi_auxiliary_landmarks"
options {
ext {
ranges {
begin: 0
end: 33
}
ranges {
begin: 33
end: 35
}
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__TensorsToLandmarksCalculator_2"
calculator: "TensorsToLandmarksCalculator"
input_stream: "TENSORS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_world_landmark_tensor"
output_stream: "LANDMARKS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__all_world_landmarks"
options {
ext {
num_landmarks: 39
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__SplitLandmarkListCalculator"
calculator: "SplitLandmarkListCalculator"
input_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__all_world_landmarks"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__world_landmarks_without_visibility"
options {
ext {
ranges {
begin: 0
end: 33
}
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__VisibilityCopyCalculator"
calculator: "VisibilityCopyCalculator"
input_stream: "NORM_LANDMARKS_FROM:poselandmarkbyroicpu__roi_landmarks"
input_stream: "LANDMARKS_TO:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__world_landmarks_without_visibility"
output_stream: "LANDMARKS_TO:poselandmarkbyroicpu__roi_world_landmarks"
options {
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__GateCalculator_2"
calculator: "GateCalculator"
input_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__ensured_segmentation_tensor"
output_stream: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__enabled_segmentation_tensor"
input_side_packet: "ALLOW:enable_segmentation"
options {
ext {
allow: false
}
}
}
node {
name: "poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__TensorsToSegmentationCalculator"
calculator: "TensorsToSegmentationCalculator"
input_stream: "TENSORS:poselandmarkbyroicpu__tensorstoposelandmarksandsegmentation__enabled_segmentation_tensor"
output_stream: "MASK:poselandmarkbyroicpu__roi_segmentation_mask"
options {
ext {
gpu_origin: TOP_LEFT
activation: SIGMOID
}
}
}
node {
name: "poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__LandmarkLetterboxRemovalCalculator_1"
calculator: "LandmarkLetterboxRemovalCalculator"
input_stream: "LANDMARKS:poselandmarkbyroicpu__roi_landmarks"
input_stream: "LETTERBOX_PADDING:poselandmarkbyroicpu__letterbox_padding"
output_stream: "LANDMARKS:poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__adjusted_landmarks"
}
node {
name: "poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__LandmarkLetterboxRemovalCalculator_2"
calculator: "LandmarkLetterboxRemovalCalculator"
input_stream: "LANDMARKS:poselandmarkbyroicpu__roi_auxiliary_landmarks"
input_stream: "LETTERBOX_PADDING:poselandmarkbyroicpu__letterbox_padding"
output_stream: "LANDMARKS:poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__adjusted_auxiliary_landmarks"
}
node {
name: "poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__LandmarkProjectionCalculator_1"
calculator: "LandmarkProjectionCalculator"
input_stream: "NORM_LANDMARKS:poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__adjusted_landmarks"
input_stream: "NORM_RECT:pose_rect"
output_stream: "NORM_LANDMARKS:unfiltered_pose_landmarks"
}
node {
name: "poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__LandmarkProjectionCalculator_2"
calculator: "LandmarkProjectionCalculator"
input_stream: "NORM_LANDMARKS:poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__adjusted_auxiliary_landmarks"
input_stream: "NORM_RECT:pose_rect"
output_stream: "NORM_LANDMARKS:unfiltered_auxiliary_landmarks"
}
node {
name: "poselandmarkfiltering__LandmarksToDetectionCalculator"
calculator: "LandmarksToDetectionCalculator"
input_stream: "NORM_LANDMARKS:unfiltered_auxiliary_landmarks"
output_stream: "DETECTION:poselandmarkfiltering__aux_detection"
}
node {
name: "poselandmarkfiltering__AlignmentPointsRectsCalculator"
calculator: "AlignmentPointsRectsCalculator"
input_stream: "DETECTION:poselandmarkfiltering__aux_detection"
input_stream: "IMAGE_SIZE:image_size"
output_stream: "NORM_RECT:poselandmarkfiltering__roi"
options {
ext {
rotation_vector_start_keypoint_index: 0
rotation_vector_end_keypoint_index: 1
rotation_vector_target_angle_degrees: 90
}
}
}
node {
name: "poselandmarkfiltering__VisibilitySmoothingCalculator"
calculator: "VisibilitySmoothingCalculator"
input_stream: "NORM_LANDMARKS:unfiltered_auxiliary_landmarks"
output_stream: "NORM_FILTERED_LANDMARKS:poselandmarkfiltering__filtered_aux_visibility"
options {
ext {
low_pass_filter {
alpha: 0.1
}
}
}
}
node {
name: "poselandmarkfiltering__LandmarksSmoothingCalculator"
calculator: "LandmarksSmoothingCalculator"
input_stream: "NORM_LANDMARKS:poselandmarkfiltering__filtered_aux_visibility"
input_stream: "IMAGE_SIZE:image_size"
input_stream: "OBJECT_SCALE_ROI:poselandmarkfiltering__roi"
output_stream: "NORM_FILTERED_LANDMARKS:auxiliary_landmarks"
options {
ext {
one_euro_filter {
min_cutoff: 0.01
beta: 10
derivate_cutoff: 1
}
}
}
}
node {
name: "poselandmarkstoroi__LandmarksToDetectionCalculator"
calculator: "LandmarksToDetectionCalculator"
input_stream: "NORM_LANDMARKS:auxiliary_landmarks"
output_stream: "DETECTION:poselandmarkstoroi__detection"
}
node {
name: "poselandmarkstoroi__AlignmentPointsRectsCalculator"
calculator: "AlignmentPointsRectsCalculator"
input_stream: "DETECTION:poselandmarkstoroi__detection"
input_stream: "IMAGE_SIZE:image_size"
output_stream: "NORM_RECT:poselandmarkstoroi__raw_roi"
options {
ext {
rotation_vector_start_keypoint_index: 0
rotation_vector_end_keypoint_index: 1
rotation_vector_target_angle_degrees: 90
}
}
}
node {
name: "poselandmarkstoroi__RectTransformationCalculator"
calculator: "RectTransformationCalculator"
input_stream: "NORM_RECT:poselandmarkstoroi__raw_roi"
input_stream: "IMAGE_SIZE:image_size"
output_stream: "pose_rect_from_landmarks"
options {
ext {
scale_x: 1.25
scale_y: 1.25
square_long: true
}
}
}
node {
name: "poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__WorldLandmarkProjectionCalculator"
calculator: "WorldLandmarkProjectionCalculator"
input_stream: "LANDMARKS:poselandmarkbyroicpu__roi_world_landmarks"
input_stream: "NORM_RECT:pose_rect"
output_stream: "LANDMARKS:unfiltered_world_landmarks"
}
node {
name: "poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__WarpAffineCalculator"
calculator: "WarpAffineCalculator"
input_stream: "IMAGE:poselandmarkbyroicpu__roi_segmentation_mask"
input_stream: "MATRIX:poselandmarkbyroicpu__poselandmarksandsegmentationinverseprojection__inverse_transformation_matrix"
input_stream: "OUTPUT_SIZE:poselandmarkbyroicpu__image_size"
output_stream: "IMAGE:unfiltered_segmentation_mask"
options {
ext {
border_mode: BORDER_ZERO
gpu_origin: TOP_LEFT
}
}
}
node {
name: "posesegmentationfiltering__PreviousLoopbackCalculator"
calculator: "PreviousLoopbackCalculator"
input_stream: "MAIN:unfiltered_segmentation_mask"
input_stream: "LOOP:filtered_segmentation_mask"
output_stream: "PREV_LOOP:posesegmentationfiltering__prev_filtered_segmentation_mask"
input_stream_info {
tag_index: "LOOP"
back_edge: true
}
}
node {
name: "posesegmentationfiltering__GateCalculator"
calculator: "GateCalculator"
input_stream: "posesegmentationfiltering__prev_filtered_segmentation_mask"
output_stream: "posesegmentationfiltering__gated_prev_filtered_segmentation_mask"
input_side_packet: "ALLOW:smooth_segmentation"
options {
ext {
allow: true
}
}
}
node {
name: "posesegmentationfiltering__SegmentationSmoothingCalculator"
calculator: "SegmentationSmoothingCalculator"
input_stream: "MASK:unfiltered_segmentation_mask"
input_stream: "MASK_PREVIOUS:posesegmentationfiltering__gated_prev_filtered_segmentation_mask"
output_stream: "MASK_SMOOTHED:filtered_segmentation_mask"
options {
}
}
node {
calculator: "FromImageCalculator"
input_stream: "IMAGE:filtered_segmentation_mask"
output_stream: "IMAGE_CPU:segmentation_mask"
}
node {
name: "poselandmarkfiltering__switchcontainer_1__SwitchDemuxCalculator"
calculator: "SwitchDemuxCalculator"
input_stream: "NORM_LANDMARKS:unfiltered_pose_landmarks"
output_stream: "C0__NORM_LANDMARKS:poselandmarkfiltering__switchcontainer_1__c0__unfiltered_pose_landmarks"
output_stream: "C1__NORM_LANDMARKS:poselandmarkfiltering__switchcontainer_1__c1__unfiltered_pose_landmarks"
input_side_packet: "ENABLE:smooth_landmarks"
options {
ext {
enable: true
}
}
input_stream_handler {
input_stream_handler: "ImmediateInputStreamHandler"
}
}
node {
name: "poselandmarkfiltering__switchcontainer_1__VisibilitySmoothingCalculator_1"
calculator: "VisibilitySmoothingCalculator"
input_stream: "NORM_LANDMARKS:poselandmarkfiltering__switchcontainer_1__c0__unfiltered_pose_landmarks"
output_stream: "NORM_FILTERED_LANDMARKS:poselandmarkfiltering__switchcontainer_1__c0__poselandmarkfiltering__filtered_visibility"
options {
ext {
no_filter {
}
}
}
}
node {
name: "poselandmarkfiltering__switchcontainer_1__VisibilitySmoothingCalculator_2"
calculator: "VisibilitySmoothingCalculator"
input_stream: "NORM_LANDMARKS:poselandmarkfiltering__switchcontainer_1__c1__unfiltered_pose_landmarks"
output_stream: "NORM_FILTERED_LANDMARKS:poselandmarkfiltering__switchcontainer_1__c1__poselandmarkfiltering__filtered_visibility"
options {
ext {
low_pass_filter {
alpha: 0.1
}
}
}
}
......(could not paste all due to character limit)
input_stream_handler {
input_stream_handler: "ImmediateInputStreamHandler"
}
}
input_stream: "IMAGE:image"
output_stream: "LANDMARKS:pose_landmarks"
output_stream: "WORLD_LANDMARKS:pose_world_landmarks"
output_stream: "SEGMENTATION_MASK:segmentation_mask"
output_stream: "DETECTION:pose_detection"
output_stream: "ROI_FROM_LANDMARKS:pose_rect_from_landmarks"
output_stream: "ROI_FROM_DETECTION:pose_rect_from_detection"
input_side_packet: "SMOOTH_LANDMARKS:smooth_landmarks"
input_side_packet: "ENABLE_SEGMENTATION:enable_segmentation"
input_side_packet: "SMOOTH_SEGMENTATION:smooth_segmentation"
input_side_packet: "MODEL_COMPLEXITY:model_complexity"
input_side_packet: "USE_PREV_LANDMARKS:use_prev_landmarks"
executor {
}
type: "PoseLandmarkCpu"
Do you have any idea why it is not working properly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我今天面临着完全相同的问题,并在新的3.9.10 Python环境中安装MediaPipe-Silicon和Opencv-Python 做到了这一点。我认为这可能与MediaPipe的底层操作和编译版本的“ Media Pipe-Silicon”有关,从而防止其与其他Python发行版效果很好。
I was facing this exact same issue today and installing mediapipe-silicon and opencv-python in a new 3.9.10 Python environment did the trick. I think it might have something to do with the under-the-hood operation of mediapipe and the compiled version "media pipe-silicon" that prevents it from playing nicely with other Python distros.