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.32k stars 5.13k forks source link

Error message: ERROR: 0:1: '' : version '330' is not supported #5674

Open zumpchke opened 1 week ago

zumpchke commented 1 week ago

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

None

OS Platform and Distribution

macOS Sequoia 10.15.1

MediaPipe Tasks SDK version

0.10.15

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

Pose landmarker

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

Python

Describe the actual behavior

Shader error

Describe the expected behaviour

Success

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

import mediapipe as mp
import cv2

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='pose_landmarker.task',
            delegate=BaseOptions.Delegate.GPU
            ),
        running_mode=VisionRunningMode.IMAGE,
        min_pose_detection_confidence=0.01,
        output_segmentation_masks=True,
        )

mp_pose = mp.solutions.pose
mp_drawing = mp.solutions.drawing_utils

with PoseLandmarker.create_from_options(options) as landmarker:
    image = cv2.imread('img.bmp')
    frame = mp.Image(image_format=mp.ImageFormat.SRGBA, data=cv2.cvtColor(image, cv2.COLOR_BGR2RGBA))
    results = landmarker.detect(frame)
    print(results)
    cv2.imshow("", image)
    cv2.destroyAllWindows()

Other info / Complete Logs

WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1728689838.763588 5507114 gl_context.cc:357] GL version: 2.1 (2.1 Metal - 89.3), renderer: Apple M2 Max
INFO: Created TensorFlow Lite delegate for Metal.
W0000 00:00:1728689841.295845 5507152 landmark_projection_calculator.cc:186] Using NORM_RECT without IMAGE_DIMENSIONS is only supported for the square ROI. Provide IMAGE_DIMENSIONS or use PROJECTION_MATRIX.
E0000 00:00:1728689841.349315 5507158 shader_util.cc:99] Failed to compile shader:
 1 #version 330 
 2 #ifdef GL_ES 
 3 #define DEFAULT_PRECISION(p, t) precision p t; 
 4 #else 
 5 #define DEFAULT_PRECISION(p, t) 
 6 #define lowp 
 7 #define mediump 
 8 #define highp 
 9 #endif  // defined(GL_ES) 
10 #if __VERSION__ < 130
11 #define in attribute
12 #define out varying
13 #endif  // __VERSION__ < 130
14 in vec4 position; in mediump vec4 texture_coordinate; out mediump vec2 sample_coordinate; void main() { gl_Position = position; sample_coordinate = texture_coordinate.xy; }
E0000 00:00:1728689841.349355 5507158 shader_util.cc:106] Error message: ERROR: 0:1: '' :  version '330' is not supported

E0000 00:00:1728689841.349448 5507114 calculator_graph.cc:896] INTERNAL: CalculatorGraph::Run() failed: 
Calculator::Process() for node "mediapipe_tasks_vision_pose_landmarker_poselandmarkergraph__mediapipe_tasks_vision_pose_landmarker_multipleposelandmarksdetectorgraph__mediapipe_tasks_vision_pose_landmarker_singleposelandmarksdetectorgraph__TensorsToSegmentationCalculator" failed: ; RET_CHECK failure (mediapipe/calculators/tensor/tensors_to_segmentation_converter_metal.cc:216) upsample_program_Problem initializing the program.
Traceback (most recent call last):
  File "/Users/zumpchke/mp_pose.py", line 33, in <module>
    results = landmarker.detect(frame)
  File "/Users/zumpchke/Library/Python/3.9/lib/python/site-packages/mediapipe/tasks/python/vision/pose_landmarker.py", line 352, in detect
    output_packets = self._process_image_data({
  File "/Users/zumpchke/Library/Python/3.9/lib/python/site-packages/mediapipe/tasks/python/vision/core/base_vision_task_api.py", line 95, in _process_image_data
    return self._runner.process(inputs)
RuntimeError: CalculatorGraph::Run() failed: 
Calculator::Process() for node "mediapipe_tasks_vision_pose_landmarker_poselandmarkergraph__mediapipe_tasks_vision_pose_landmarker_multipleposelandmarksdetectorgraph__mediapipe_tasks_vision_pose_landmarker_singleposelandmarksdetectorgraph__TensorsToSegmentationCalculator" failed: ; RET_CHECK failure (mediapipe/calculators/tensor/tensors_to_segmentation_converter_metal.cc:216) upsample_program_Problem initializing the program.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/zumpchke/mp_pose.py", line 38, in <module>
    cv2.destroyAllWindows()
  File "/Users/zumpchke/Library/Python/3.9/lib/python/site-packages/zumpchke/tasks/python/vision/core/base_vision_task_api.py", line 226, in __exit__
    self.close()
  File "/Users/zumpchke/Library/Python/3.9/lib/python/site-packages/mediapipe/tasks/python/vision/core/base_vision_task_api.py", line 209, in close
    self._runner.close()
RuntimeError: CalculatorGraph::Run() failed: 
Calculator::Process() for node "mediapipe_tasks_vision_pose_landmarker_poselandmarkergraph__mediapipe_tasks_vision_pose_landmarker_multipleposelandmarksdetectorgraph__mediapipe_tasks_vision_pose_landmarker_singleposelandmarksdetectorgraph__TensorsToSegmentationCalculator" failed: ; RET_CHECK failure (mediapipe/calculators/tensor/tensors_to_segmentation_converter_metal.cc:216) upsample_program_Problem initializing the program.
zumpchke commented 1 week ago

This only happens with BaseDelegate GPU.

schmidt-sebastian commented 1 day ago

We will look at this internally.