Skip to content

App Crashes on Android Build with ObjectDetector using categoryAllowList #1393

Description

@ilhamachmada

Plugin Version or Commit ID

v0.16.1

Unity Version

6000.0.49f1

Your Host OS

Windows 11

Target Platform

Android

[Windows Only] Visual Studio C++ and Windows SDK Version

No response

[Linux Only] GCC/G++ and GLIBC Version

No response

[Android Only] Android Build Tools and NDK Version

No response

[iOS Only] XCode Version

No response

Command Sequences

Description

When trying to build and run object detection on Android using categoryAllowList, the app crashes with a fatal native error inside tensors_to_detections_calculator.cc. This happens only when categoryAllowList is specified — the app works fine without it.

Steps to Reproduce

  1. Set up MediaPipe Unity Plugin (com.github.homuler.MediaPipeUnity)
  2. Configure ObjectDetectorOptions with categoryAllowList = ["sports ball"]
  3. Build and run on Android device
  4. App crashes immediately when detection starts

Example Code

public Tasks.Vision.ObjectDetector.ObjectDetectorOptions GetObjectDetectorOptions(
    Tasks.Vision.ObjectDetector.ObjectDetectorOptions.ResultCallback resultCallback = null)
{
    return new Tasks.Vision.ObjectDetector.ObjectDetectorOptions(
        baseOptions: new Tasks.Core.BaseOptions(
            delegate_: Delegate,
            modelAssetPath: ModelPath
        ),
        runningMode: RunningMode,
        maxResults: MaxResults,
        scoreThreshold: ScoreThreshold,
        categoryAllowList: new List<string> { "person", "cat" },
        resultCallback: resultCallback
    );
}

Log

2025/07/28 10:33:58.949 10971 11170 Fatal native F0000 00:00:1753673638.949334   11170 tensors_to_detections_calculator.cc:1183] 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
2025/07/28 10:33:58.949 10971 11170 Fatal native terminating.
2025/07/28 10:33:58.949 10971 11170 Fatal native F0000 00:00:1753673638.949334   11170 tensors_to_detections_calculator.cc:1183] 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
2025/07/28 10:33:58.949 10971 11170 Fatal native terminating.

Additional Context

I have tested with both MediaPipeUnityPlugin-all and MediaPipeUnityPlugin-all-stripped — both exhibit the same crashing behavior.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions