From 38c26926ee6e4fe08af2c31d16536f576d8194cd Mon Sep 17 00:00:00 2001 From: Colm Donelan Date: Tue, 4 May 2021 16:12:34 +0100 Subject: IVGCVSW-5939 Fixing broken links in IntegrateDelegateIntoPython.md * Fixing broken links in IntegrateDelegateIntoPython.md * Adding TFLite Model Benchmark Tool to BuildGuidenative.md Signed-off-by: Colm Donelan Change-Id: I41b7e1fb1dc7b5a95a5ab2a1ad2207150251e835 --- delegate/BuildGuideNative.md | 35 ++++++++++++++++++++++++++++++--- delegate/IntegrateDelegateIntoPython.md | 3 +-- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/delegate/BuildGuideNative.md b/delegate/BuildGuideNative.md index ec1dc4994d..62aa5c0eda 100644 --- a/delegate/BuildGuideNative.md +++ b/delegate/BuildGuideNative.md @@ -175,7 +175,6 @@ If you have built for Gpu acceleration as well you might want to change your tes ./DelegateUnitTests --test-suite=*CpuAcc*,*GpuAcc* ``` - # Build the Delegate together with Arm NN In the introduction it was mentioned that there is a way to integrate the delegate build into Arm NN. This is @@ -208,6 +207,34 @@ make ``` The delegate library can then be found in `build/armnn/delegate`. +# Test the Arm NN delegate using the [TFLite Model Benchmark Tool](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/tools/benchmark) + +The TFLite Model Benchmark Tool has a useful command line interface to test delegates. We can use this to demonstrate the use of the Arm NN delegate and its options. + +Some examples of this can be viewed in this [YouTube demonstration](https://www.youtube.com/watch?v=NResQ1kbm-M&t=920s). + +## Download the TFLite Model Benchmark Tool + +Binary builds of the benchmarking tool for various platforms are available [here](https://www.tensorflow.org/lite/performance/measurement#native_benchmark_binary). In this example I will target an aarch64 Linux environment. I will also download a sample uint8 tflite model from the [Arm ML Model Zoo](https://github.com/ARM-software/ML-zoo). + +```bash +mkdir $BASEDIR/benchmarking +cd $BASEDIR/benchmarking +# Get the benchmarking binary. +wget https://storage.googleapis.com/tensorflow-nightly-public/prod/tensorflow/release/lite/tools/nightly/latest/linux_aarch64_benchmark_model -O benchmark_model +# Make it executable. +chmod +x benchmark_model +# and a sample model from model zoo. +wget https://github.com/ARM-software/ML-zoo/blob/master/models/image_classification/mobilenet_v2_1.0_224/tflite_uint8/mobilenet_v2_1.0_224_quantized_1_default_1.tflite?raw=true -O mobilenet_v2_1.0_224_quantized_1_default_1.tflite +``` + +## Execute the benchmarking tool with the Arm NN delegate +```bash +cd $BASEDIR/benchmarking +LD_LIBRARY_PATH=../armnn/build ./benchmark_model --graph=mobilenet_v2_1.0_224_quantized_1_default_1.tflite --external_delegate_path="../armnn/build/delegate/libarmnnDelegate.so" --external_delegate_options="backends:CpuAcc;logging-severity:info" +``` +The "external_delegate_options" here are specific to the Arm NN delegate. They are used to specify a target Arm NN backend or to enable/disable various options in Arm NN. A full description can be found in the parameters of function [tflite_plugin_create_delegate](namespacetflite.xhtml). + # Integrate the Arm NN TfLite Delegate into your project The delegate can be integrated into your c++ project by creating a TfLite Interpreter and @@ -228,5 +255,7 @@ std::unique_ptrModifyGraphWithDelegate(theArmnnDelegate.get()); ``` -For further information on using TfLite Delegates -please visit the [tensorflow website](https://www.tensorflow.org/lite/guide) + +For further information on using TfLite Delegates please visit the [tensorflow website](https://www.tensorflow.org/lite/guide) + +For more details of the kind of options you can pass to the Arm NN delegate please check the parameters of function [tflite_plugin_create_delegate](namespacetflite.xhtml). diff --git a/delegate/IntegrateDelegateIntoPython.md b/delegate/IntegrateDelegateIntoPython.md index e8624e8f64..967b9e30e9 100644 --- a/delegate/IntegrateDelegateIntoPython.md +++ b/delegate/IntegrateDelegateIntoPython.md @@ -109,8 +109,7 @@ INFO: TfLiteArmnnDelegate: Created TfLite ArmNN delegate. Info: Shutdown time: 0.28 ms ``` -For more details on what kind of options you can pass to the Arm NN delegate please check -[armnn_delegate_adaptor.cpp](src/armnn_external_delegate.cpp). +For more details of the kind of options you can pass to the Arm NN delegate please check the parameters of function [tflite_plugin_create_delegate](namespacetflite.xhtml). You can also test the functionality of the external delegate adaptor by running some unit tests: ```bash -- cgit v1.2.1