aboutsummaryrefslogtreecommitdiff
path: root/python/pyarmnn/examples/tests/test_network_executor.py
diff options
context:
space:
mode:
authoralexander <alexander.efremov@arm.com>2021-07-16 11:30:56 +0100
committerJim Flynn <jim.flynn@arm.com>2022-02-04 09:55:21 +0000
commitf42f56870c6201a876f025a423eb5540d7438e83 (patch)
treee8e57e371c851cbb9a51a2f3ec35059addd2e93e /python/pyarmnn/examples/tests/test_network_executor.py
parent9d74ba6e85a043e9603445e062315f5c4965fbd6 (diff)
downloadarmnn-f42f56870c6201a876f025a423eb5540d7438e83.tar.gz
MLECO-2079 Adding the python KWS example
Signed-off-by: Eanna O Cathain <eanna.ocathain@arm.com> Change-Id: Ie1463aaeb5e3cade22df8f560ae99a8e1c4a9c17
Diffstat (limited to 'python/pyarmnn/examples/tests/test_network_executor.py')
-rw-r--r--python/pyarmnn/examples/tests/test_network_executor.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/python/pyarmnn/examples/tests/test_network_executor.py b/python/pyarmnn/examples/tests/test_network_executor.py
new file mode 100644
index 0000000000..c124b11382
--- /dev/null
+++ b/python/pyarmnn/examples/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, "ssd_mobilenet_v1.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, True)
+
+ output_result = executor.run(input_tensors)
+
+ # Ensure it detects a person
+ classes = output_result[1]
+ assert classes[0][0] == 0