diff options
author | Ivan Vagin/AI Tools Lab /SRR/Engineer/삼성전자 <ivan.vagin@samsung.com> | 2019-05-22 01:15:51 +0300 |
---|---|---|
committer | 박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com> | 2019-05-22 07:15:51 +0900 |
commit | 466161a3d11e77bd3170c854699246cceb45df4d (patch) | |
tree | b045651d714140328976fe2c1e79c12980bec868 /docs | |
parent | 9d25737da96cc381a7a0668779ee194fcfe37ca8 (diff) | |
download | nnfw-466161a3d11e77bd3170c854699246cceb45df4d.tar.gz nnfw-466161a3d11e77bd3170c854699246cceb45df4d.tar.bz2 nnfw-466161a3d11e77bd3170c854699246cceb45df4d.zip |
Added 'how to test manually' document (#5205)
Added 'how to test manually' document
Signed-off-by: Ivan Vagin <ivan.vagin@samsung.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/howto.md | 1 | ||||
-rw-r--r-- | docs/howto/HowToTestManualy.md | 64 |
2 files changed, 65 insertions, 0 deletions
diff --git a/docs/howto.md b/docs/howto.md index 76d3b0707..48e26a28a 100644 --- a/docs/howto.md +++ b/docs/howto.md @@ -34,3 +34,4 @@ Google provides several pre-built T/F Lite models. Please check [this page](http - [How to setup XU3 with Ubuntu 16.04](howto/device/xu3_ubuntu.md) - [How to setup XU4 with Ubuntu 16.04](howto/device/xu4_ubuntu.md) - [How to add unittest using gtest](howto/HowToAddUnittest.md) +- [How to manually test NNFW on single model/input pair](howto/HowToTestManualy.md) diff --git a/docs/howto/HowToTestManualy.md b/docs/howto/HowToTestManualy.md new file mode 100644 index 000000000..980c0305a --- /dev/null +++ b/docs/howto/HowToTestManualy.md @@ -0,0 +1,64 @@ +# How to test NNFW on single model/input pair + +1. Select backend through environment variables: + * acl_cl: `export OP_BACKEND_ALLOPS=acl_cl` + * acl_neon: `export OP_BACKEND_ALLOPS=acl_neon` + * cpu: `export OP_BACKEND_ALLOPS=cpu` + * different backends for different operations: + ``` + unset OP_BACKEND_ALLOPS + export OP_BACKEND_Conv2DNode=cpu + export OP_BACKEND_MaxPool2DNode=acl_cl + export OP_BACKEND_AvgPool2DNode=acl_neon + ``` + +2. Select executor through environment variable: + * linear: `export EXECUTOR=Linear` + * dataflow: `export EXECUTOR=Dataflow` + * parallel: `export EXECUTOR=Parallel` + +3. Set library path: `export LD_LIBRARY_PATH=/path/to/nnfw/Product/armv7l-linux.debug/out/lib` + +## Test NNFW through NNAPI + +### Testing on random input +1. Generate random input, get reference result using tflite interpreter, dump input and result into file: + ``` + USE_NNAPI=0 /path/to/tflite_run --tflite /path/to/model.tflite --dump /path/to/out.dat + ``` +2. Inference with NNFW NNAPI and compare result with reference one: + ``` + USE_NNAPI=1 /path/to/tflite_run --tflite /path/to/model.tflite ---compare /path/to/out.dat + ``` + +### Testing on particular input +1. Prepare input: + + `tflite_run` consumes input as sequence of floats. + + For example, you could convert `.jpg` image into such format file with next python3 script: + ``` + from PIL import Image + import numpy as np + + img = Image.open("./image.jpg") + np_img = np.array(img.getdata()).reshape(img.size[0], img.size[1], 3).astype(np.float32) / 255. + + with open('./converted_image.dat', 'wb') as f: + for i in np_img.flatten('C'): + f.write(i) + ``` + +2. Get reference result using tflite interpreter, dump input and result into file: + + ``` + USE_NNAPI=0 /path/to/tflite_run --tflite /path/to/model.tflite --input /path/to/input.dat --dump /path/to/out.dat + ``` +3. Inference with NNFW NNAPI and compare result with reference one: + ``` + USE_NNAPI=1 /path/to/tflite_run --tflite /path/to/model.tflite ---compare /path/to/out.dat + ``` + +## Test NNFW through NNPackage + +TODO: fill this section when NNPackage will be implemented |