aboutsummaryrefslogtreecommitdiff
path: root/python/pyarmnn/examples/common/tests/test_network_executor.py
diff options
context:
space:
mode:
authorÉanna Ó Catháin <eanna.ocathain@arm.com>2020-11-16 14:12:11 +0000
committerJim Flynn <jim.flynn@arm.com>2020-11-17 12:23:56 +0000
commit145c88f851d12d2cadc2f080d232c1d5963d6e47 (patch)
tree6ae197d74782cd2c7ef8965f4b36acabc65ce453 /python/pyarmnn/examples/common/tests/test_network_executor.py
parentaa41d5d2f43790938f3a32586626be5ef55b6ca9 (diff)
downloadarmnn-145c88f851d12d2cadc2f080d232c1d5963d6e47.tar.gz
MLECO-1253 Adding ASR sample application using the PyArmNN api
Change-Id: I450b23800ca316a5bfd4608c8559cf4f11271c21 Signed-off-by: Éanna Ó Catháin <eanna.ocathain@arm.com>
Diffstat (limited to 'python/pyarmnn/examples/common/tests/test_network_executor.py')
-rw-r--r--python/pyarmnn/examples/common/tests/test_network_executor.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/python/pyarmnn/examples/common/tests/test_network_executor.py b/python/pyarmnn/examples/common/tests/test_network_executor.py
new file mode 100644
index 0000000000..e27b382078
--- /dev/null
+++ b/python/pyarmnn/examples/common/tests/test_network_executor.py
@@ -0,0 +1,24 @@
+# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+# SPDX-License-Identifier: MIT
+
+import os
+
+import cv2
+
+from context import network_executor
+from context import cv_utils
+
+
+def test_execute_network(test_data_folder):
+ model_path = os.path.join(test_data_folder, "detect.tflite")
+ backends = ["CpuAcc", "CpuRef"]
+
+ executor = network_executor.ArmnnNetworkExecutor(model_path, backends)
+ img = cv2.imread(os.path.join(test_data_folder, "messi5.jpg"))
+ input_tensors = cv_utils.preprocess(img, executor.input_binding_info)
+
+ output_result = executor.run(input_tensors)
+
+ # Ensure it detects a person
+ classes = output_result[1]
+ assert classes[0][0] == 0