tensorflow / tflite-support

TFLite Support is a toolkit that helps users to develop ML and deploy TFLite models onto mobile / ioT devices.
Apache License 2.0
378 stars 128 forks source link

Error getting native address of native library: task_vision_jni #936

Open NakanoSanku opened 1 year ago

NakanoSanku commented 1 year ago

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'
NakanoSanku commented 1 year ago

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

Timat-Piderma commented 1 year ago

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.

Nikkolas-Cage commented 1 year ago

bump with this

bhimeshchauhan commented 10 months ago

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

ambr89 commented 3 months ago

@bhimeshchauhan have you resolved? How?

Nikkolas-Cage commented 3 months ago

Any updates with this??