mv_machine_learning: reallocate parser on changing meta file
[platform/core/api/mediavision.git] / mv_machine_learning / landmark_detection / include / landmark_detection_config.h
1 /**
2  * Copyright (c) 2023 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef __LANDMARK_DETECTION_CONFIG_H__
18 #define __LANDMARK_DETECTION_CONFIG_H__
19
20 #include <mv_common.h>
21 #include "mv_private.h"
22 #include "EngineConfig.h"
23
24 #include "MetaParser.h"
25 #include "landmark_detection_type.h"
26
27 namespace mediavision
28 {
29 namespace machine_learning
30 {
31 class LandmarkDetectionConfig
32 {
33 private:
34         std::unique_ptr<MetaParser> _parser;
35         std::string _defaultModelName;
36         std::string _modelFilePath;
37         std::string _modelMetaFilePath;
38         std::string _modelDefaultPath;
39         std::string _modelLabelFilePath;
40         int _backendType {};
41         int _targetDeviceType {};
42         double _confidence_threshold {};
43
44 public:
45         LandmarkDetectionConfig();
46         virtual ~LandmarkDetectionConfig() = default;
47
48         void setUserModel(const std::string &model_file, const std::string &meta_file, const std::string &label_file);
49         void parseConfigFile(const std::string &configFilePath);
50         void parseMetaFile();
51         void setBackendType(int backend_type);
52         void setTargetDeviceType(int device_type);
53         const std::string &getDefaultModelName() const;
54         const std::string &getModelFilePath() const;
55         const std::string &getLabelFilePath() const;
56         MetaMap &getInputMetaMap() const;
57         MetaMap &getOutputMetaMap() const;
58         double getConfidenceThreshold() const;
59         int getBackendType() const;
60         int getTargetDeviceType() const;
61         void loadMetaFile(LandmarkDetectionTaskType task_type);
62 };
63
64 } // machine_learning
65 } // mediavision
66
67 #endif