blob: a557520b76aa33422ddcb44355db4bfc967de82f [file] [log] [blame]
Richard Burton11b75cc2022-04-07 18:00:55 +01001/*
Richard Burtonf32a86a2022-11-15 11:46:11 +00002 * SPDX-FileCopyrightText: Copyright 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
Richard Burton11b75cc2022-04-07 18:00:55 +01003 * 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 BASE_PROCESSING_HPP
18#define BASE_PROCESSING_HPP
19
Kshitij Sisodiaaa4bcb12022-05-06 09:13:03 +010020#include <cstddef>
Richard Burton11b75cc2022-04-07 18:00:55 +010021
22namespace arm {
23namespace app {
24
25 /**
26 * @brief Base class exposing pre-processing API.
27 * Use cases should provide their own PreProcessing class that inherits from this one.
28 * All steps required to take raw input data and populate tensors ready for inference
29 * should be handled.
30 */
31 class BasePreProcess {
32
33 public:
34 virtual ~BasePreProcess() = default;
35
36 /**
37 * @brief Should perform pre-processing of 'raw' input data and load it into
38 * TFLite Micro input tensors ready for inference
39 * @param[in] input Pointer to the data that pre-processing will work on.
40 * @param[in] inputSize Size of the input data.
41 * @return true if successful, false otherwise.
42 **/
43 virtual bool DoPreProcess(const void* input, size_t inputSize) = 0;
Richard Burton11b75cc2022-04-07 18:00:55 +010044 };
45
46 /**
47 * @brief Base class exposing post-processing API.
48 * Use cases should provide their own PostProcessing class that inherits from this one.
49 * All steps required to take inference output and populate results vectors should be handled.
50 */
51 class BasePostProcess {
52
53 public:
54 virtual ~BasePostProcess() = default;
55
56 /**
57 * @brief Should perform post-processing of the result of inference then populate
58 * populate result data for any later use.
59 * @return true if successful, false otherwise.
60 **/
61 virtual bool DoPostProcess() = 0;
Richard Burton11b75cc2022-04-07 18:00:55 +010062 };
63
64} /* namespace app */
65} /* namespace arm */
66
67#endif /* BASE_PROCESSING_HPP */