blob: fb92008c27ce7981affc39ebb89ecfe76eaec7e0 [file] [log] [blame]
Michael Levit06fcf752022-01-12 11:53:46 +02001/*
Richard Burtonf32a86a2022-11-15 11:46:11 +00002 * SPDX-FileCopyrightText: Copyright 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
Michael Levit06fcf752022-01-12 11:53:46 +02003 * 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 YOLO_FASTEST_MODEL_HPP
18#define YOLO_FASTEST_MODEL_HPP
19
20#include "Model.hpp"
21
Michael Levit06fcf752022-01-12 11:53:46 +020022namespace arm {
23namespace app {
Liam Barry213a5432022-05-09 17:06:19 +010024 namespace object_detection {
25 extern const int originalImageSize;
26 extern const int channelsImageDisplayed;
27 /* NOTE: anchors are different for any given input model size, estimated during training
28 * phase */
29 extern const float anchor1[];
30 extern const float anchor2[];
31 } /* namespace object_detection */
Michael Levit06fcf752022-01-12 11:53:46 +020032
33 class YoloFastestModel : public Model {
34
35 public:
36 /* Indices for the expected model - based on input tensor shape */
37 static constexpr uint32_t ms_inputRowsIdx = 1;
38 static constexpr uint32_t ms_inputColsIdx = 2;
39 static constexpr uint32_t ms_inputChannelsIdx = 3;
40
41 protected:
42 /** @brief Gets the reference to op resolver interface class. */
43 const tflite::MicroOpResolver& GetOpResolver() override;
44
45 /** @brief Adds operations to the op resolver instance. */
46 bool EnlistOperations() override;
47
Michael Levit06fcf752022-01-12 11:53:46 +020048 private:
49 /* Maximum number of individual operations that can be enlisted. */
50 static constexpr int ms_maxOpCnt = 8;
51
52 /* A mutable op resolver instance. */
53 tflite::MicroMutableOpResolver<ms_maxOpCnt> m_opResolver;
54 };
55
56} /* namespace app */
57} /* namespace arm */
58
59#endif /* YOLO_FASTEST_MODEL_HPP */