blob: 5a59b5fedaabc474cdcbaed786200ee4ece47327 [file] [log] [blame]
Richard Burton11b75cc2022-04-07 18:00:55 +01001/*
2 * Copyright (c) 2022 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 IMG_CLASS_PROCESSING_HPP
18#define IMG_CLASS_PROCESSING_HPP
19
20#include "BaseProcessing.hpp"
21#include "Model.hpp"
22#include "Classifier.hpp"
23
24namespace arm {
25namespace app {
26
27 /**
28 * @brief Pre-processing class for Image Classification use case.
29 * Implements methods declared by BasePreProcess and anything else needed
30 * to populate input tensors ready for inference.
31 */
32 class ImgClassPreProcess : public BasePreProcess {
33
34 public:
35 explicit ImgClassPreProcess(Model* model);
36
37 bool DoPreProcess(const void* input, size_t inputSize) override;
38 };
39
40 /**
41 * @brief Post-processing class for Image Classification use case.
42 * Implements methods declared by BasePostProcess and anything else needed
43 * to populate result vector.
44 */
45 class ImgClassPostProcess : public BasePostProcess {
46
47 private:
48 Classifier& m_imgClassifier;
49 const std::vector<std::string>& m_labels;
50 std::vector<ClassificationResult>& m_results;
51
52 public:
53 ImgClassPostProcess(Classifier& classifier, Model* model,
54 const std::vector<std::string>& labels,
55 std::vector<ClassificationResult>& results);
56
57 bool DoPostProcess() override;
58 };
59
60} /* namespace app */
61} /* namespace arm */
62
63#endif /* IMG_CLASS_PROCESSING_HPP */