This article shows how to add meta_data into a tflite model before running in Android. However, it only shows example for Image classification. I am trying to add meta data for Audio classification. How can I get guide.
I am getting error in Android when running a model.tflite which has no meta data.
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)
at org.tensorflow.lite.task.core.TaskJniUtils.createHandleFromFdAndOptions(TaskJniUtils.java:66)
at org.tensorflow.lite.task.audio.classifier.AudioClassifier.createFromFileAndOptions(AudioClassifier.java:134)
at org.tensorflow.lite.task.audio.classifier.AudioClassifier.createFromFile(AudioClassifier.java:91)
at com.samsung.classification.MainActivity.startAudioClassification(MainActivity.java:86)
at com.samsung.classification.MainActivity.lambda$showActivitySelectionDialogue$0$com-samsung-classification-MainActivity(MainActivity.java:51)
at com.samsung.classification.MainActivity$$ExternalSyntheticLambda0.onClick(Unknown Source:2)
at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:1485)
at android.widget.AdapterView.performItemClick(AdapterView.java:376)
at android.widget.AbsListView.performItemClick(AbsListView.java:1295)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3571)
at android.widget.AbsListView$3.run(AbsListView.java:4751)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)