diff options
Diffstat (limited to 'python/pyarmnn/examples/common/tests')
4 files changed, 0 insertions, 90 deletions
diff --git a/python/pyarmnn/examples/common/tests/conftest.py b/python/pyarmnn/examples/common/tests/conftest.py deleted file mode 100644 index 5e027a0125..0000000000 --- a/python/pyarmnn/examples/common/tests/conftest.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright © 2020 Arm Ltd and Contributors. All rights reserved. -# SPDX-License-Identifier: MIT - -import os -import ntpath - -import urllib.request -import zipfile - -import pytest - -script_dir = os.path.dirname(__file__) -@pytest.fixture(scope="session") -def test_data_folder(request): - """ - This fixture returns path to folder with shared test resources among all tests - """ - - data_dir = os.path.join(script_dir, "testdata") - if not os.path.exists(data_dir): - os.mkdir(data_dir) - - files_to_download = ["https://raw.githubusercontent.com/opencv/opencv/4.0.0/samples/data/messi5.jpg", - "https://raw.githubusercontent.com/opencv/opencv/4.0.0/samples/data/basketball1.png", - "https://raw.githubusercontent.com/opencv/opencv/4.0.0/samples/data/Megamind.avi", - "https://storage.googleapis.com/download.tensorflow.org/models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip" - ] - - for file in files_to_download: - path, filename = ntpath.split(file) - file_path = os.path.join(data_dir, filename) - if not os.path.exists(file_path): - print("\nDownloading test file: " + file_path + "\n") - urllib.request.urlretrieve(file, file_path) - - # Any unzipping needed, and moving around of files - with zipfile.ZipFile(os.path.join(data_dir, "coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip"), 'r') as zip_ref: - zip_ref.extractall(data_dir) - - return data_dir diff --git a/python/pyarmnn/examples/common/tests/context.py b/python/pyarmnn/examples/common/tests/context.py deleted file mode 100644 index 72246c03bf..0000000000 --- a/python/pyarmnn/examples/common/tests/context.py +++ /dev/null @@ -1,7 +0,0 @@ -import os -import sys -sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) - -import cv_utils -import network_executor -import utils diff --git a/python/pyarmnn/examples/common/tests/test_network_executor.py b/python/pyarmnn/examples/common/tests/test_network_executor.py deleted file mode 100644 index e27b382078..0000000000 --- a/python/pyarmnn/examples/common/tests/test_network_executor.py +++ /dev/null @@ -1,24 +0,0 @@ -# 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 diff --git a/python/pyarmnn/examples/common/tests/test_utils.py b/python/pyarmnn/examples/common/tests/test_utils.py deleted file mode 100644 index 28d68ea235..0000000000 --- a/python/pyarmnn/examples/common/tests/test_utils.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright © 2020 Arm Ltd and Contributors. All rights reserved. -# SPDX-License-Identifier: MIT - -import os - -from context import cv_utils -from context import utils - - -def test_get_source_encoding(test_data_folder): - video_file = os.path.join(test_data_folder, "Megamind.avi") - video, video_writer, frame_count = cv_utils.init_video_file_capture(video_file, "/tmp") - assert cv_utils.get_source_encoding_int(video) == 1145656920 - - -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 |