2 * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __INFERENCE_ENGINE_INPUTMETADATA_H__
18 #define __INFERENCE_ENGINE_INPUTMETADATA_H__
25 #include "inference_engine_private_type.h"
26 #include "inference_engine_type.h"
27 #include "inference_engine_error.h"
29 #include <json-glib/json-glib.h>
32 * @file InputMetadata.h
33 * @brief This file contains the metadata class definition which
34 * provides metadata of a model.
37 namespace InferenceEngineInterface
48 std::vector<double> mean;
49 std::vector<double> std;
51 Normalization() : use(false) {}
52 ~Normalization() = default;
59 std::vector<double> scale;
60 std::vector<double> zeropoint;
62 Quantization() : use(false) {};
63 ~Quantization() = default;
66 Normalization normalization;
67 Quantization quantization;
78 std::vector<int> dims;
79 inference_colorspace_e colorSpace;
80 inference_tensor_data_type_e dataType;
81 inference_tensor_shape_type_e shapeType; // TODO: define mv_inference_shape_type_e
83 LayerInfo() = default;
84 ~LayerInfo() = default;
87 int GetHeight() const;
88 int GetChannel() const;
95 std::map<std::string, LayerInfo> layer;
96 std::map<std::string, Options> option;
99 * @brief Creates an InputMetadata class instance.
106 * @brief Destroys an InputMetadata class instance including
111 ~InputMetadata() = default;
114 * @brief Parses an InputMetadata
118 int Parse(JsonObject *root);
121 std::map<std::string, inference_tensor_shape_type_e> mSupportedShapeType;
122 std::map<std::string, inference_tensor_data_type_e> mSupportedDataType;
123 std::map<std::string, inference_colorspace_e> mSupportedColorSpace;
125 template <typename T>
126 static T GetSupportedType(JsonObject* root, std::string typeName,
127 std::map<std::string, T>& supportedTypes);
128 int GetTensorInfo(JsonObject* root);
129 int GetPreProcess(JsonObject* root);
136 #endif /* __INFERENCE_ENGINE_INPUTMETADATA_H__ */