blob: f3b35a13aafd3552c6d98d98d49104101b6375d9 [file] [log] [blame]
alexander3c798932021-03-26 21:42:19 +00001/*
2 * Copyright (c) 2021 Arm Limited. All rights reserved.
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17#ifndef ADPOSTPROCESSING_HPP
18#define ADPOSTPROCESSING_HPP
19
20#include "TensorFlowLiteMicro.hpp"
21
22#include <vector>
23
24namespace arm {
25namespace app {
26
27 /** @brief Dequantize TensorFlow Lite Micro tensor.
28 * @param[in] tensor Pointer to the TensorFlow Lite Micro tensor to be dequantized.
29 * @return Vector with the dequantized tensor values.
30 **/
31 template<typename T>
32 std::vector<float> Dequantize(TfLiteTensor* tensor);
33
34 /**
35 * @brief Calculates the softmax of vector in place. **/
36 void Softmax(std::vector<float>& inputVector);
37
38
39 /** @brief Given a wav file name return AD model output index.
40 * @param[in] wavFileName Audio WAV filename.
41 * File name should be in format <anything>_<goes>_XX_<here>.wav
42 * where XX is the machine ID e.g. 00, 02, 04 or 06
43 * @return AD model output index as 8 bit integer.
44 **/
45 int8_t OutputIndexFromFileName(std::string wavFileName);
46
47} /* namespace app */
48} /* namespace arm */
49
50#endif /* ADPOSTPROCESSING_HPP */