Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.51 KB

README.md

File metadata and controls

38 lines (30 loc) · 1.51 KB

How to Run the Application

Android SDK version==android-ndk-r17c

SNPE version==snpe-1.25.0.287

Convert Keras Model to .pb (TensorFlow)

  • First, we need to use the keras_to_tensorflow.py file to convert the .h5(keras model) to .pb(tensorflow model).
  • eg: python keras_to_tensorflow.py --input_model=model1.h5 --output_model=new.pb

Convert Frozen Graph (.pb) to Tflite format

tflite_convert 
--output_file=test.tflite 
--graph_def_file=tflite_graph.pb 
--input_shape=1,300,300,3

Convert Frozen Graph (.pb) to snapdragon Format (.dlc)

python ./bin/x86_64-linux-clang//snpe-tensorflow-to-dlc --graph $SNPE_ROOT/bin/x86_64-linux-clang/m.pb --input_dim "time_distributed_29_input" "3,30,120,240,3" --out_node "lstm_15/transpose_1" --dlc m.dlc --allow_unconsumed_nodes

Please get the name of the input tensor and output tensor from the frozen graph.

Running the application

  • Store the .pb file in the asset folder inside the android project.
  • Give correct address to the model inside the MainActivity.java file.
  • Run the App