occlum/demo/tensorflow_lite/run_tflite_in_linux.sh
LI Qing ba7db98e49 Add Tensorflow Lite Demo
The demo shows how to run the unmodified Tensorflow Lite on Occlum.
2019-10-14 08:55:45 +00:00

42 lines
815 B
Bash
Executable File

#!/bin/bash
export LD_LIBRARY_PATH=/usr/local/occlum/x86_64-linux-musl/lib:$LD_LIBRARY_PATH
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