Skip to content

Instantly share code, notes, and snippets.

@kenwoodjw
Last active August 16, 2018 03:50
Show Gist options
  • Save kenwoodjw/065594b20072e5e1fe39b0ecf76618d1 to your computer and use it in GitHub Desktop.
Save kenwoodjw/065594b20072e5e1fe39b0ecf76618d1 to your computer and use it in GitHub Desktop.
build_tensorflow.sh
#change pd model to tflite
bazel-bin/tensorflow/contrib/lite/toco/toco --input_file=model.pb --input_format=TENSORFLOW_GRAPHDEF --output_format=TFLITE --output_file=/tmp/mobile.tflite --inference_type=FLOAT --inference_input_type=FLOAT --input_arrays=input --output_arrays=Reshape --input_shapes=1,224,224,3
#build apk
bazel build -c opt --cxxopt='--std=c++11' //tensorflow/examples/tensorflow-android-speech-kws/android:tensorflow_demo
#华为 caffe 模型转换
./cngen_linux --prototxt mobilenet_v2_deploy.prototxt --model mobilenet_v2.caffemodel
#华为 tensorflow 模型转换
cd cpu2ipu && sh run.sh
./pb_to_offline --graph=../model/facenet_ipu.pb --param_file=../model/facenet_model.txt
#mtk tensorflow to lite
toco --input_file=<Frozen TensorFlow Model File> \
--input_format=TENSORFLOW_GRAPHDEF \
--output_format=TFLITE\
--output_file=<Output TensorFlow Lite Model File Name> \
--inference_type=FLOAT \
--inference_input_type=FLOAT \
--input_arrays=<INPUT_ARRAYS> \
--output_arrays=<OUTPUT_ARRAYS> \
--input_shapes=<INPUT_SHAPES>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment