I do like to estimate the pose from an image using MediaPipe
, Following their Tutorial I'm getting this error:
ERROR: No subgraph in the model
CalculatorGraph::Run() failed in Run
while doing that!
This error appears in Ubuntu 20.04, boost 1.71, mediapipe 0.8.10.1
The same code is working perfectly on Windows.
Can you please tell me how can I resolve this error? thanks in advance.
The code I'm using to draw the pose:
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
def draw_pose(image):
"""
"""
BG_COLOR = (192, 192, 192)
with mp_pose.Pose(
static_image_mode=True,
model_complexity=2,
enable_segmentation=True,
min_detection_confidence=0.5) as pose:
image_height, image_width, _ = image.shape
# Convert the BGR image to RGB before processing.
results = pose.process(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
if not results.pose_landmarks:
return image
annotated_image = image.copy()
# Draw segmentation on the image.
# To improve segmentation around boundaries, consider applying a joint
# bilateral filter to "results.segmentation_mask" with "image".
condition = np.stack((results.segmentation_mask,) * 3, axis=-1) > 0.1
bg_image = np.zeros(image.shape, dtype=np.uint8)
bg_image[:] = BG_COLOR
annotated_image = np.where(condition, annotated_image, bg_image)
# Draw pose landmarks on the image.
mp_drawing.draw_landmarks(
annotated_image,
results.pose_landmarks,
mp_pose.POSE_CONNECTIONS,
landmark_drawing_spec=mp_drawing_styles.get_default_pose_landmarks_style())
return annotated_image
path = "/media/user/WD/Vision_Module/"
imName = "frame.png"
img = cv2.imread(path+imName)
res = draw_pose(img)
cv2.imshow(res)
cv2.waitKey(0)
Error Log:
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
ERROR: No subgraph in the model.
WARNING: Logging before InitGoogleLogging() is written to STDERR
E20220111 09:38:55.000392 9542 calculator_graph.cc:805] INTERNAL: CalculatorGraph::Run() failed in Run:
Calculator::Open() for node "poselandmarkbyroicpu__inferencecalculator__poselandmarkbyroicpu__InferenceCalculator" failed: ; interpreter_ilure (mediapipe/calculators/tensor/inference_calculator_cpu.cc:152)
Traceback (most recent call last):
File "/media/user/WD/Vision_Module/pose_est.py", line 24, in draw_pose
results = pose.process(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
File "/home/user/.local/lib/python3.8/site-packages/mediapipe/python/solutions/pose.py", line 185, in process
results = super().process(input_data={'image': image})
File "/home/user/.local/lib/python3.8/site-packages/mediapipe/python/solution_base.py", line 334, in process
self._graph.wait_until_idle()
RuntimeError: CalculatorGraph::Run() failed in Run:
Calculator::Open() for node "poselandmarkbyroicpu__inferencecalculator__poselandmarkbyroicpu__InferenceCalculator" failed: ; interpreter_ilure (mediapipe/calculators/tensor/inference_calculator_cpu.cc:152)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/media/user/WD/Vision_Module/pose_est.py", line 49, in <module>
res = draw_pose(img)
File "/media/user/WD/Vision_Module/pose_est.py", line 38, in draw_pose
mp_drawing.draw_landmarks(
File "/home/user/.local/lib/python3.8/site-packages/mediapipe/python/solution_base.py", line 546, in __exit__
self.close()
File "/home/user/.local/lib/python3.8/site-packages/mediapipe/python/solution_base.py", line 352, in close
self._graph.close()
RuntimeError: CalculatorGraph::Run() failed in Run:
Calculator::Open() for node "poselandmarkbyroicpu__inferencecalculator__poselandmarkbyroicpu__InferenceCalculator" failed: ; interpreter_ilure (mediapipe/calculators/tensor/inference_calculator_cpu.cc:152)