google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.28k stars 5.13k forks source link

RuntimeError: ValidatedGraphConfig Initialization failed. #5359

Closed SlowMonk closed 4 months ago

SlowMonk commented 5 months ago

Have I written custom code (as opposed to using a stock example script provided in MediaPipe)

None

OS Platform and Distribution

ubuntu 20.04

MediaPipe Tasks SDK version

'0.10.11'

Task name (e.g. Image classification, Gesture recognition etc.)

face landmark

Programming Language and version (e.g. C++, Python, Java)

python

Describe the actual behavior

ImageToTensorCalculator: ; RET_CHECK failure (mediapipe/calculators/tensor/image_to_tensor_calculator.cc:145) kIn(cc).IsConnected() ^ kInGpu(cc).IsConnected()One and only one of IMAGE and IMAGE_GPU input is expected.

Describe the expected behaviour

no pipeline error

Standalone code/steps you may have used to try to get what you need

#GPU image. (GpuBuffer)
input_stream: "IMAGE:image"
# ROI (region of interest) within the given image where a face is located.
# (NormalizedRect)
input_stream: "ROI:roi"
# Whether to run face mesh model with attention on lips and eyes. (bool)
# Attention provides more accuracy on lips and eye regions as well as iris
# landmarks.
input_side_packet: "WITH_ATTENTION:with_attention"

# 468 or 478 facial landmarks within the given ROI. (NormalizedLandmarkList)
#
# Number of landmarks depends on the WITH_ATTENTION flag. If it's `true` - then
# there will be 478 landmarks with refined lips, eyes and irises (10 extra
# landmarks are for irises), otherwise 468 non-refined landmarks are returned.
#
# NOTE: if a face is not present within the given ROI, for this particular
# timestamp there will not be an output packet in the LANDMARKS stream. However,
# the MediaPipe framework will internally inform the downstream calculators of
# the absence of this packet so that they don't wait for it unnecessarily.
output_stream: "LANDMARKS:face_landmarks"

# MediaPipe graph configuration
node {
  calculator: "GpuBufferToImageFrameCalculator"
  input_stream: "IMAGE:image"
  output_stream: "image_frame"
}

node {
  calculator: "ColorConvertCalculator"
  input_stream: "image_frame"
  output_stream: "image_rgb"
}

node {
  calculator: "ImageFrameToGpuBufferCalculator"
  input_stream: "image_rgb"
  output_stream: "image_gpu"
}

# Transforms the input image into a 192x192 tensor.
node: {
  calculator: "ImageToTensorCalculator"
  input_stream: "image_gpu"
  input_stream: "NORM_RECT:roi"
  output_stream: "TENSORS:input_tensors"
  options: {
    [mediapipe.ImageToTensorCalculatorOptions.ext] {
      output_tensor_width: 192
      output_tensor_height: 192
      output_tensor_float_range {
        min: 0.0
        max: 1.0
      }
      gpu_origin: TOP_LEFT
    }
  }
}

    face_mash = mp_face_mesh.FaceMesh()
  File "/usr/local/lib/python3.10/dist-packages/mediapipe/python/solutions/face_mesh.py", line 95, in __init__
    super().__init__(
  File "/usr/local/lib/python3.10/dist-packages/mediapipe/python/solution_base.py", line 235, in __init__
    validated_graph.initialize(
RuntimeError: ValidatedGraphConfig Initialization failed.
ColorConvertCalculator::GetContract failed to validate:
For input streams ValidatePacketTypeSet failed:
Tag "" index 0 was not expected.
For output streams ValidatePacketTypeSet failed:
Tag "" index 0 was not expected.
ImageToTensorCalculator: ; RET_CHECK failure (mediapipe/calculators/tensor/image_to_tensor_calculator.cc:145) kIn(cc).IsConnected() ^ kInGpu(cc).IsConnected()One and only one of IMAGE and IMAGE_GPU input is expected.

Other info / Complete Logs

No response

kuaashish commented 5 months ago

Hi @SlowMonk,

It seems that the issue may be related to changes in versions 0.10.10 and later, Already known to us. To troubleshoot, could you try downgrading to version 0.10.9 and see if that resolves the issue? Please let us know if everything functions as expected after the downgrade.

Thank you!!

github-actions[bot] commented 5 months ago

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

Howl1n commented 5 months ago

I have a similar issue, downgrading did not resolve the issue. Same error

kuaashish commented 5 months ago

Hi @SlowMonk,

Please try the latest version, 0.10.14, based on the suggestions given here: comment, It must work. If you encounter any problems, just let us know by filing a new issue using the template provided.

Thank you!!

github-actions[bot] commented 5 months ago

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

github-actions[bot] commented 4 months ago

This issue was closed due to lack of activity after being marked stale for past 7 days.

google-ml-butler[bot] commented 4 months ago

Are you satisfied with the resolution of your issue? Yes No