From 82c716363fc834098f3c2f0538c8ce7066c781c3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9D=B4=ED=95=9C=EC=A2=85/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84?= =?utf8?q?=EC=9E=90?= Date: Thu, 17 May 2018 10:26:05 +0900 Subject: [PATCH] [tflite_run] Update README.md (#1243) Update README to reflect latest features Signed-off-by: Hanjoung Lee --- tools/tflite_run/README.md | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/tools/tflite_run/README.md b/tools/tflite_run/README.md index 61a5a9c..35d2b64 100644 --- a/tools/tflite_run/README.md +++ b/tools/tflite_run/README.md @@ -1,6 +1,6 @@ # tflite_run -A simple Tensorflow Lite runner. It measures the elapsed time and optionally dump the output data and compare them. +A simple Tensorflow Lite runner. It measures the elapsed time and optionally dump the input/output tensors or verify them. ## Usage @@ -12,12 +12,6 @@ This will run with random input data $ ./tflite_run model.tflite ``` -### Specifying input data - -``` -$ ./tflite_run model.tflite -``` - Output would look like: ``` @@ -28,15 +22,24 @@ Prepare takes 0.00126718 seconds Invoke takes 7.09527 seconds ``` -### Dump the outputs +### Specifying input feature map + +We can specify input feature map, but it only accepts preprocessed data which means that the image files must be converted. -Dump the output tensors to a file. +TODO : Add input image preprocessing instruction ``` +$ ./tflite_run model.tflite -i binary_input_file +``` + +### Dump the input and output tensors + +Dump the input and output tensors to a file. +``` $ ./tflite_run model.tflite --dump golden ``` -The output tensors are written to name "golden". +Why we do this is usually for later verification. The tensors are written to name "golden". ### Compare with the saved outputs @@ -73,3 +76,16 @@ Comparing the results with "golden2". ``` If `--compare` option is on, the exit code will be depend on its compare result. 0 for matched, other number for unmatched. + +## How Verification Works + +For verification, we may follow these steps: + +1. Generate and store the verfication data (run with option `--dump`) + 1. Input Tensor does not matter as we will keep inputs along with outputs + 1. Interpreter.Invoke() + 1. Dump input tensors and output tensors to a file +1. Give the dumped file for other runtime that we want to verify (run with option `--compare`) + 1. Set interpreter's input to input tensor data from the file + 1. Interpreter.Invoke() + 1. Compare the results with output tensor data from the file -- 2.7.4