summaryrefslogtreecommitdiff
path: root/docs/nnfw/howto/HowToTestManualy.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/nnfw/howto/HowToTestManualy.md')
-rw-r--r--docs/nnfw/howto/HowToTestManualy.md64
1 files changed, 64 insertions, 0 deletions
diff --git a/docs/nnfw/howto/HowToTestManualy.md b/docs/nnfw/howto/HowToTestManualy.md
new file mode 100644
index 000000000..545f97a1f
--- /dev/null
+++ b/docs/nnfw/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:
+ ```
+ /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:
+
+ ```
+ /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