Skip to content

Android GPU Delegate w/ Selfie Multiclass gives "Error Batch size mismatch, expected 1 but got 8" #5987

Open
@peymannaderi10

Description

@peymannaderi10

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

No

OS Platform and Distribution

Android 14

Mobile device if the issue happens on mobile device

Galaxy S21+ 5G, Model: SM-G996U/DS

Browser and version if the issue happens on browser

No response

Programming Language and version

Java/Kotlin

MediaPipe version

0.10.14

Bazel version

No response

Solution

Image Segmentation, Selfie Multiclass Model

Android Studio, NDK, SDK versions (if issue is related to building in Android environment)

Android Studio Meerkat | 2024.3.1 Patch 2, Runtime version: 21.0.6+-13355223-b631.42 amd64

Xcode & Tulsi version (if issue is related to building for iOS)

No response

Describe the actual behavior

Then upon opening the app, I would swipe up to select the ML model and delegate, selected Selfie Multiclass ML model, and then I would select GPU for delegate and on the screen I see "Image segmenter failed to initialize. See logs for error details", when going to logcat below is what would print: 2025-05-29 11:59:54.668 24517-24625 native com...pe.examples.imagesegmentation E E0000 00:00:1748534394.668891 24625 calculator_graph.cc:887] INVALID_ARGUMENT: CalculatorGraph::Run() failed: Calculator::Open() for node "mediapipe_tasks_vision_image_segmenter_imagesegmentergraph__mediapipe_tasks_core_inferencesubgraph__inferencecalculator__mediapipe_tasks_vision_image_segmenter_imagesegmentergraph__mediapipe_tasks_core_inferencesubgraph__InferenceCalculator" failed: Batch size mismatch, expected 1 but got 8

Describe the expected behaviour

For the Selfie Multiclass model to work on android with GPU delegation

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

I downloaded the image segmentation category mask example and followed the README to install the demo app, filtered logcat to view the error.

Other info / Complete Logs

2025-05-29 11:59:54.668 24517-24625 native com...pe.examples.imagesegmentation E E0000 00:00:1748534394.668891 24625 calculator_graph.cc:887] INVALID_ARGUMENT: CalculatorGraph::Run() failed:
Calculator::Open() for node "mediapipe_tasks_vision_image_segmenter_imagesegmentergraph__mediapipe_tasks_core_inferencesubgraph__inferencecalculator__mediapipe_tasks_vision_image_segmenter_imagesegmentergraph__mediapipe_tasks_core_inferencesubgraph__InferenceCalculator" failed: Batch size mismatch, expected 1 but got 8

2025-05-29 11:59:54.669 24517-24625 ImageSegmenterHelper com...pe.examples.imagesegmentation E Image segmenter failed to load model with error: invalid argument: CalculatorGraph::Run() failed:
Calculator::Open() for node "mediapipe_tasks_vision_image_segmenter_imagesegmentergraph__mediapipe_tasks_core_inferencesubgraph__inferencecalculator__mediapipe_tasks_vision_image_segmenter_imagesegmentergraph__mediapipe_tasks_core_inferencesubgraph__InferenceCalculator" failed: Batch size mismatch, expected 1 but got 8

Metadata

Metadata

Assignees

Labels

platform::androidAndroid Solutionsstat:awaiting googlerWaiting for Google Engineer's Responsetask:image segmentationIssues related to image segmentation: Locate objects and create image masks with labelstype:bugBug in the Source Code of MediaPipe Solution

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions