mediapipe: ValidatedGraphConfig Initialization Failed

OS Platform and Distribution

MacOS ARM

Compiler version

No response

Programming Language and version

Python 3.11.8

Installed using virtualenv? pip? Conda?(if python)

virtualenv pip

MediaPipe version

0.10.10

Bazel version

7.0.2

XCode and Tulsi versions (if iOS)

15.2

Android SDK and NDK versions (if android)

No response

Android AAR (if android)

None

OpenCV version (if running on desktop)

4.9.0

Describe the problem

It gives me errors everytime I run anything that relates to mediapipe. CV runs great, but when trying to use hands = mpHands.Hands(), hands = mp.solutions.hands, I get the error. Is it because I’m running on Mac ARM? I

Complete Logs

/Users/usera/Documents/Development/Apps/prj/.venv/bin/python /Users/usera/Documents/Development/Apps/prj/main.py 

2024-02-24 17:53:59.478 python[83108:17726527] WARNING: AVCaptureDeviceTypeExternal is deprecated for Continuity Cameras. Please use AVCaptureDeviceTypeContinuityCamera and add NSCameraUseContinuityCameraDeviceType to your Info.plist.
Traceback (most recent call last):
  File "/Users/usera/Documents/Development/Apps/prj/main.py", line 8, in <module>
    hands = mpHands.Hands()
            ^^^^^^^^^^^^^^^
  File "/Users/usera/Documents/Development/Apps/prj/.venv/lib/python3.11/site-packages/mediapipe/python/solutions/hands.py", line 114, in __init__
    super().__init__(
  File "/Users/usera/Documents/Development/Apps/prj/.venv/lib/python3.11/site-packages/mediapipe/python/solution_base.py", line 248, in __init__
    self._graph = calculator_graph.CalculatorGraph(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: ValidatedGraphConfig Initialization failed.
ImageToTensorCalculator: ; RET_CHECK failure (mediapipe/calculators/tensor/image_to_tensor_calculator.cc:144) ValidateOptionOutputDims(options) returned INTERNAL: ; RET_CHECK failure (./mediapipe/calculators/tensor/image_to_tensor_utils.h:136) options.has_output_tensor_float_range() || options.has_output_tensor_int_range() || options.has_output_tensor_uint_range()Output tensor range is required. 
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
ImageToTensorCalculator: ; RET_CHECK failure (mediapipe/calculators/tensor/image_to_tensor_calculator.cc:144) ValidateOptionOutputDims(options) returned INTERNAL: ; RET_CHECK failure (./mediapipe/calculators/tensor/image_to_tensor_utils.h:136) options.has_output_tensor_float_range() || options.has_output_tensor_int_range() || options.has_output_tensor_uint_range()Output tensor range is required. 
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
SplitTensorVectorCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.

Process finished with exit code 1

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Reactions: 4
  • Comments: 28

Most upvoted comments

I was able to replicate this error on an M1 mac with 3.11.7, running mediapipe 0.10.10, trying to run mediapipe holistic pose estimation. Downgrading to 0.10.9 fixed this issue.

It appears to happen on intel macs too, as I only tested the upgrade while trying to fix an issue from someone running 0.10.10 on an intel mac

If the issue stems from legacy solutions, we believe it will not be addressed, as we have already deprecated and ceased maintenance on them.

@kuaashish thanks for the response. Maybe it’s best if mediapipe adds a deprecation warning when trying to run code like this? It seems even for solutions that are still maintained (hands, pose), they fail with a calculator graph error. Checking the documentation, it seems there’s new code recommended on for the maintained solutions:

import mediapipe as mp

BaseOptions = mp.tasks.BaseOptions
PoseLandmarker = mp.tasks.vision.PoseLandmarker
PoseLandmarkerOptions = mp.tasks.vision.PoseLandmarkerOptions
VisionRunningMode = mp.tasks.vision.RunningMode

options = PoseLandmarkerOptions(
    base_options=BaseOptions(model_asset_path=model_path),
    running_mode=VisionRunningMode.IMAGE)

with PoseLandmarker.create_from_options(options) as landmarker:
  # The landmarker is initialized. Use it here.

But accessing the old method like from mediapipe.python.solutions.pose import Pose; Pose() is still possible, it just gives you a calculator graph error.

I think the expected behavior would be either an import error when trying to import the solutions this way, or a logged warning that this is no longer the proper way of calling this solution.

philipqueen

Thanks for the tip. I was facing the same issue on my M3 Mac and downgrading mediapipe to 0.10.9 did resolve it.

The legacy solutions seem to work with 0.10.13 on Mac again 😃

$ python -c "from mediapipe.python.solutions.face_mesh import FaceMesh; FaceMesh()"
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1714788179.915617 3679575 gl_context.cc:357] GL version: 2.1 (2.1 Metal - 88), renderer: Apple M2 Pro
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.

Thanks a lot, downgrading mediapipe to 0.10.9 worked for me as well. I’ve Macbook Air M1.

@kuaashish Is any work being done on this? The past two releases on mac error when trying to use any of the legacy solutions. Will this be fixed or are the legacy solutions deprecated?

Below is the full error message. The list of errors seems relatively straightforward, although I’m not familiar enough with the inner workings of mediapipe to tackle it myself.

python -c "from mediapipe.python.solutions.holistic import Holistic; Holistic()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/philipqueen/miniconda3/envs/mp_test/lib/python3.11/site-packages/mediapipe/python/solutions/holistic.py", line 114, in __init__
    super().__init__(
  File "/Users/philipqueen/miniconda3/envs/mp_test/lib/python3.11/site-packages/mediapipe/python/solution_base.py", line 248, in __init__
    self._graph = calculator_graph.CalculatorGraph(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: ValidatedGraphConfig Initialization failed.
ImageToTensorCalculator: ; RET_CHECK failure (mediapipe/calculators/tensor/image_to_tensor_calculator.cc:144) ValidateOptionOutputDims(options) returned INTERNAL: ; RET_CHECK failure (./mediapipe/calculators/tensor/image_to_tensor_utils.h:136) options.has_output_tensor_float_range() || options.has_output_tensor_int_range() || options.has_output_tensor_uint_range()Output tensor range is required. 
InferenceCalculatorCpu: ; RET_CHECK failure (mediapipe/calculators/tensor/inference_calculator_cpu.cc:63) !options.model_path().empty() ^ kSideInModel(cc).IsConnected()Either model as side packet or model path in options is required.
SplitDetectionVectorCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
ImageToTensorCalculator: ; RET_CHECK failure (mediapipe/calculators/tensor/image_to_tensor_calculator.cc:144) ValidateOptionOutputDims(options) returned INTERNAL: ; RET_CHECK failure (./mediapipe/calculators/tensor/image_to_tensor_utils.h:136) options.has_output_tensor_float_range() || options.has_output_tensor_int_range() || options.has_output_tensor_uint_range()Output tensor range is required. 
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
SplitTensorVectorCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
SplitNormalizedLandmarkListCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
SplitLandmarkListCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
SplitNormalizedLandmarkListCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
SplitNormalizedLandmarkListCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
SplitNormalizedLandmarkListCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
SplitNormalizedLandmarkListCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
ImageToTensorCalculator: ; RET_CHECK failure (mediapipe/calculators/tensor/image_to_tensor_calculator.cc:144) ValidateOptionOutputDims(options) returned INTERNAL: ; RET_CHECK failure (./mediapipe/calculators/tensor/image_to_tensor_utils.h:136) options.has_output_tensor_float_range() || options.has_output_tensor_int_range() || options.has_output_tensor_uint_range()Output tensor range is required. 
SplitNormalizedLandmarkListCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
ImageToTensorCalculator: ; RET_CHECK failure (mediapipe/calculators/tensor/image_to_tensor_calculator.cc:144) ValidateOptionOutputDims(options) returned INTERNAL: ; RET_CHECK failure (./mediapipe/calculators/tensor/image_to_tensor_utils.h:136) options.has_output_tensor_float_range() || options.has_output_tensor_int_range() || options.has_output_tensor_uint_range()Output tensor range is required. 
InferenceCalculatorCpu: ; RET_CHECK failure (mediapipe/calculators/tensor/inference_calculator_cpu.cc:63) !options.model_path().empty() ^ kSideInModel(cc).IsConnected()Either model as side packet or model path in options is required.
ImageToTensorCalculator: ; RET_CHECK failure (mediapipe/calculators/tensor/image_to_tensor_calculator.cc:144) ValidateOptionOutputDims(options) returned INTERNAL: ; RET_CHECK failure (./mediapipe/calculators/tensor/image_to_tensor_utils.h:136) options.has_output_tensor_float_range() || options.has_output_tensor_int_range() || options.has_output_tensor_uint_range()Output tensor range is required. 
InferenceCalculatorCpu: ; RET_CHECK failure (mediapipe/calculators/tensor/inference_calculator_cpu.cc:63) !options.model_path().empty() ^ kSideInModel(cc).IsConnected()Either model as side packet or model path in options is required.
ImageToTensorCalculator: ; RET_CHECK failure (mediapipe/calculators/tensor/image_to_tensor_calculator.cc:144) ValidateOptionOutputDims(options) returned INTERNAL: ; RET_CHECK failure (./mediapipe/calculators/tensor/image_to_tensor_utils.h:136) options.has_output_tensor_float_range() || options.has_output_tensor_int_range() || options.has_output_tensor_uint_range()Output tensor range is required. 
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
SplitTensorVectorCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
ConstantSidePacketCalculator: ; RET_CHECK failure (mediapipe/calculators/core/constant_side_packet_calculator.cc:64) (cc->OutputSidePackets().NumEntries(kPacketTag))==(options.packet_size())Number of output side packets has to be same as number of packets configured in options.
SplitTensorVectorCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
ImageToTensorCalculator: ; RET_CHECK failure (mediapipe/calculators/tensor/image_to_tensor_calculator.cc:144) ValidateOptionOutputDims(options) returned INTERNAL: ; RET_CHECK failure (./mediapipe/calculators/tensor/image_to_tensor_utils.h:136) options.has_output_tensor_float_range() || options.has_output_tensor_int_range() || options.has_output_tensor_uint_range()Output tensor range is required. 
SplitTensorVectorCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
SplitTensorVectorCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.
SplitTensorVectorCalculator: The number of output streams should match the number of ranges specified in the CalculatorOptions.