Input tensor 0 is missing TensorMetadata error

Hi, I am trying to make my raspberry pi do NLU. I already made a model for pc but sadly a raspberry pi cant run tf so I have to do it with tflite. I found an example on the TF websitei have now:

from tflite_support.task import audio
from tflite_support.task import core
from tflite_support.task import processor




base_options = core.BaseOptions(
    file_name="model.tflite", num_threads=4)
classification_options = processor.ClassificationOptions(
    max_results=5, score_threshold=1)
options = audio.AudioClassifierOptions(
    base_options=base_options , classification_options = classification_options)
classifier = audio.AudioClassifier.create_from_options(options)

audiorecord = classifier.create_audio_record()
tensor_audio = classifier.create_input_tensor_audio()


def classifire(text):
    tensor_audio.load_from_audio_record(text)
    result = classifier(tensor_audio)

    tensor_audio.load_from_audio_record(audiorecord)
    result = classifier.classify(tensor_audio)

    return result


text = input("text:")

print(classifire(text))

when I run this I get a valueError: input tensor 0 is missing TensorMetadata
in the line with classifier = _CppAudioClassifier.create_form_options

What is wrong and how can I fix it?

1 Like

Hi @anonymous023
Does this file contain metadata?
Check this for more details.

Hello @George_Soloupis,
Thanks for your reaction.

No, the file did not contain metadata. I am working on it right now.
Are there special things I need to keep in mind for a sentence classification system instead of an image classification system?

@George_Soloupis How can I add meta data in Audio classification case? The link you provided shows example for image only. My audio classification model also getting the same error and I guess its for missing meta data.

Thanks in advance