tensorflow / tensorflow/tflite-support

Model Loading Error for Image Embedder in Android

Open
#972 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
441
Forks
146
PR merge metrics
No merged PRs in 30d

Description

I was trying to add the Image Embedder in the Task Vision Java API for Android. But I have come across an error which is preventing me from loading any model.

Error:

java.lang.IllegalStateException: Error getting native address of native library: task_vision_jni
at org.tensorflow.lite.task.core.TaskJniUtils.createHandleFromLibrary(TaskJniUtils.java:95)
at org.tensorflow.lite.task.vision.embedder.ImageEmbedder.createFromBufferAndOptions(ImageEmbedder.java:203)
at org.tensorflow.lite.task.vision.embedder.ImageEmbedder.createFromBuffer(ImageEmbedder.java:116)
at intangles.videotelematics.invision_tflite_objectdetection.MainActivity.onCreate(MainActivity.java:210)
at android.app.Activity.performCreate(Activity.java:7894)
at android.app.Activity.performCreate(Activity.java:7881)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3283)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3457)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7560)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
Caused by: java.lang.IllegalArgumentException: Error occurred when initializing ImageEmbedder: ExternalFile must specify at least one of 'file_content', 'file_name' or 'file_descriptor_meta'.
at org.tensorflow.lite.task.vision.embedder.ImageEmbedder.initJniWithByteBuffer(Native Method)
at org.tensorflow.lite.task.vision.embedder.ImageEmbedder.access$100(ImageEmbedder.java:72)
at org.tensorflow.lite.task.vision.embedder.ImageEmbedder$3.createHandle(ImageEmbedder.java:207)
at org.tensorflow.lite.task.core.TaskJniUtils.createHandleFromLibrary(TaskJniUtils.java:91)

Checkout my PR: https://github.com/tensorflow/tflite-support/compare/master...samyabose:tflite-support:r0.4.5?expand=1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ImageEmbedder.createFromBuffer call and the TaskJniUtils.createHandleFromLibrary stack-trace entries, then compare the linked PR. Reproduce the Android model-loading failure and trace why the native initialization receives an ExternalFile without file content, a name, or descriptor metadata. Done means the Image Embedder loads the model without this exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
machine-learning, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.