diff options
Diffstat (limited to 'docs/nnfw/howto/HowToRunNnpackge.md')
-rw-r--r-- | docs/nnfw/howto/HowToRunNnpackge.md | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/docs/nnfw/howto/HowToRunNnpackge.md b/docs/nnfw/howto/HowToRunNnpackge.md new file mode 100644 index 000000000..93dd74e83 --- /dev/null +++ b/docs/nnfw/howto/HowToRunNnpackge.md @@ -0,0 +1,75 @@ +# How To Run 'nnpackage' (for beginners) + +## 0. Environment + +This document is based on an experience with ... + +``` +- Architecture : armhf +- OS : ubuntu 18.04 +``` + +## 1. What is 'nnpackage'? + +'nnpackage' is the input of nnfw and the output of nncc. + +'nnpackage' contains all data (such as model, MANIFEST, custom_op) that requires to run a given model. + +'nnpackage' is a Zip archive in the following structure: + +``` +nnpackage +├── custom_op +├── metadata +│ └── MANIFEST +└── mymodel.model +``` + +For more information, find the document [nnpackage/spec/10_packaging_and_manifest.md](../../../nnpackage/spec/10_packaging_and_manifest.md) + +## 2. How to generate nnpackage? + +'nnpackage' can be generated from either '.circle' or '.tflite'. + +In this example, we generate 'nnpackage' from '.tflite'. + + [1] Find 'model2nnpkg.sh'. + ``` + nnfw/tools/nnpackage_tool/model2nnpkg/model2nnpkg.sh + ``` + + [2] Get any \*.tflite model file. + You can simply use a file in test framework directory, 'nnfw/tests/framework/cache/'. + If you don't have /cache directory, download them with command + ``` + cd nnfw + MODELFILE_SERVER={MODELFILE_SERVER_LINK} ./tests/framework/run_test.sh --download=on + + For {MODELFILE_SERVER_LINK}, put appropriate server link. + ``` + In this example, we will use 'nnfw/tests/framework/cache/add/1D/add_test1.tflite' + + [3] Simply run. + ``` + $./model2nnpkg.sh add_test1 + ``` + Now, you got add_test1 directory. Check into the directory to find the hierchical structure inside. + +## 3. How to set up an environment and run? + + [1] Build 'nnfw'. + + After build, you can see an execution file 'nnfw/Product/armv7l-linux.debug/out/bin/nnpackage_run'. + For how to build, check out the document [docs/nnfw/howto/CrossBuildForArm.md](../../../docs/nnfw/howto/CrossBuildForArm.md). + + [2] Install package 'libhdf5-cpp-100'. + ``` + $ sudo apt install libhdf5-cpp-100 + ``` + + [3] Run nnpackage. + ``` + $ ./nnpackage_run add_test1 + ``` + Note that you need to put an whole 'add_test_1' directory, + because 'nnpackage' means an archive, not a single file. |