Skip to content

craft-zhang/tensorflow-lite-cpp-examples

Repository files navigation

Forked from TI Repo https://git.ti.com/git/apps/tensorflow-lite-examples.git

Tensorflow Lite demos with input via OpenCV and used for gem5 full system simulation

Procedure to build
----------------------------
Step 1: Set environment variables
    * Arm only:
      - export TARGET_TOOLCHAIN_PREFIX
      - export TF_SRC_DIR
      - export OPENCV_SRC_DIR

Step 2: Run "make" from the top-level directory to build the demos

Example:
  $ export TARGET_TOOLCHAIN_PREFIX=aarch64-linux-gnu-
  $ export TF_SRC_DIR="/home/craft/workspace/gem5/tensorflow_src"
  $ export OPENCV_SRC_DIR="/home/craft/workspace/gem5/opencv"

  $ make

Binaries to run on target
---------------------------

* Classification: run "tflite_classification" with command usage as below:
--tflite_model, -m: model_name.tflite
--input_src, -r: [0|1|2] input source: image 0, video 1, camera 2
--input_path, -i: path of the input image/video or video port for camera, e.g., 1 for /dev/video1
--labels, -l: labels for the model
--frame_cnt, -c: the number of frames to be used
--input_mean, -b: input mean
--input_std, -s: input standard deviation
--profiling, -p: [0|1], profiling or not
--threads, -t: number of threads

* Segmentation: run "tflite_segmentation" with command usage as below
--tflite_model, -m: model_name.tflite
--input_src, -r: [0|1|2] input source: image 0, video 1, camera 2
--input_path, -i: path of the input image/video or video port for camera, e.g., 1 for /dev/video1
--frame_cnt, -c: the number of frames to be used
--input_mean, -b: input mean
--input_std, -s: input standard deviation
--profiling, -p: [0|1], profiling or not
--threads, -t: number of threads