{"id":2117,"library":"mediapipe","title":"MediaPipe","description":"MediaPipe is an open-source framework from Google that provides cross-platform, customizable ML solutions for live and streaming media. It enables researchers and developers to build world-class machine learning applications for mobile, edge, cloud, and the web. The current version is 0.10.33, with frequent releases addressing bug fixes, performance improvements, and API enhancements.","status":"active","version":"0.10.33","language":"en","source_language":"en","source_url":"https://github.com/google/mediapipe","tags":["machine-learning","computer-vision","ml","cv","google","ai","pose-estimation","hand-tracking","face-detection"],"install":[{"cmd":"pip install mediapipe","lang":"bash","label":"Install latest stable version"}],"dependencies":[],"imports":[{"symbol":"mediapipe","correct":"import mediapipe as mp"},{"symbol":"tasks.python.vision","correct":"from mediapipe.tasks import python\nfrom mediapipe.tasks.python import vision"},{"note":"The `mediapipe.solutions` module was removed in MediaPipe versions 0.10.30 and later. Users should migrate to the `mediapipe.tasks` API for pre-built ML models.","wrong":"import mediapipe.solutions","symbol":"solutions","correct":"from mediapipe.solutions import ..."}],"quickstart":{"code":"import mediapipe as mp\nfrom mediapipe.tasks import python\nfrom mediapipe.tasks.python import vision\nimport numpy as np\nimport os\n\n# Placeholder for a real model file. Download a .task file (e.g., efficientdet_lite0.tflite)\n# from MediaPipe's model zoo (https://developers.google.com/mediapipe/solutions/object_detector) \n# or use your own. For local testing, ensure the file exists.\n# Example: model_path = '~/mediapipe_models/efficientdet_lite0.tflite'\nmodel_path = os.environ.get('MEDIAPIPE_MODEL_PATH', 'object_detector.tflite') # Replace with actual model path or env var\n\ntry:\n    # Create a BaseOptions object with the model asset path.\n    # For GPU acceleration on supported platforms, add delegate=python.BaseOptions.Delegate.GPU\n    base_options = python.BaseOptions(model_asset_path=model_path)\n    \n    # Create an ObjectDetectorOptions object.\n    options = vision.ObjectDetectorOptions(base_options=base_options,\n                                         score_threshold=0.25,\n                                         max_results=5)\n    \n    # Create an ObjectDetector.\n    detector = vision.ObjectDetector.create_from_options(options)\n\n    # Create a dummy image (e.g., a blank white image) for demonstration.\n    # In a real application, you'd load an image from a file or camera.\n    dummy_image_np = np.zeros((224, 224, 3), dtype=np.uint8) + 255 # White 224x224 image\n    mp_image = mp.Image(image_format=mp.ImageFormat.SRGB, data=dummy_image_np)\n\n    # Perform object detection on the image.\n    detection_result = detector.detect(mp_image)\n\n    # Print the detection results.\n    print(\"Detection results:\")\n    if detection_result.detections:\n        for detection in detection_result.detections:\n            for category in detection.categories:\n                print(f\"  Category: {category.category_name}, Score: {category.score:.2f}\")\n            bbox = detection.bounding_box\n            print(f\"  Bounding Box: (x:{bbox.origin_x}, y:{bbox.origin_y}, w:{bbox.width}, h:{bbox.height})\")\n    else:\n        print(\"  No objects detected.\")\n\nexcept FileNotFoundError:\n    print(f\"Error: Model file not found at '{model_path}'. Please ensure the model exists or update MEDIAPIPE_MODEL_PATH environment variable.\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to set up an object detector using the modern `mediapipe.tasks` API. It initializes an `ObjectDetector` with a placeholder model path and performs detection on a dummy image, printing any detected objects and their bounding boxes. Remember to replace the `model_path` with an actual downloaded MediaPipe `.task` model file, such as `efficientdet_lite0.tflite`."},"warnings":[{"fix":"Migrate your code to use the `mediapipe.tasks` API, which provides a more unified and extensible way to access MediaPipe's pre-built ML models and custom graphs.","message":"The `mediapipe.solutions` module has been removed in versions 0.10.30 and later. Code relying on this module will break.","severity":"breaking","affected_versions":">=0.10.30"},{"fix":"For optimal GPU performance on Windows, you might need to build MediaPipe from source with specific GPU configurations (e.g., CUDA-enabled OpenCV, TensorFlow GPU). Alternatively, consider using Linux environments or WSL for better GPU integration with MediaPipe.","message":"Official PyPI packages for MediaPipe on Windows currently lack full GPU acceleration support, and OpenGL is automatically disabled for Windows builds. While you can specify `delegate=python.BaseOptions.Delegate.GPU`, it might not leverage the GPU and could fall back to CPU, or the feature might be unavailable.","severity":"gotcha","affected_versions":"All versions on Windows via PyPI"},{"fix":"If you encounter installation issues, try downgrading your Python interpreter to a version officially supported by the latest MediaPipe release (e.g., Python 3.10-3.12). Check the PyPI page for available wheels.","message":"MediaPipe often provides precompiled Python wheels for specific Python versions. Installing with very new Python versions (e.g., Python 3.13) might result in 'No matching distribution found' errors due to lack of compatible wheels.","severity":"gotcha","affected_versions":"Potentially newer Python versions (e.g., Python 3.13+)"},{"fix":"For basic usage with `mediapipe.tasks`, this is generally handled internally. For custom solutions or graphs, consult the official MediaPipe documentation for API3 migration guides and examples.","message":"Significant internal refactoring and migration to 'API3' has been an ongoing effort across several recent versions. While primarily affecting C++ users building custom calculators, advanced Python users interacting with lower-level framework components or custom graphs might need to adjust their code.","severity":"breaking","affected_versions":">=0.10.25 (gradual changes)"},{"fix":"This issue can often be resolved by ensuring that Visual C++ Redistributable packages are installed on your system. Sometimes, explicitly installing `msvc-runtime` (`pip install msvc-runtime`) can also help, although this is more of a workaround for specific environments.","message":"Windows users, especially with newer MediaPipe versions, sometimes encounter `Import Error: DLL load failed while importing _framework_bindings`.","severity":"gotcha","affected_versions":"Some recent versions on Windows"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}