diff options
author | Raviv Shalev <raviv.shalev@arm.com> | 2021-12-07 15:18:09 +0200 |
---|---|---|
committer | TeresaARM <teresa.charlinreyes@arm.com> | 2022-04-13 15:33:31 +0000 |
commit | 97ddc06e52fbcabfd8ede7a00e9494c663186b92 (patch) | |
tree | 43c84d352c3a67aa45d89760fba6c79b81c8f8dc /python/pyarmnn/examples/tests/test_common_utils.py | |
parent | 2f0ddb67d8f9267ab600a8a26308cab32f9e16ac (diff) | |
download | armnn-97ddc06e52fbcabfd8ede7a00e9494c663186b92.tar.gz |
MLECO-2493 Add python OD example with TFLite delegate
Signed-off-by: Raviv Shalev <raviv.shalev@arm.com>
Change-Id: I25fcccbf912be0c5bd4fbfd2e97552341958af35
Diffstat (limited to 'python/pyarmnn/examples/tests/test_common_utils.py')
-rw-r--r-- | python/pyarmnn/examples/tests/test_common_utils.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/python/pyarmnn/examples/tests/test_common_utils.py b/python/pyarmnn/examples/tests/test_common_utils.py index 28d68ea235..254eba63f8 100644 --- a/python/pyarmnn/examples/tests/test_common_utils.py +++ b/python/pyarmnn/examples/tests/test_common_utils.py @@ -2,9 +2,13 @@ # SPDX-License-Identifier: MIT import os +import time +import cv2 +import numpy as np from context import cv_utils from context import utils +from utils import Profiling def test_get_source_encoding(test_data_folder): @@ -17,3 +21,22 @@ def test_read_existing_labels_file(test_data_folder): label_file = os.path.join(test_data_folder, "labelmap.txt") labels_map = utils.dict_labels(label_file) assert labels_map is not None + + +def test_preprocess(test_data_folder): + content_image = "messi5.jpg" + target_shape = (1, 256, 256, 3) + padding = True + image = cv2.imread(os.path.join(test_data_folder, content_image)) + image = cv_utils.preprocess(image, np.float32, target_shape, True, padding) + + assert image.shape == target_shape + + +def test_profiling(): + profiler = Profiling(True) + profiler.profiling_start() + time.sleep(1) + period = profiler.profiling_stop_and_print_us("Sleep for 1 second") + assert (1_000_000 < period < 1_002_000) + |