0

I'm attempting to modify the TensorFlow Lite Audio Classification Android Demo to simultaneously run YAMNet.tflite and speech.tflite models. My goal is to make the app react when YAMNet detects speech and the speech model detects up, down, left, or right commands. However, since the input tensor for YAMNet is (1,16000) and for speech is (1,44032), the input tensors for these two models are different, and only the classifier declared first will make predictions.

I would like to ask if there's any way to modify this sample code to run both models with different input tensors simultaneously? Or are there any better approaches to achieve the functionality I desire?

4
  • Of course you can run 2 classification models. Create 2 instances of the TFLite Interpreter, 2 inputs and run 2 classifications in 2 background threads. Commented Apr 16, 2024 at 6:33
  • Thank you for your response. I've created instances of two models, AudioClassifier, TensorAudio and AudioRecord. However, the second AudioRecord instance, cannot receives sound input. Commented Apr 17, 2024 at 4:39
  • I guess this is a matter of debugging. You have to be sure though that apps can work with multiple instances of TFLite Interpreter. Commented Apr 18, 2024 at 3:18
  • I've solved this issue. Since the app can only have one recorder, I downsampled the audio data from helprRecorder (44032) to 15600, and then fed it into the YAMNet model, which succeeded. However, the downsampling affected the accuracy. Thanks for the discussion. Commented Apr 19, 2024 at 9:23

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.