tflite-support icon indicating copy to clipboard operation
tflite-support copied to clipboard

Error getting native address of native library: task_vision_jni

Open NakanoSanku opened this issue 2 years ago • 6 comments

I tried to export tflite using a custom model trained by yolov8 and run it on my Android app, but I got an error S30805-18022056_org autojs autojspro I am confident that I will be able to use the model provided by the hub S30805-18045004_org autojs autojspro MetaData

Metadata populated:
{
  "name": "ObjectDetector",
  "description": "Identify which of a known set of objects might be present and provide information about their positions within the given image or a video stream.",
  "subgraph_metadata": [
    {
      "input_tensor_metadata": [
        {
          "name": "image",
          "description": "Input image to be detected.",
          "content": {
            "content_properties_type": "ImageProperties",
            "content_properties": {
              "color_space": "RGB"
            }
          },
          "process_units": [
            {
              "options_type": "NormalizationOptions",
              "options": {
                "mean": [
                  127.5
                ],
                "std": [
                  127.5
                ]
              }
            }
          ],
          "stats": {
            "max": [
              1.0
            ],
            "min": [
              -1.0
            ]
          }
        }
      ],
      "output_tensor_metadata": [
        {
          "name": "location",
          "description": "The locations of the detected boxes.",
          "content": {
            "content_properties_type": "BoundingBoxProperties",
            "content_properties": {
              "index": [
                1,
                0,
                3,
                2
              ],
              "type": "BOUNDARIES"
            },
            "range": {
              "min": 2,
              "max": 2
            }
          },
          "stats": {
          }
        }
      ],
      "output_tensor_groups": [
        {
          "name": "detection_result",
          "tensor_names": [
            "location",
            "category",
            "score"
          ]
        }
      ]
    }
  ],
  "min_parser_version": "1.2.0"
}

Associated file(s) populated:
file name:  temp_meta.txt
file content:
b"{'description': 'Ultralytics best model (untrained)', 'author': 'Ultralytics', 'license': 'AGPL-3.0 https://ultralytics.com/license', 'date': '2023-08-05T07:56:12.447707', 'version': '8.0.147', 'stride': 32, 'task': 'detect', 'batch': 1, 'imgsz': [320, 320], 'names': {0: 'EXP', 1: 'GoldCoin', 2: 'RedDharma'}}"
file name:  mobilenet_labels.txt
file content:
b'EXP\nGoldCoin\nRedDharma\n'
  • i verify that the application has sufficient permissions and can read the file properly
  • 'org.tensorflow:tensorflow-lite-task-vision:0.4.4'

NakanoSanku avatar Aug 05 '23 10:08 NakanoSanku

i find the problem about output_meta only one,but need four and i don`t know how to add 4 output_meta with meta_writer

NakanoSanku avatar Aug 06 '23 08:08 NakanoSanku

I'm having the same issue: Error getting native address of native library: task_vision_jni java.lang.IllegalArgumentException: Error occurred when initializing ObjectDetector: Mobile SSD models are expected to have exactly 4 outputs, found 1

don't know if it's relevant but i found differences between my model and the ones that came built

This is mine: MicrosoftTeams-image (1)

This is the built in one MicrosoftTeams-image in with the project

the input type and the min/max value is different.

Timat-Piderma avatar Aug 10 '23 09:08 Timat-Piderma

bump with this

Nikkolas-Cage avatar Oct 29 '23 05:10 Nikkolas-Cage

I'm getting this similar error but no complaints about the tensor objects, it fails on initialization itself, and the CPU works just fine, it seems to not be able to find the library (interface) task_vision_jni. Not sure if this is specific to the device (assuming this is supposed to be a native binary), as it doesn't work on the emulator either. I get the error Error occurred when initializing ObjectDetector: ModifyGraphWithDelegate() failed for delegate 'GPU'.

Screenshot 2024-01-02 at 9 45 25 AM

bhimeshchauhan avatar Jan 02 '24 14:01 bhimeshchauhan

@bhimeshchauhan have you resolved? How?

ambr89 avatar Jul 24 '24 09:07 ambr89

Any updates with this??

Nikkolas-Cage avatar Aug 03 '24 17:08 Nikkolas-Cage