occlum/demos/tensorflow_lite/run_tflite_in_linux.sh
LI Qing 1304f5388d Improve Occlum GCC toolchain with new wrappers for binaries
This commit makes the toolchain easier to use in two folds:
1. When compiling C/C++ source files, no need to add "-fPIC -pie" flags manually;
2. When running executables generated by the Occlum toolchain on Linux, no
need to set the `LD_LIBRARY_PATH` manually.
2019-11-29 11:20:00 +00:00

41 lines
735 B
Bash
Executable File

#!/bin/bash
set -e
show_usage() {
echo
echo "Usage: $0 demo/benchmark"
echo
}
copy_files() {
cp -f tensorflow_src/tensorflow/lite/tools/make/gen/linux_x86_64/bin/* .
cp -rf tensorflow_src/tensorflow/lite/examples/label_image/testdata .
}
run_demo() {
copy_files
./label_image \
--tflite_model ./models/mobilenet_v1_1.0_224.tflite \
--labels ./models/labels.txt \
--image ./testdata/grace_hopper.bmp
}
run_benchmark() {
copy_files
./benchmark_model \
--graph=./models/mobilenet_v1_1.0_224.tflite \
--warmup_runs=5
}
bin=$1
case "$bin" in
demo)
run_demo
;;
benchmark)
run_benchmark
;;
*)
show_usage
esac