2 * Copyright (c) 2022 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 __LABEL_MANAGER_H__
18 #define __LABEL_MANAGER_H__
28 #include "file_util.h"
33 std::map<std::string, std::string> _labels_and_files;
34 std::string _label_file;
35 float _decision_threshold;
36 static constexpr float _decision_weight = 0.01;
39 LabelManager(std::string label_file, double decision_threshold);
42 float GetDecisionThreshold();
43 float GetDecisionWeight();
44 unsigned int GetLabelIndex(const std::string given_label);
45 bool IsExist(const std::string given_label);
46 unsigned int RemoveLabel(const std::string given_label);
47 int GetLabelString(std::string &label, const int idx);
48 unsigned int AddLabelToFile(std::string given_label);
49 int ImportLabel(void);
50 bool AddLabelToMap(const std::string given_label, const std::string image_file);
51 size_t GetMaxLabel(const std::string label_file);
53 std::string GetLabelFromAnswer(const std::vector<float> &result);