mv_machine_learning: use carnel notation
[platform/core/api/mediavision.git] / mv_machine_learning / training / include / data_set_manager.h
1 /**
2  * Copyright (c) 2022 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 __DATA_SET_MANAGER_H__
18 #define __DATA_SET_MANAGER_H__
19
20 #include <fstream>
21 #include <vector>
22 #include <map>
23
24 #include "feature_vector_manager.h"
25
26 class DataSetManager
27 {
28 protected:
29         std::map<unsigned int, unsigned int> _fv_cnt_per_label;
30         std::vector<std::vector<float> > _data;
31         std::vector<std::vector<float> > _labels;
32         std::vector<unsigned int> _label_index;
33         size_t _feature_vector_size;
34         size_t _label_count;
35
36 public:
37         DataSetManager();
38         virtual ~DataSetManager();
39
40         void clear();
41         bool isFeatureVectorDuplicated(const std::vector<float> &vec);
42         std::vector<std::vector<float> > &getData(void);
43         std::vector<std::vector<float> > &getLabel(void);
44         size_t getFeaVecSize(void);
45         std::vector<unsigned int> &getLabelIdx(void);
46
47         virtual bool isFeatureVectorAllowed(unsigned int label_idx) = 0;
48         virtual void loadDataSet(const std::string file_name, unsigned int new_label_cnt) = 0;
49         virtual void addDataSet(std::vector<float> &feature_vec, const unsigned int label_idx,
50                                                         const unsigned int label_cnt) = 0;
51 };
52
53 #endif