diff options
author | Éanna Ó Catháin <eanna.ocathain@arm.com> | 2020-11-16 14:12:11 +0000 |
---|---|---|
committer | Jim Flynn <jim.flynn@arm.com> | 2020-11-17 12:23:56 +0000 |
commit | 145c88f851d12d2cadc2f080d232c1d5963d6e47 (patch) | |
tree | 6ae197d74782cd2c7ef8965f4b36acabc65ce453 /python/pyarmnn/examples/speech_recognition/tests/test_decoder.py | |
parent | aa41d5d2f43790938f3a32586626be5ef55b6ca9 (diff) | |
download | armnn-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/speech_recognition/tests/test_decoder.py')
-rw-r--r-- | python/pyarmnn/examples/speech_recognition/tests/test_decoder.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/python/pyarmnn/examples/speech_recognition/tests/test_decoder.py b/python/pyarmnn/examples/speech_recognition/tests/test_decoder.py new file mode 100644 index 0000000000..3b99e6504a --- /dev/null +++ b/python/pyarmnn/examples/speech_recognition/tests/test_decoder.py @@ -0,0 +1,28 @@ +# Copyright © 2020 Arm Ltd and Contributors. All rights reserved. +# SPDX-License-Identifier: MIT + +import os + +import numpy as np + +from context import common_utils +from context import audio_utils + + +def test_labels(test_data_folder): + labels_file = os.path.join(test_data_folder, "wav2letter_labels.txt") + labels = common_utils.dict_labels(labels_file) + assert len(labels) == 29 + assert labels[26] == "\'" + assert labels[27] == r" " + assert labels[28] == "$" + + +def test_decoder(test_data_folder): + labels_file = os.path.join(test_data_folder, "wav2letter_labels.txt") + labels = common_utils.dict_labels(labels_file) + + output_tensor = os.path.join(test_data_folder, "inf_out.npy") + encoded = np.load(output_tensor) + decoded_text = audio_utils.decode(encoded, labels) + assert decoded_text == "and he walkd immediately out of the apartiment by anothe" |