BirdNET-Analyzer icon indicating copy to clipboard operation
BirdNET-Analyzer copied to clipboard

Android app error - input tensor 0 is missing TensorMetadata

Open joewoodhouse opened this issue 2 years ago • 1 comments

I'm trying to get a basic Android app working using the BirdNet model

As per @kahst instructions I've tried to drop the model tflite into the following official TensorFlow Lite example project: https://github.com/tensorflow/examples/tree/master/lite/examples/audio_classification

However on running the app I get an immediate error and crash with the following logs:

org.tensorflow.lite.examples.audio   E  Error getting native address of native library: task_audio_jni
java.lang.IllegalArgumentException: Error occurred when initializing AudioClassifier: input tensor 0 is missing TensorMetadata.
  at org.tensorflow.lite.task.audio.classifier.AudioClassifier.initJniWithModelFdAndOptions(Native Method)
  at org.tensorflow.lite.task.audio.classifier.AudioClassifier.access$000(AudioClassifier.java:74)
  at org.tensorflow.lite.task.audio.classifier.AudioClassifier$1.createHandle(AudioClassifier.java:143)
  at org.tensorflow.lite.task.audio.classifier.AudioClassifier$1.createHandle(AudioClassifier.java:136)
  at org.tensorflow.lite.task.core.TaskJniUtils$1.createHandle(TaskJniUtils.java:70)
  at org.tensorflow.lite.task.core.TaskJniUtils.createHandleFromLibrary(TaskJniUtils.java:91)

(to confirm, when I use the in-build yamnet/speech models that come with that example, it works fine).

I have seen similar errors when trying to run the model using my own code (though I am not a full-time Android developer so I could be doing something stupid).

Any help/guidance would be appreciated

joewoodhouse avatar Oct 23 '23 13:10 joewoodhouse

you can have a look at my project. https://github.com/woheller69/BirdNet-lite-Android I got the TFlite model v2.4 from BirdNET-PI running on Android.

I started wigh an older sound_classification (not audio_classification) example for Tensorflow lite, which was already removed. But GitHub does not forget :-)

woheller69 avatar Jan 27 '24 06:01 woheller69