mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

object detection on android with gpu will crash when set setCategoryAllowlist

Open hugski opened this issue 1 year ago • 4 comments

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

None

OS Platform and Distribution

android 13

Mobile device if the issue happens on mobile device

xiaomi pad 6 pro

Browser and version if the issue happens on browser

No response

Programming Language and version

kotlin java

MediaPipe version

com.google.mediapipe:tasks-vision:latest.release

Bazel version

No response

Solution

Object detection

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

No response

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

No response

Describe the actual behavior

eg. setCategoryAllowlist("person") will crash and error message is "Check failed: class_index_set_.values.size() == IsClassIndexAllowed(0) ? num_classes_ : num_classes_ - 1 (1 vs. 90) Only all classes >= class 0 or >= class 1"

Describe the expected behaviour

setCategoryAllowlist("person") and the result only contain person categories

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

val baseOptions = BaseOptions.builder()
                .setDelegate(Delegate.GPU)
                .setModelAssetPath("detect/efficientdet-lite0.tflite")
                .build()

            val options = ObjectDetector.ObjectDetectorOptions.builder()
                .setBaseOptions(baseOptions)
                .setCategoryAllowlist(mutableListOf("person"))

Other info / Complete Logs

No response

hugski avatar Sep 06 '24 14:09 hugski