Caldarie / flutter_tflite_audio

Audio classification Tflite package for flutter (iOS & Android). Can support Google Teachable Machine models
MIT License
64 stars 26 forks source link

help :Error using your own model #11

Closed jijkbird closed 2 years ago

jijkbird commented 3 years ago

D/Tflite_audio( 2629): Check for permissions D/Tflite_audio( 2629): Permission already granted. start recording V/Tflite_audio( 2629): Recording started V/Tflite_audio( 2629): recordingOffset: 1000/16000 V/Tflite_audio( 2629): recordingOffset: 2000/16000 V/Tflite_audio( 2629): recordingOffset: 3000/16000 V/Tflite_audio( 2629): recordingOffset: 4000/16000 V/Tflite_audio( 2629): recordingOffset: 5000/16000 V/Tflite_audio( 2629): recordingOffset: 6000/16000 V/Tflite_audio( 2629): recordingOffset: 7000/16000 V/Tflite_audio( 2629): recordingOffset: 8000/16000 V/Tflite_audio( 2629): recordingOffset: 9000/16000 V/Tflite_audio( 2629): recordingOffset: 10000/16000 V/Tflite_audio( 2629): recordingOffset: 11000/16000 V/Tflite_audio( 2629): recordingOffset: 12000/16000 V/Tflite_audio( 2629): recordingOffset: 13000/16000 V/Tflite_audio( 2629): recordingOffset: 14000/16000 V/Tflite_audio( 2629): recordingOffset: 15000/16000 V/Tflite_audio( 2629): recordingOffset: 16000/16000 V/Tflite_audio( 2629): inputType: decodedWav V/Tflite_audio( 2629): Recognition started. D/Tflite_audio( 2629): Recording stopped. E/AndroidRuntime( 2629): FATAL EXCEPTION: Thread-3 E/AndroidRuntime( 2629): Process: tfliteaudio.tflite_audio_example, PID: 2629 E/AndroidRuntime( 2629): java.lang.IllegalArgumentException: Invalid input Tensor index: 1 E/AndroidRuntime( 2629): at org.tensorflow.lite.NativeInterpreterWrapper.getInputTensor(NativeInterpreterWrapper.java:358) E/AndroidRuntime( 2629): at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:186) E/AndroidRuntime( 2629): at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:374) E/AndroidRuntime( 2629): at flutter.tflite_audio.TfliteAudioPlugin.decodedWaveRecognize(TfliteAudioPlugin.java:592) E/AndroidRuntime( 2629): at flutter.tflite_audio.TfliteAudioPlugin.access$200(TfliteAudioPlugin.java:54) E/AndroidRuntime( 2629): at flutter.tflite_audio.TfliteAudioPlugin$4.run(TfliteAudioPlugin.java:449) E/AndroidRuntime( 2629): at java.lang.Thread.run(Thread.java:923) D/ViewRootImplMainActivity: windowFocusChanged hasFocus=false inTouchMode=true I/Process ( 2629): Sending signal. PID: 2629 SIG: 9 Lost connection to device.

this is my model https://github.com/jijkbird/filetest/releases/download/1/model.zip

Caldarie commented 3 years ago

Hi @jijkbird

Analysing your model on netron, it seems that your model has an input type of float32[1,3920]. In that case you want to change your input type from 'decodedWav' to 'rawAudio'. Also, make sure that your recording length is 3920. Here is an example of what your values should look like:

  final String inputType = 'rawAudio';
  final int sampleRate = 16000;
  final int recordingLength = 3920;
  final int bufferSize = 1600;
jijkbird commented 3 years ago

@Caldarie

Thank you.

I've been waiting for your reply all night

thank you

jijkbird commented 3 years ago

@Caldarie

I'm making an app to recognize the sound of piano keys,

I have a dataset of piano keystrokes,

Can you make a model for me?

I'm willing to pay.

Caldarie commented 3 years ago

Hi @jijkbird,

@Caldarie

Thank you.

I've been waiting for your reply all night

thank you

Many apologies for the late reply. I am currently living in Japan, so it's a bit difficult for me to reply within different time zones.

As for building your model, you can email the details to michaeltamthiennguyen@gmail.com. We can discuss more in depth from there.

Michael