Running deepspeech sample java android app

I am new to NLP and deepspeech. My PoC project involves, recognising a small set of words (e.g. YES, NO, DONE and numericals). And have it run on android devices. In our step by step journey, I first set-up deepspeech on my laptop and used it to infer recorded audio. That worked out fine. Then, I built the native clients following the instructions given in: native_client for android (arm-64). Following that, I build the sample java app provided deepspeeh github repo. And added all the required files as suggested on: native client - java

As of now, I was using the pre-trained model provided by deepspeech, had it converted to tflite and using the same.

Test device: Google pixel 1

However, while running the app inference, I get following error:

    07-08 09:19:32.032 31883-31883/org.mozilla.deepspeech E/libdeepspeech: TensorFlow: v1.13.1-0-g6612da8951
07-08 09:19:32.032 31883-31883/org.mozilla.deepspeech D/libdeepspeech: TensorFlow: v1.13.1-0-g6612da8951
07-08 09:19:32.032 31883-31883/org.mozilla.deepspeech E/libdeepspeech: DeepSpeech: v0.5.1-0-g4b29b78
07-08 09:19:32.032 31883-31883/org.mozilla.deepspeech D/libdeepspeech: DeepSpeech: v0.5.1-0-g4b29b78
07-08 09:19:32.035 31883-31883/org.mozilla.deepspeech E/tflite: tensorflow/lite/kernels/mfcc.cc:75 NumDimensions(inputRate) != 1 (0 != 1)
    Node number 2 (Mfcc) failed to prepare.
07-08 09:20:04.085 31883-31883/org.mozilla.deepspeech A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x96 in tid 31883 (illa.deepspeech), pid 31883 (illa.deepspeech)
07-08 09:20:04.103 31883-31883/org.mozilla.deepspeech A/libc: crash_dump helper failed to exec

Why ? We have prebuilt binaries, why do you need to rebuild ?

Looks like we need more context here on extactly what you did … Which model file did you used, etc.

@lissyx I first tried pre-built binaries provided for v0.5.1. However, while running the android demo app provided under native_client/java, I get following error:

07-08 11:16:53.906 20762-20781/? I/Adreno: PFP: 0x005ff110, ME: 0x005ff066
07-08 11:16:53.910 20762-20781/? I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
    android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
07-08 11:16:53.911 20762-20781/? I/OpenGLRenderer: Initialized EGL, version 1.4
07-08 11:16:53.911 20762-20781/? D/OpenGLRenderer: Swap behavior 1
07-08 11:16:57.703 20762-20762/? W/illa.deepspeec: Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
07-08 11:17:21.909 20762-20762/? E/libdeepspeech: TensorFlow: v1.13.1-0-g6612da8951
07-08 11:17:21.909 20762-20762/? D/libdeepspeech: TensorFlow: v1.13.1-0-g6612da8951
07-08 11:17:21.909 20762-20762/? E/libdeepspeech: DeepSpeech: v0.5.1-0-g4b29b78
07-08 11:17:21.909 20762-20762/? D/libdeepspeech: DeepSpeech: v0.5.1-0-g4b29b78
07-08 11:17:21.923 20762-20762/? E/tflite: tensorflow/lite/kernels/mfcc.cc:75 NumDimensions(inputRate) != 1 (0 != 1)
    Node number 2 (Mfcc) failed to prepare.
07-08 11:17:21.928 20762-20762/? A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 20762 (illa.deepspeech), pid 20762 (illa.deepspeech)  

To resolve this issue, I came across the following patch: issue-26174

This patch is not there in pre-built binaries. And hence, I am trying to build the binaries from source.

Android Test Device: Pixel XL 1
Model: Deepspeech model 0.5.1 I am using it’s tflite version ( I used tflite converter to converter to get tflite file)

Are you sure ? https://github.com/mozilla/tensorflow/blob/r1.13/tensorflow/lite/kernels/mfcc.cc#L75

How did you proceed ?

You should have re-used checkpoints and ran --export_dir ... --export_tflite. Using another tool to convert might introduce issues.

1 Like