mv_machine_learning: use carnel notation
authorInki Dae <inki.dae@samsung.com>
Tue, 14 Feb 2023 02:19:09 +0000 (11:19 +0900)
committerKwanghoon Son <k.son@samsung.com>
Fri, 3 Mar 2023 08:11:58 +0000 (17:11 +0900)
[Issue type] : code cleanup

Change-Id: If99f9105d95055142a58ffeddc12386689aeb7c2
Signed-off-by: Inki Dae <inki.dae@samsung.com>
43 files changed:
mv_machine_learning/face_recognition/include/backbone_model_info.h
mv_machine_learning/face_recognition/include/face_recognition.h
mv_machine_learning/face_recognition/include/face_recognition_dsm.h
mv_machine_learning/face_recognition/include/face_recognition_fvm.h
mv_machine_learning/face_recognition/include/face_recognition_type.h
mv_machine_learning/face_recognition/include/facenet.h
mv_machine_learning/face_recognition/include/simple_shot.h
mv_machine_learning/face_recognition/src/face_recognition.cpp
mv_machine_learning/face_recognition/src/face_recognition_adapter.cpp
mv_machine_learning/face_recognition/src/face_recognition_dsm.cpp
mv_machine_learning/face_recognition/src/face_recognition_fvm.cpp
mv_machine_learning/face_recognition/src/facenet.cpp
mv_machine_learning/face_recognition/src/facenet_adapter.cpp
mv_machine_learning/face_recognition/src/mv_face_recognition_open.cpp
mv_machine_learning/face_recognition/src/simple_shot.cpp
mv_machine_learning/image_classification/include/image_classification.h
mv_machine_learning/image_classification/include/image_classification_default.h
mv_machine_learning/image_classification/include/image_classification_type.h
mv_machine_learning/image_classification/src/image_classification.cpp
mv_machine_learning/image_classification/src/image_classification_adapter.cpp
mv_machine_learning/image_classification/src/image_classification_default.cpp
mv_machine_learning/image_classification/src/mv_image_classification_open.cpp
mv_machine_learning/inference/include/Inference.h
mv_machine_learning/inference/src/Inference.cpp
mv_machine_learning/inference/src/mv_inference_open.cpp
mv_machine_learning/object_detection/src/object_detection.cpp
mv_machine_learning/training/include/data_augment.h
mv_machine_learning/training/include/data_augment_default.h
mv_machine_learning/training/include/data_augment_flip.h
mv_machine_learning/training/include/data_augment_rotate.h
mv_machine_learning/training/include/data_set_manager.h
mv_machine_learning/training/include/feature_vector_manager.h
mv_machine_learning/training/include/file_util.h
mv_machine_learning/training/include/label_manager.h
mv_machine_learning/training/include/training_model.h
mv_machine_learning/training/src/data_augment_default.cpp
mv_machine_learning/training/src/data_augment_flip.cpp
mv_machine_learning/training/src/data_augment_rotate.cpp
mv_machine_learning/training/src/data_set_manager.cpp
mv_machine_learning/training/src/feature_vector_manager.cpp
mv_machine_learning/training/src/file_util.cpp
mv_machine_learning/training/src/label_manager.cpp
mv_machine_learning/training/src/training_model.cpp

index 0e08274..5deb576 100644 (file)
@@ -30,9 +30,9 @@ public:
        virtual ~IBackboneModelInfo()
        {}
 
-       virtual std::vector<model_layer_info> &GetInputLayerInfo() = 0;
-       virtual std::vector<model_layer_info> &GetOutputLayerInfo() = 0;
-       virtual std::string GetModelFilePath() = 0;
+       virtual std::vector<model_layer_info> &getInputLayerInfo() = 0;
+       virtual std::vector<model_layer_info> &getOutputLayerInfo() = 0;
+       virtual std::string getModelFilePath() = 0;
 };
 
 #endif
\ No newline at end of file
index 0ba0be4..5647e5b 100644 (file)
@@ -49,14 +49,14 @@ enum { REGISTER = 0, INFERENCE, DELETE };
 
 } // face_recognition
 
-struct face_recognition_register_input_s {
+struct FaceRecognitionRegisterInput {
        std::vector<float> data;
        std::string label;
 };
 
-struct mv_face_recognition_input_s {
+struct FaceRecognitionInput {
        unsigned int mode;
-       std::vector<face_recognition_register_input_s> register_src;
+       std::vector<FaceRecognitionRegisterInput> register_src;
        std::vector<std::vector<float> > inputs;
        std::vector<std::string> labels;
 };
@@ -66,7 +66,7 @@ struct mv_face_recognition_input_s {
  * @details Contains face recognition result such as label, label index, raw data,
  *          and raw data count.
  */
-struct mv_face_recognition_result_s {
+struct FaceRecognitionResult {
        unsigned int label_idx; /**< label index of label file. */
        std::vector<float> raw_data; /**< raw data to each label. */
        std::string label; /**< label string. */
@@ -95,27 +95,27 @@ private:
        std::unique_ptr<TrainingModel> _training_model;
        std::unique_ptr<LabelManager> _label_manager;
        FaceRecognitionConfig _config;
-       mv_face_recognition_result_s _result;
+       FaceRecognitionResult _result;
 
        // FYI. This function should be called every time a new face is registered.
-       void ImportLabel();
-       void CheckFeatureVectorFile(std::string fv_file_name, std::string new_fv_file_name);
-       void StoreDataSet(std::unique_ptr<DataSetManager> &data_set, unsigned int label_cnt);
-       int GetAnswer();
-       std::vector<model_layer_info> &GetBackboneInputLayerInfo();
-       int GetVecFromMvSource(mv_source_h img_src, std::vector<float> &out_vec);
+       void importLabel();
+       void checkFeatureVectorFile(std::string fv_file_name, std::string new_fv_file_name);
+       void storeDataSet(std::unique_ptr<DataSetManager> &data_set, unsigned int label_cnt);
+       int getAnswer();
+       std::vector<model_layer_info> &getBackboneInputLayerInfo();
+       int getVecFromMvSource(mv_source_h img_src, std::vector<float> &out_vec);
 
 public:
        FaceRecognition();
        ~FaceRecognition();
 
-       int Initialize();
-       void SetConfig(FaceRecognitionConfig &config);
-       int RegisterNewFace(std::vector<float> &input_vec, std::string label_name);
-       int RecognizeFace(std::vector<float> &input_vec);
-       int DeleteLabel(std::string label_name);
-       int GetLabel(const char **out_label);
-       mv_face_recognition_result_s &result();
+       int initialize();
+       void setConfig(FaceRecognitionConfig &config);
+       int registerNewFace(std::vector<float> &input_vec, std::string label_name);
+       int recognizeFace(std::vector<float> &input_vec);
+       int deleteLabel(std::string label_name);
+       int getLabel(const char **out_label);
+       FaceRecognitionResult &result();
 };
 
 } // machine_learning
index ace108a..9e52a24 100644 (file)
 class FaceRecognitionDSM : public DataSetManager
 {
 private:
-       void PrintHeader(FeaVecHeader &fvh);
+       void printHeader(FeaVecHeader &fvh);
 
 public:
        FaceRecognitionDSM();
        ~FaceRecognitionDSM() = default;
 
-       bool IsFeatureVectorAllowed(unsigned int label_idx) override;
-       void LoadDataSet(const std::string file_name, unsigned int new_label_cnt) override;
-       void AddDataSet(std::vector<float> &feature_vec, const unsigned int label_idx,
+       bool isFeatureVectorAllowed(unsigned int label_idx) override;
+       void loadDataSet(const std::string file_name, unsigned int new_label_cnt) override;
+       void addDataSet(std::vector<float> &feature_vec, const unsigned int label_idx,
                                        const unsigned int label_cnt) override;
 };
 
index e0b4241..a46b9b1 100644 (file)
@@ -29,9 +29,9 @@ public:
        FaceRecognitionFVM(const std::string feature_vector_file = "feature_vector_file.dat");
        ~FaceRecognitionFVM() = default;
 
-       void WriteHeader(size_t feature_size, size_t label_cnt, unsigned int data_set_cnt) override;
-       void StoreData(std::vector<std::vector<float> > &features_vec, std::vector<unsigned int> &label_index) override;
-       void Remove() override;
+       void writeHeader(size_t feature_size, size_t label_cnt, unsigned int data_set_cnt) override;
+       void storeData(std::vector<std::vector<float> > &features_vec, std::vector<unsigned int> &label_index) override;
+       void remove() override;
 };
 
 #endif
\ No newline at end of file
index 422040e..29aaf10 100644 (file)
  */
 #define MV_FACE_RECOGNITION_INPUT_TENSOR_SHAPE "FACE_RECOGNITION_INPUT_TENSOR_SHAPE"
 
-struct facenet_input_s {
+struct FacenetInput {
        std::vector<mv_source_h> inputs;
 };
 
-struct facenet_output_s {
+struct FacenetOutput {
        std::vector<std::vector<float> > outputs;
 };
 
index b67f608..577a929 100644 (file)
@@ -38,7 +38,7 @@ protected:
        std::unique_ptr<mediavision::inference::Inference> _inference;
        std::unique_ptr<MediaVision::Common::EngineConfig> _config;
        std::unique_ptr<MetaParser> _parser;
-       facenet_output_s _result;
+       FacenetOutput _result;
        inference_engine_tensor_buffer *_outputTensorBuffer {};
        Preprocess _preprocess;
        std::string _modelFilePath;
@@ -55,7 +55,7 @@ public:
        void prepare();
        void preprocess(mv_source_h &mv_src);
        void inference(mv_source_h source);
-       facenet_output_s &result();
+       FacenetOutput &result();
 };
 
 } // machine_learning
index 6f9c47d..804a3e2 100644 (file)
@@ -26,8 +26,8 @@ private:
        TrainingEngineBackendInfo _engine_info;
 
 private:
-       void SaveModel(const std::string file_path) override;
-       void RemoveModel(const std::string file_path) override;
+       void saveModel(const std::string file_path) override;
+       void removeModel(const std::string file_path) override;
 
 public:
        SimpleShot(const training_backend_type_e backend_type, const training_target_type_e target_type,
@@ -35,8 +35,8 @@ public:
        ~SimpleShot();
 
        // Configure layers for SimpleShot learning.
-       void ConfigureModel(int num_of_class) override;
-       TrainingEngineBackendInfo &GetTrainingEngineInfo() override;
+       void configureModel(int num_of_class) override;
+       TrainingEngineBackendInfo &getTrainingEngineInfo() override;
 };
 
 #endif
\ No newline at end of file
index e519437..427b221 100644 (file)
@@ -58,14 +58,14 @@ FaceRecognition::FaceRecognition()
 FaceRecognition::~FaceRecognition()
 {
        if (_label_manager)
-               _label_manager->Clear();
+               _label_manager->clear();
 }
 
-void FaceRecognition::CheckFeatureVectorFile(string fv_file_name, string new_fv_file_name)
+void FaceRecognition::checkFeatureVectorFile(string fv_file_name, string new_fv_file_name)
 {
        // Change new feature vector file to existing one in case that current process is terminated just after removing existing feature vector file but
        // new feature vector file isn't changed to existing one yet.
-       if (FaceRecogUtil::IsFileExist(new_fv_file_name) && !FaceRecogUtil::IsFileExist(fv_file_name)) {
+       if (FaceRecogUtil::isFileExist(new_fv_file_name) && !FaceRecogUtil::isFileExist(fv_file_name)) {
                int ret = ::rename(new_fv_file_name.c_str(), fv_file_name.c_str());
                if (ret)
                        throw InvalidOperation("Fail to rename new feature vector file to original one.");
@@ -75,14 +75,14 @@ void FaceRecognition::CheckFeatureVectorFile(string fv_file_name, string new_fv_
 
        // Make sure to remove a temp file in case that current process is terminated just after generating new feature vector file
        // which is not correct file but existing one isn't removed. In this case, existing file is used again.
-       if (FaceRecogUtil::IsFileExist(new_fv_file_name)) {
+       if (FaceRecogUtil::isFileExist(new_fv_file_name)) {
                int ret = ::remove(new_fv_file_name.c_str());
                if (ret)
                        throw InvalidOperation("Fail to remove new feature vector file.");
        }
 }
 
-void FaceRecognition::StoreDataSet(unique_ptr<DataSetManager> &data_set, unsigned int label_cnt)
+void FaceRecognition::storeDataSet(unique_ptr<DataSetManager> &data_set, unsigned int label_cnt)
 {
        try {
                unique_ptr<FeatureVectorManager> fvm = make_unique<FaceRecognitionFVM>(_config.feature_vector_file_path);
@@ -90,24 +90,24 @@ void FaceRecognition::StoreDataSet(unique_ptr<DataSetManager> &data_set, unsigne
                                make_unique<FaceRecognitionFVM>(_config.feature_vector_file_path + ".new");
 
                // Make sure feature vector file.
-               CheckFeatureVectorFile(fvm->GetFileName(), fvm_new->GetFileName());
+               checkFeatureVectorFile(fvm->getFileName(), fvm_new->getFileName());
 
                // 1. Write feature vector and it's label index.
-               fvm_new->StoreData(data_set->GetData(), data_set->GetLabelIdx());
+               fvm_new->storeData(data_set->getData(), data_set->getLabelIdx());
 
                // 2. Write feature vector header.
-               fvm_new->WriteHeader(data_set->GetFeaVecSize(), label_cnt, data_set->GetData().size());
+               fvm_new->writeHeader(data_set->getFeaVecSize(), label_cnt, data_set->getData().size());
 
                int ret = 0;
 
                // 3. Change new data file to existing one.
-               if (FaceRecogUtil::IsFileExist(fvm->GetFileName())) {
-                       ret = ::remove(fvm->GetFileName().c_str());
+               if (FaceRecogUtil::isFileExist(fvm->getFileName())) {
+                       ret = ::remove(fvm->getFileName().c_str());
                        if (ret)
                                throw InvalidOperation("Fail to remove feature vector file.");
                }
 
-               ret = ::rename(fvm_new->GetFileName().c_str(), fvm->GetFileName().c_str());
+               ret = ::rename(fvm_new->getFileName().c_str(), fvm->getFileName().c_str());
                if (ret)
                        throw InvalidOperation("Fail to rename new feature vector file to original one.");
        } catch (const BaseException &e) {
@@ -116,17 +116,17 @@ void FaceRecognition::StoreDataSet(unique_ptr<DataSetManager> &data_set, unsigne
        }
 }
 
-void FaceRecognition::SetConfig(FaceRecognitionConfig &config)
+void FaceRecognition::setConfig(FaceRecognitionConfig &config)
 {
        _config = config;
 }
 
-std::vector<model_layer_info> &FaceRecognition::GetBackboneInputLayerInfo()
+std::vector<model_layer_info> &FaceRecognition::getBackboneInputLayerInfo()
 {
-       return _backbone_model_info->GetInputLayerInfo();
+       return _backbone_model_info->getInputLayerInfo();
 }
 
-int FaceRecognition::GetVecFromMvSource(mv_source_h img_src, std::vector<float> &out_vec)
+int FaceRecognition::getVecFromMvSource(mv_source_h img_src, std::vector<float> &out_vec)
 {
        mv_colorspace_e colorspace = MEDIA_VISION_COLORSPACE_INVALID;
        unsigned int width = 0, height = 0, bufferSize = 0;
@@ -145,26 +145,26 @@ int FaceRecognition::GetVecFromMvSource(mv_source_h img_src, std::vector<float>
                return MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT;
        }
 
-       vector<model_layer_info> &input_layer_info = GetBackboneInputLayerInfo();
+       vector<model_layer_info> &input_layer_info = getBackboneInputLayerInfo();
        // TODO. consider multiple tensor info.
        size_t re_width = input_layer_info[0].tensor_info.shape[0];
        size_t re_height = input_layer_info[0].tensor_info.shape[1];
 
        LOGD("Convert mv source(WxH) : %d x %d => %zu x %zu", width, height, re_width, re_height);
 
-       FeatureVectorManager::GetVecFromRGB(buffer, out_vec, width, height, re_width, re_height);
+       FeatureVectorManager::getVecFromRGB(buffer, out_vec, width, height, re_width, re_height);
 
        return MEDIA_VISION_ERROR_NONE;
 }
 
-int FaceRecognition::Initialize()
+int FaceRecognition::initialize()
 {
        _training_model = make_unique<SimpleShot>(_config.training_engine_backend_type, _config.training_target_device_type,
                                                                                          _config.input_tensor_shape, _config.internal_model_file_path);
 
        _internal = make_unique<Inference>();
 
-       int ret = _internal->Bind(_config.inference_engine_backend_type, _config.inference_target_device_type);
+       int ret = _internal->bind(_config.inference_engine_backend_type, _config.inference_target_device_type);
        if (ret != MEDIA_VISION_ERROR_NONE)
                return ret;
 
@@ -173,7 +173,7 @@ int FaceRecognition::Initialize()
        return MEDIA_VISION_ERROR_NONE;
 }
 
-void FaceRecognition::ImportLabel()
+void FaceRecognition::importLabel()
 {
        try {
                // Prepare can be called several times after initialization is done so previous data should be dropped.
@@ -181,7 +181,7 @@ void FaceRecognition::ImportLabel()
                _label_manager = make_unique<LabelManager>(_config.label_file_path, _config.decision_threshold);
 
                // Update label manager from a given label file.
-               int cnt = _label_manager->ImportLabel();
+               int cnt = _label_manager->importLabel();
 
                LOGD("%d labels have been imported", cnt);
        } catch (const BaseException &e) {
@@ -190,7 +190,7 @@ void FaceRecognition::ImportLabel()
        }
 }
 
-int FaceRecognition::RegisterNewFace(std::vector<float> &input_vec, string label_name)
+int FaceRecognition::registerNewFace(std::vector<float> &input_vec, string label_name)
 {
        if (_status < INITIALIZED) {
                LOGE("Initialization not ready yet. (%u)", _status);
@@ -200,52 +200,52 @@ int FaceRecognition::RegisterNewFace(std::vector<float> &input_vec, string label
        // TODO. consider data augmentation.
        try {
                // Import label data from a label file.
-               ImportLabel();
+               importLabel();
 
                // 1. Store only label names to label file, which aren't duplicated.
-               bool duplicated = _label_manager->AddLabelToMap(label_name, label_name);
+               bool duplicated = _label_manager->addLabelToMap(label_name, label_name);
                if (!duplicated) {
-                       int ret = _label_manager->AddLabelToFile(label_name);
+                       int ret = _label_manager->addLabelToFile(label_name);
                        if (ret == 0)
                                return MEDIA_VISION_ERROR_INVALID_OPERATION;
                }
 
                // Get label index and count.
-               unsigned int label_idx = _label_manager->GetLabelIndex(label_name);
-               unsigned int label_cnt = _label_manager->GetMaxLabel();
+               unsigned int label_idx = _label_manager->getLabelIndex(label_name);
+               unsigned int label_cnt = _label_manager->getMaxLabel();
 
-               _training_model->ConfigureModel(label_cnt);
+               _training_model->configureModel(label_cnt);
 
                unique_ptr<DataSetManager> data_set = make_unique<FaceRecognitionDSM>();
 
-               data_set->Clear();
+               data_set->clear();
 
                // Load existing feature vectors if the feature vector file exists.
-               if (FaceRecogUtil::IsFileExist(_config.feature_vector_file_path) == true) {
+               if (FaceRecogUtil::isFileExist(_config.feature_vector_file_path) == true) {
                        LOGI("feature vector file already exists so it loads the file first.");
-                       data_set->LoadDataSet(_config.feature_vector_file_path, label_cnt);
+                       data_set->loadDataSet(_config.feature_vector_file_path, label_cnt);
                }
 
                // Add new feature vector only in case that feature vector count of given label_idx is less then 5.
                // It means that only 5 set of feature vector per a label is valid.
                // TODO. According to feature vector priority, new feature vector should be added.
-               if (data_set->IsFeatureVectorAllowed(label_idx))
-                       data_set->AddDataSet(input_vec, label_idx, label_cnt);
+               if (data_set->isFeatureVectorAllowed(label_idx))
+                       data_set->addDataSet(input_vec, label_idx, label_cnt);
 
-               _training_model->ApplyDataSet(data_set);
-               _training_model->Compile();
-               _training_model->Train();
+               _training_model->applyDataSet(data_set);
+               _training_model->compile();
+               _training_model->train();
 
                // TODO. apply feature vector priority policy here.
                // We can get weight trained from training engine.
                // _training_model->getWeights(&weights, &size, "centroid_knn1");
 
                // Store dataset to feature vector file.
-               StoreDataSet(data_set, label_cnt);
+               storeDataSet(data_set, label_cnt);
 
                // label_cnt can be changed every time the training is performed and all data set will be used for the training
                // again in this case. So make sure to clear previous data set before next training.
-               _training_model->ClearDataSet(data_set);
+               _training_model->clearDataSet(data_set);
                _status = REGISTERED;
        } catch (const BaseException &e) {
                LOGE("%s", e.what());
@@ -255,7 +255,7 @@ int FaceRecognition::RegisterNewFace(std::vector<float> &input_vec, string label
        return MEDIA_VISION_ERROR_NONE;
 }
 
-int FaceRecognition::GetAnswer()
+int FaceRecognition::getAnswer()
 {
        int answer_idx;
 
@@ -270,11 +270,11 @@ int FaceRecognition::GetAnswer()
                answer_idx = max_element(_result.raw_data.begin(), _result.raw_data.end()) - _result.raw_data.begin();
 
                // Check decision threshold.
-               if (_result.raw_data[answer_idx] < _label_manager->GetDecisionThreshold()) {
+               if (_result.raw_data[answer_idx] < _label_manager->getDecisionThreshold()) {
                        throw NoData("Not meet decision threshold.");
                }
 
-               float weighted = _result.raw_data[answer_idx] * _label_manager->GetDecisionWeight();
+               float weighted = _result.raw_data[answer_idx] * _label_manager->getDecisionWeight();
 
                // Check decision weight threshold.
                for (auto &r : _result.raw_data) {
@@ -295,19 +295,19 @@ int FaceRecognition::GetAnswer()
        return MEDIA_VISION_ERROR_NONE;
 }
 
-int FaceRecognition::RecognizeFace(std::vector<float> &input_vec)
+int FaceRecognition::recognizeFace(std::vector<float> &input_vec)
 {
        if (_status < INITIALIZED) {
                LOGE("Initialization not ready yet.(%u)", _status);
                return MEDIA_VISION_ERROR_INVALID_OPERATION;
        }
 
-       if (!FaceRecogUtil::IsFileExist(_config.internal_model_file_path)) {
+       if (!FaceRecogUtil::isFileExist(_config.internal_model_file_path)) {
                LOGE("Internal model file(%s) doesn't exist.", _config.internal_model_file_path.c_str());
                return MEDIA_VISION_ERROR_INVALID_PATH;
        }
 
-       TrainingEngineBackendInfo engine_info = _training_model->GetTrainingEngineInfo();
+       TrainingEngineBackendInfo engine_info = _training_model->getTrainingEngineInfo();
        vector<string> &input_layers = engine_info.input_layer_names;
        vector<inference_engine_tensor_info> &input_tensor_info = engine_info.input_tensor_info;
        vector<string> &output_layers = engine_info.output_layer_names;
@@ -322,22 +322,22 @@ int FaceRecognition::RecognizeFace(std::vector<float> &input_vec)
 
        try {
                // Import label data from a label file.
-               ImportLabel();
+               importLabel();
 
                // Tensor order is NCHW.
                size_t width = input_tensor_info[0].shape[0];
                size_t height = input_tensor_info[0].shape[1];
                size_t ch = input_tensor_info[0].shape[2];
 
-               _internal->ConfigureInputInfo(width, height, 1, ch, 1.0f, 0.0f, MV_INFERENCE_DATA_FLOAT32, input_layers);
+               _internal->configureInputInfo(width, height, 1, ch, 1.0f, 0.0f, MV_INFERENCE_DATA_FLOAT32, input_layers);
                // Output tensor size should be a number of labels so update it.
-               output_tensor_info[0].shape[0] = _label_manager->GetMaxLabel();
-               _internal->ConfigureOutputInfo(output_layers, output_tensor_info);
+               output_tensor_info[0].shape[0] = _label_manager->getMaxLabel();
+               _internal->configureOutputInfo(output_layers, output_tensor_info);
 
-               _internal->ConfigureModelFiles("", _config.internal_model_file_path, "");
+               _internal->configureModelFiles("", _config.internal_model_file_path, "");
 
                // Load the trained internal model.
-               int ret = _internal->Load();
+               int ret = _internal->load();
                if (ret != INFERENCE_ENGINE_ERROR_NONE) {
                        LOGE("Fail to Load.");
                        return MEDIA_VISION_ERROR_INVALID_OPERATION;
@@ -346,14 +346,14 @@ int FaceRecognition::RecognizeFace(std::vector<float> &input_vec)
                std::vector<std::vector<float> > input_tensors = { input_vec };
 
                // Do inference to the internal model.
-               ret = _internal->Run(input_tensors);
+               ret = _internal->run(input_tensors);
                if (ret != INFERENCE_ENGINE_ERROR_NONE) {
                        LOGE("fail to inference internal model.");
                        return MEDIA_VISION_ERROR_INVALID_OPERATION;
                }
 
                // output layer size should be 1.
-               TensorBuffer tensorBuffer = _internal->GetOutputTensorBuffer();
+               TensorBuffer tensorBuffer = _internal->getOutputTensorBuffer();
                inference_engine_tensor_buffer *internal_output_buffer = tensorBuffer.getTensorBuffer(output_layers[0]);
                if (!internal_output_buffer) {
                        LOGE("fail to get internal output tensor buffer.");
@@ -366,7 +366,7 @@ int FaceRecognition::RecognizeFace(std::vector<float> &input_vec)
                copy(raw_buffer, raw_buffer + internal_output_buffer->size / sizeof(float), back_inserter(_result.raw_data));
                _status = INFERENCED;
 
-               return GetAnswer();
+               return getAnswer();
        } catch (const BaseException &e) {
                LOGE("%s", e.what());
                return e.getError();
@@ -375,7 +375,7 @@ int FaceRecognition::RecognizeFace(std::vector<float> &input_vec)
        return MEDIA_VISION_ERROR_INVALID_OPERATION;
 }
 
-int FaceRecognition::DeleteLabel(string label_name)
+int FaceRecognition::deleteLabel(string label_name)
 {
        if (_status < INITIALIZED) {
                LOGE("Initialization not ready yet.(%u)", _status);
@@ -386,36 +386,36 @@ int FaceRecognition::DeleteLabel(string label_name)
 
        try {
                // Import label data from a label file.
-               ImportLabel();
+               importLabel();
 
-               if (_label_manager->IsExist(label_name) == false) {
+               if (_label_manager->isExist(label_name) == false) {
                        LOGE("%s doesn't exist in label file.", label_name.c_str());
                        return MEDIA_VISION_ERROR_INVALID_OPERATION;
                }
 
-               unsigned int target_label_idx = _label_manager->GetLabelIndex(label_name);
+               unsigned int target_label_idx = _label_manager->getLabelIndex(label_name);
 
-               auto label_cnt_ori = _label_manager->GetMaxLabel();
+               auto label_cnt_ori = _label_manager->getMaxLabel();
 
                // Get label count after removing a given label from the label file.
-               _label_manager->RemoveLabel(label_name);
+               _label_manager->removeLabel(label_name);
 
-               auto label_cnt = _label_manager->GetMaxLabel();
+               auto label_cnt = _label_manager->getMaxLabel();
                unique_ptr<FeatureVectorManager> fvm = make_unique<FaceRecognitionFVM>(_config.feature_vector_file_path);
                unique_ptr<FeatureVectorManager> fvm_new =
                                make_unique<FaceRecognitionFVM>(_config.feature_vector_file_path + ".new");
 
                // Make sure feature vector file.
-               CheckFeatureVectorFile(fvm->GetFileName(), fvm_new->GetFileName());
+               checkFeatureVectorFile(fvm->getFileName(), fvm_new->getFileName());
 
                unique_ptr<DataSetManager> data_set = make_unique<FaceRecognitionDSM>();
 
                // feature vectors corresponding to given label aren't removed yet from feature vector file.
                // So label_cnt_ori is needed.
-               data_set->LoadDataSet(fvm->GetFileName(), label_cnt_ori);
+               data_set->loadDataSet(fvm->getFileName(), label_cnt_ori);
 
-               vector<vector<float> > feature_vectors_old = data_set->GetData();
-               vector<unsigned int> label_idx_vectors_old = data_set->GetLabelIdx();
+               vector<vector<float> > feature_vectors_old = data_set->getData();
+               vector<unsigned int> label_idx_vectors_old = data_set->getLabelIdx();
                vector<vector<float> > feature_vectors_new;
                vector<unsigned int> label_idx_vectors_new;
 
@@ -452,40 +452,40 @@ int FaceRecognition::DeleteLabel(string label_name)
 
                // Retrain only in case that feature vectors exist.
                if (data_set_cnt > 0) {
-                       fvm_new->StoreData(feature_vectors_new, label_idx_vectors_new);
-                       fvm_new->WriteHeader(feature_vectors_new[0].size(), label_cnt, data_set_cnt);
+                       fvm_new->storeData(feature_vectors_new, label_idx_vectors_new);
+                       fvm_new->writeHeader(feature_vectors_new[0].size(), label_cnt, data_set_cnt);
 
                        int ret = 0;
 
-                       if (FaceRecogUtil::IsFileExist(fvm->GetFileName())) {
+                       if (FaceRecogUtil::isFileExist(fvm->getFileName())) {
                                // Change new data file to existing one.
-                               ret = ::remove(fvm->GetFileName().c_str());
+                               ret = ::remove(fvm->getFileName().c_str());
                                if (ret)
                                        throw InvalidOperation("Fail to remove feature vector file.");
                        }
 
-                       ret = ::rename(fvm_new->GetFileName().c_str(), fvm->GetFileName().c_str());
+                       ret = ::rename(fvm_new->getFileName().c_str(), fvm->getFileName().c_str());
                        if (ret)
                                throw InvalidOperation("Fail to rename new feature vector file to original one.");
 
-                       _training_model->ConfigureModel(label_cnt);
+                       _training_model->configureModel(label_cnt);
                        unique_ptr<DataSetManager> new_data_set = make_unique<FaceRecognitionDSM>();
-                       new_data_set->Clear();
+                       new_data_set->clear();
 
                        // TODO. Remove existing internal model file.
 
-                       new_data_set->LoadDataSet(_config.feature_vector_file_path, label_cnt);
-                       _training_model->ApplyDataSet(new_data_set);
-                       _training_model->Compile();
-                       _training_model->Train();
+                       new_data_set->loadDataSet(_config.feature_vector_file_path, label_cnt);
+                       _training_model->applyDataSet(new_data_set);
+                       _training_model->compile();
+                       _training_model->train();
 
                        // TODO. apply feature vector priority policy here.
                        // We can get weight trained from NNTrainer.
                        // _training_model->getWeights(&weights, &size, "centroid_knn1");
                } else {
-                       _training_model->RemoveModel();
-                       fvm->Remove();
-                       _label_manager->Remove();
+                       _training_model->removeModel();
+                       fvm->remove();
+                       _label_manager->removeFile();
 
                        LOGD("No training data so removed all relevant files.");
                }
@@ -499,7 +499,7 @@ int FaceRecognition::DeleteLabel(string label_name)
        return MEDIA_VISION_ERROR_NONE;
 }
 
-int FaceRecognition::GetLabel(const char **out_label)
+int FaceRecognition::getLabel(const char **out_label)
 {
        if (_status != INFERENCED) {
                LOGE("Inference not completed yet. (%d)", _status);
@@ -507,7 +507,7 @@ int FaceRecognition::GetLabel(const char **out_label)
        }
 
        try {
-               _label_manager->GetLabelString(_result.label, _result.label_idx);
+               _label_manager->getLabelString(_result.label, _result.label_idx);
        } catch (const BaseException &e) {
                LOGE("%s", e.what());
                return e.getError();
@@ -518,18 +518,18 @@ int FaceRecognition::GetLabel(const char **out_label)
        return MEDIA_VISION_ERROR_NONE;
 }
 
-mv_face_recognition_result_s &FaceRecognition::result()
+FaceRecognitionResult &FaceRecognition::result()
 {
        if (!_result.is_valid)
                throw NoData("Inference result not ready yet.");
 
-       ImportLabel();
+       importLabel();
 
        if (!_label_manager)
                throw NoData("Label file doesn't exist.");
 
        try {
-               _label_manager->GetLabelString(_result.label, _result.label_idx);
+               _label_manager->getLabelString(_result.label, _result.label_idx);
        } catch (const BaseException &e) {
                LOGE("%s", e.what());
                throw e;
index a147864..bac222d 100644 (file)
@@ -74,12 +74,12 @@ template<typename T, typename V> void FaceRecognitionAdapter<T, V>::configure()
        for (auto value : vecIntValues)
                config.input_tensor_shape.push_back(static_cast<size_t>(value));
 
-       _face_recognition->SetConfig(config);
+       _face_recognition->setConfig(config);
 }
 
 template<typename T, typename V> void FaceRecognitionAdapter<T, V>::prepare()
 {
-       int ret = _face_recognition->Initialize();
+       int ret = _face_recognition->initialize();
        if (ret != MEDIA_VISION_ERROR_NONE)
                throw InvalidOperation("Fail to initialize face recognition.");
 }
@@ -93,7 +93,7 @@ template<typename T, typename V> void FaceRecognitionAdapter<T, V>::perform()
 {
        if (_source.mode == mode::REGISTER) {
                for (auto &s : _source.register_src) {
-                       int ret = _face_recognition->RegisterNewFace(s.data, s.label);
+                       int ret = _face_recognition->registerNewFace(s.data, s.label);
                        if (ret != MEDIA_VISION_ERROR_NONE)
                                throw InvalidOperation("Fail to register new face.");
                }
@@ -103,7 +103,7 @@ template<typename T, typename V> void FaceRecognitionAdapter<T, V>::perform()
 
        if (_source.mode == mode::INFERENCE) {
                // _source.inputs.size should be 1.
-               int ret = _face_recognition->RecognizeFace(_source.inputs[0]);
+               int ret = _face_recognition->recognizeFace(_source.inputs[0]);
                if (ret == MEDIA_VISION_ERROR_NO_DATA)
                        throw NoData("Label not found.");
 
@@ -115,7 +115,7 @@ template<typename T, typename V> void FaceRecognitionAdapter<T, V>::perform()
 
        if (_source.mode == mode::DELETE) {
                for (auto &l : _source.labels) {
-                       int ret = _face_recognition->DeleteLabel(l);
+                       int ret = _face_recognition->deleteLabel(l);
                        if (ret != MEDIA_VISION_ERROR_NONE)
                                throw InvalidOperation("Fail to unregister a given label.");
                }
@@ -129,6 +129,6 @@ template<typename T, typename V> V &FaceRecognitionAdapter<T, V>::getOutput()
        return _face_recognition->result();
 }
 
-template class FaceRecognitionAdapter<mv_face_recognition_input_s, mv_face_recognition_result_s>;
+template class FaceRecognitionAdapter<FaceRecognitionInput, FaceRecognitionResult>;
 }
 }
\ No newline at end of file
index 5611daf..d4ae53a 100644 (file)
@@ -25,7 +25,7 @@
 using namespace std;
 using namespace mediavision::machine_learning::exception;
 
-void FaceRecognitionDSM::PrintHeader(FeaVecHeader &fvh)
+void FaceRecognitionDSM::printHeader(FeaVecHeader &fvh)
 {
        LOGD("signature = %u", fvh.signature);
        LOGD("feature vector size = %zu", fvh.feature_size);
@@ -36,12 +36,12 @@ void FaceRecognitionDSM::PrintHeader(FeaVecHeader &fvh)
 FaceRecognitionDSM::FaceRecognitionDSM() : DataSetManager()
 {}
 
-bool FaceRecognitionDSM::IsFeatureVectorAllowed(unsigned int label_idx)
+bool FaceRecognitionDSM::isFeatureVectorAllowed(unsigned int label_idx)
 {
        return (_fv_cnt_per_label[label_idx] < MAX_FEATURE_VECTOR_CNT);
 }
 
-void FaceRecognitionDSM::AddDataSet(std::vector<float> &feature_vec, const unsigned int label_idx,
+void FaceRecognitionDSM::addDataSet(std::vector<float> &feature_vec, const unsigned int label_idx,
                                                                        const unsigned int label_cnt)
 {
        _data.push_back(feature_vec);
@@ -58,7 +58,7 @@ void FaceRecognitionDSM::AddDataSet(std::vector<float> &feature_vec, const unsig
        _label_count = label_cnt;
 }
 
-void FaceRecognitionDSM::LoadDataSet(const string file_name, unsigned int new_label_cnt)
+void FaceRecognitionDSM::loadDataSet(const string file_name, unsigned int new_label_cnt)
 {
        std::ifstream inFile(file_name);
 
@@ -77,7 +77,7 @@ void FaceRecognitionDSM::LoadDataSet(const string file_name, unsigned int new_la
 
        inFile.seekg(0, ios::beg);
 
-       PrintHeader(fvh);
+       printHeader(fvh);
 
        if (FeatureVectorManager::feature_vector_signature != fvh.signature)
                throw InvalidOperation("Wrong feature vector header.");
index 7111cde..09eb74c 100644 (file)
@@ -25,7 +25,7 @@ using namespace mediavision::machine_learning::exception;
 FaceRecognitionFVM::FaceRecognitionFVM(const string feature_vector_file) : FeatureVectorManager(feature_vector_file)
 {}
 
-void FaceRecognitionFVM::WriteHeader(size_t feature_size, size_t label_cnt, unsigned int data_set_cnt)
+void FaceRecognitionFVM::writeHeader(size_t feature_size, size_t label_cnt, unsigned int data_set_cnt)
 {
        ofstream outFile { _feature_vector_file, ios::out | ios::binary | ios::app };
 
@@ -37,7 +37,7 @@ void FaceRecognitionFVM::WriteHeader(size_t feature_size, size_t label_cnt, unsi
        outFile.write((char *) &fvHeader, sizeof(FeaVecHeader));
 }
 
-void FaceRecognitionFVM::StoreData(vector<vector<float> > &features_vec, vector<unsigned int> &label_index)
+void FaceRecognitionFVM::storeData(vector<vector<float> > &features_vec, vector<unsigned int> &label_index)
 {
        ofstream outFile { _feature_vector_file, ios::out | ios::binary | ios::app };
 
@@ -50,7 +50,7 @@ void FaceRecognitionFVM::StoreData(vector<vector<float> > &features_vec, vector<
        }
 }
 
-void FaceRecognitionFVM::Remove()
+void FaceRecognitionFVM::remove()
 {
        // Remove existing file forcely.
        int ret = ::remove(_feature_vector_file.c_str());
index cebe041..3bc3c98 100644 (file)
@@ -38,7 +38,7 @@ Facenet::Facenet() : _backendType(), _targetDeviceType()
        _parser = make_unique<FacenetParser>();
 }
 
-static bool IsJsonFile(const string &fileName)
+static bool isJsonFile(const string &fileName)
 {
        return (!fileName.substr(fileName.find_last_of(".") + 1).compare("json"));
 }
@@ -70,7 +70,7 @@ void Facenet::parseMetaFile()
        if (_modelMetaFilePath.empty())
                throw InvalidOperation("Model meta file doesn't exist.");
 
-       if (!IsJsonFile(_modelMetaFilePath))
+       if (!isJsonFile(_modelMetaFilePath))
                throw InvalidOperation("Model meta file should be json.");
 
        _parser->load(_modelMetaFilePath);
@@ -78,7 +78,7 @@ void Facenet::parseMetaFile()
 
 void Facenet::configure()
 {
-       int ret = _inference->Bind(_backendType, _targetDeviceType);
+       int ret = _inference->bind(_backendType, _targetDeviceType);
        if (ret != MEDIA_VISION_ERROR_NONE)
                throw InvalidOperation("Fail to bind a backend engine.");
 }
@@ -93,10 +93,10 @@ void Facenet::prepare()
        if (ret != MEDIA_VISION_ERROR_NONE)
                throw InvalidOperation("Fail to configure output tensor info from meta file.");
 
-       _inference->ConfigureModelFiles("", _modelFilePath, "");
+       _inference->configureModelFiles("", _modelFilePath, "");
 
        // Request to load model files to a backend engine.
-       ret = _inference->Load();
+       ret = _inference->load();
        if (ret != MEDIA_VISION_ERROR_NONE)
                throw InvalidOperation("Fail to load model files.");
 }
@@ -118,16 +118,16 @@ void Facenet::inference(mv_source_h source)
 {
        LOGI("ENTER");
 
-       int ret = _inference->Run();
+       int ret = _inference->run();
        if (ret != MEDIA_VISION_ERROR_NONE)
                throw InvalidOperation("Fail to run inference");
 
        LOGI("LEAVE");
 }
 
-facenet_output_s &Facenet::result()
+FacenetOutput &Facenet::result()
 {
-       TensorBuffer &tensor_buffer_obj = _inference->GetOutputTensorBuffer();
+       TensorBuffer &tensor_buffer_obj = _inference->getOutputTensorBuffer();
 
        // Make sure to clear _result.outputs vectors because if not clear then other output_vector will be pushed to _result.outputs
        // and it results in sending wrong output vector to face recognition framework.
index 5963ed6..dd4ab3b 100644 (file)
@@ -66,6 +66,6 @@ template<typename T, typename V> V &FacenetAdapter<T, V>::getOutput()
        return _facenet->result();
 }
 
-template class FacenetAdapter<facenet_input_s, facenet_output_s>;
+template class FacenetAdapter<FacenetInput, FacenetOutput>;
 }
 }
\ No newline at end of file
index 5541e81..82b6757 100644 (file)
@@ -29,8 +29,8 @@ using namespace mediavision::common;
 using namespace mediavision::machine_learning;
 using namespace mediavision::machine_learning::face_recognition;
 using namespace mediavision::machine_learning::exception;
-using FaceRecognitionTask = ITask<mv_face_recognition_input_s, mv_face_recognition_result_s>;
-using FacenetTask = ITask<facenet_input_s, facenet_output_s>;
+using FaceRecognitionTask = ITask<FaceRecognitionInput, FaceRecognitionResult>;
+using FacenetTask = ITask<FacenetInput, FacenetOutput>;
 
 int mv_face_recognition_create_open(mv_face_recognition_h *handle)
 {
@@ -46,14 +46,14 @@ int mv_face_recognition_create_open(mv_face_recognition_h *handle)
        }
 
        FaceRecognitionTask *face_recognition_task = new (nothrow)
-                       FaceRecognitionAdapter<mv_face_recognition_input_s, mv_face_recognition_result_s>();
+                       FaceRecognitionAdapter<FaceRecognitionInput, FaceRecognitionResult>();
        if (!face_recognition_task) {
                delete context;
                LOGE("Fail to allocate a task.");
                return MEDIA_VISION_ERROR_OUT_OF_MEMORY;
        }
 
-       FacenetTask *facenet_task = new (nothrow) FacenetAdapter<facenet_input_s, facenet_output_s>();
+       FacenetTask *facenet_task = new (nothrow) FacenetAdapter<FacenetInput, FacenetOutput>();
        if (!facenet_task) {
                delete face_recognition_task;
                delete context;
@@ -163,14 +163,14 @@ int mv_face_recognition_register_open(mv_face_recognition_h handle, mv_source_h
 
                std::lock_guard<std::mutex> lock(context->_mutex);
 
-               facenet_input_s facenet_input = { { source } };
+               FacenetInput facenet_input = { { source } };
 
                facenet_task->setInput(facenet_input);
                facenet_task->perform();
 
-               facenet_output_s &facenet_output = facenet_task->getOutput();
-               mv_face_recognition_input_s face_recognition_input = { .mode = mode::REGISTER };
-               face_recognition_register_input_s facenet_to_face_reg_input = { facenet_output.outputs[0], string(label) };
+               FacenetOutput &facenet_output = facenet_task->getOutput();
+               FaceRecognitionInput face_recognition_input = { .mode = mode::REGISTER };
+               FaceRecognitionRegisterInput facenet_to_face_reg_input = { facenet_output.outputs[0], string(label) };
 
                face_recognition_input.register_src.clear();
                face_recognition_input.register_src.push_back(facenet_to_face_reg_input);
@@ -201,7 +201,7 @@ int mv_face_recognition_unregister_open(mv_face_recognition_h handle, const char
 
                std::lock_guard<std::mutex> lock(context->_mutex);
 
-               mv_face_recognition_input_s input = { mode::DELETE };
+               FaceRecognitionInput input = { mode::DELETE };
 
                input.labels.clear();
                input.labels.push_back(string(label));
@@ -233,13 +233,13 @@ int mv_face_recognition_inference_open(mv_face_recognition_h handle, mv_source_h
 
                std::lock_guard<std::mutex> lock(context->_mutex);
 
-               facenet_input_s facenet_input = { { source } };
+               FacenetInput facenet_input = { { source } };
 
                facenet_task->setInput(facenet_input);
                facenet_task->perform();
-               facenet_output_s &facenet_output = facenet_task->getOutput();
+               FacenetOutput &facenet_output = facenet_task->getOutput();
 
-               mv_face_recognition_input_s face_recognition_input = { mode::INFERENCE };
+               FaceRecognitionInput face_recognition_input = { mode::INFERENCE };
 
                face_recognition_input.inputs = facenet_output.outputs;
                face_recognition_task->setInput(face_recognition_input);
index cacf274..be00470 100644 (file)
@@ -71,7 +71,7 @@ SimpleShot::~SimpleShot()
                _training->DestroyModel(_model.get());
 }
 
-void SimpleShot::ConfigureModel(int num_of_class)
+void SimpleShot::configureModel(int num_of_class)
 {
        // TODO. Check the capacity.
 
@@ -122,25 +122,25 @@ void SimpleShot::ConfigureModel(int num_of_class)
                throw InvalidOperation("Fail to add knn layer.");
 }
 
-TrainingEngineBackendInfo &SimpleShot::GetTrainingEngineInfo()
+TrainingEngineBackendInfo &SimpleShot::getTrainingEngineInfo()
 {
        return _engine_info;
 }
 
-void SimpleShot::SaveModel(const string file_path)
+void SimpleShot::saveModel(const string file_path)
 {
        string bin_file_path = file_path.substr(0, file_path.find('.')) + ".bin";
        int ret = 0;
 
        // NNStreamer returns an error if internal model file(ini and bin files) exists before generating it.
        // So remove existing files.
-       if (FaceRecogUtil::IsFileExist(bin_file_path)) {
+       if (FaceRecogUtil::isFileExist(bin_file_path)) {
                ret = ::remove(bin_file_path.c_str());
                if (ret)
                        throw InvalidOperation("Fail to remove internal model file.");
        }
 
-       if (FaceRecogUtil::IsFileExist(file_path)) {
+       if (FaceRecogUtil::isFileExist(file_path)) {
                ret = ::remove(file_path.c_str());
                if (ret)
                        throw InvalidOperation("Fail to remove internal model file.");
@@ -151,19 +151,19 @@ void SimpleShot::SaveModel(const string file_path)
                throw InvalidOperation("Fail to save a model.");
 }
 
-void SimpleShot::RemoveModel(const string file_path)
+void SimpleShot::removeModel(const string file_path)
 {
        string bin_file_path = file_path.substr(0, file_path.find('.')) + ".bin";
        int ret = 0;
 
        // Remove existing files forcely.
-       if (FaceRecogUtil::IsFileExist(bin_file_path)) {
+       if (FaceRecogUtil::isFileExist(bin_file_path)) {
                ret = ::remove(bin_file_path.c_str());
                if (ret)
                        throw InvalidOperation("Fail to remove internal model file.");
        }
 
-       if (FaceRecogUtil::IsFileExist(file_path)) {
+       if (FaceRecogUtil::isFileExist(file_path)) {
                ret = ::remove(file_path.c_str());
                if (ret)
                        throw InvalidOperation("Fail to remove internal model file.");
index 2303292..f699a20 100644 (file)
@@ -61,7 +61,7 @@ public:
        void prepare();
        void preprocess(mv_source_h &mv_src);
        void inference(mv_source_h source);
-       virtual image_classification_result_s &result() = 0;
+       virtual ImageClassificationResult &result() = 0;
 };
 
 } // machine_learning
index e001fd7..a873d32 100644 (file)
@@ -32,12 +32,12 @@ namespace machine_learning
 class ImageClassificationDefault : public ImageClassification
 {
 private:
-       image_classification_result_s _result;
+       ImageClassificationResult _result;
 
 public:
        ImageClassificationDefault();
        ~ImageClassificationDefault();
-       image_classification_result_s &result() override;
+       ImageClassificationResult &result() override;
 };
 
 } // machine_learning
index 4047db1..a4c2f21 100644 (file)
@@ -26,7 +26,7 @@ namespace mediavision
 {
 namespace machine_learning
 {
-struct image_classification_input_s {
+struct ImageClassificationInput {
        mv_source_h inference_src;
        std::string model_file;
        std::string meta_file;
@@ -37,11 +37,11 @@ struct image_classification_input_s {
  * @brief The object detection result structure.
  * @details Contains object detection 3d result.
  */
-struct image_classification_result_s {
+struct ImageClassificationResult {
        std::string label;
 };
 
-enum class image_classification_task_type_e {
+enum class ImageClassificationTaskType {
        IMAGE_CLASSIFICATION_TASK_NONE = 0,
        // TODO
 };
index 0a92d44..7baada0 100644 (file)
@@ -41,7 +41,7 @@ ImageClassification::ImageClassification() : _backendType(), _targetDeviceType()
 
 void ImageClassification::configure()
 {
-       int ret = _inference->Bind(_backendType, _targetDeviceType);
+       int ret = _inference->bind(_backendType, _targetDeviceType);
        if (ret != MEDIA_VISION_ERROR_NONE)
                throw InvalidOperation("Fail to bind a backend engine.");
 }
@@ -144,10 +144,10 @@ void ImageClassification::prepare()
        if (ret != MEDIA_VISION_ERROR_NONE)
                throw InvalidOperation("Fail to configure output tensor info from meta file.");
 
-       _inference->ConfigureModelFiles("", _modelFilePath, "");
+       _inference->configureModelFiles("", _modelFilePath, "");
 
        // Request to load model files to a backend engine.
-       ret = _inference->Load();
+       ret = _inference->load();
        if (ret != MEDIA_VISION_ERROR_NONE)
                throw InvalidOperation("Fail to load model files.");
 }
@@ -173,7 +173,7 @@ void ImageClassification::inference(mv_source_h source)
 
        sources.push_back(source);
 
-       int ret = _inference->Run();
+       int ret = _inference->run();
        if (ret != MEDIA_VISION_ERROR_NONE)
                throw InvalidOperation("Fail to run inference");
 
@@ -182,7 +182,7 @@ void ImageClassification::inference(mv_source_h source)
 
 void ImageClassification::getOutputNames(vector<string> &names)
 {
-       TensorBuffer &tensor_buffer_obj = _inference->GetOutputTensorBuffer();
+       TensorBuffer &tensor_buffer_obj = _inference->getOutputTensorBuffer();
        IETensorBuffer &ie_tensor_buffer = tensor_buffer_obj.getIETensorBuffer();
 
        for (IETensorBuffer::iterator it = ie_tensor_buffer.begin(); it != ie_tensor_buffer.end(); it++)
@@ -193,7 +193,7 @@ void ImageClassification::getOutpuTensor(string &target_name, vector<float> &ten
 {
        LOGI("ENTER");
 
-       TensorBuffer &tensor_buffer_obj = _inference->GetOutputTensorBuffer();
+       TensorBuffer &tensor_buffer_obj = _inference->getOutputTensorBuffer();
 
        inference_engine_tensor_buffer *tensor_buffer = tensor_buffer_obj.getTensorBuffer(target_name);
        if (!tensor_buffer)
index 03a00e9..4498fdd 100644 (file)
@@ -72,6 +72,6 @@ template<typename T, typename V> V &ImageClassificationAdapter<T, V>::getOutput(
        return _image_classification->result();
 }
 
-template class ImageClassificationAdapter<image_classification_input_s, image_classification_result_s>;
+template class ImageClassificationAdapter<ImageClassificationInput, ImageClassificationResult>;
 }
 }
\ No newline at end of file
index 33a90cf..c515b73 100644 (file)
@@ -36,7 +36,7 @@ ImageClassificationDefault::ImageClassificationDefault() : _result()
 ImageClassificationDefault::~ImageClassificationDefault()
 {}
 
-image_classification_result_s &ImageClassificationDefault::result()
+ImageClassificationResult &ImageClassificationDefault::result()
 {
        vector<string> names;
 
index d3501ad..c172641 100644 (file)
@@ -33,7 +33,7 @@ using namespace mediavision::common;
 using namespace mediavision::machine_learning;
 using namespace MediaVision::Common;
 using namespace mediavision::machine_learning::exception;
-using ImageClassificationTask = ITask<image_classification_input_s, image_classification_result_s>;
+using ImageClassificationTask = ITask<ImageClassificationInput, ImageClassificationResult>;
 
 int mv_image_classification_set_model_open(mv_image_classification_h handle, const char *model_file,
                                                                                   const char *meta_file, const char *label_file)
@@ -47,7 +47,7 @@ int mv_image_classification_set_model_open(mv_image_classification_h handle, con
                auto context = static_cast<Context *>(handle);
                auto task = static_cast<ImageClassificationTask *>(context->__tasks.at("image_classification"));
 
-               image_classification_input_s input;
+               ImageClassificationInput input;
 
                input.model_file = string(model_file);
                input.meta_file = string(meta_file);
@@ -76,7 +76,7 @@ int mv_image_classification_create_open(mv_image_classification_h *out_handle)
 
        try {
                context = new Context();
-               task = new ImageClassificationAdapter<image_classification_input_s, image_classification_result_s>();
+               task = new ImageClassificationAdapter<ImageClassificationInput, ImageClassificationResult>();
 
                context->__tasks.insert(make_pair("image_classification", task));
                *out_handle = static_cast<mv_image_classification_h>(context);
@@ -175,7 +175,7 @@ int mv_image_classification_inference_open(mv_image_classification_h handle, mv_
                auto context = static_cast<Context *>(handle);
                auto task = static_cast<ImageClassificationTask *>(context->__tasks.at("image_classification"));
 
-               image_classification_input_s input = { source };
+               ImageClassificationInput input = { source };
 
                task->setInput(input);
                task->perform();
@@ -202,7 +202,7 @@ int mv_image_classification_get_label_open(mv_image_classification_h handle, con
                auto context = static_cast<Context *>(handle);
                auto task = static_cast<ImageClassificationTask *>(context->__tasks.at("image_classification"));
 
-               image_classification_result_s &result = task->getOutput();
+               ImageClassificationResult &result = task->getOutput();
 
                *out_label = result.label.c_str();
        } catch (const BaseException &e) {
index cfcbb68..53c009d 100644 (file)
@@ -145,7 +145,7 @@ public:
                 *
                 * @since_tizen 5.5
                 */
-       void ConfigureModelFiles(const std::string modelConfigFilePath, const std::string modelWeightFilePath,
+       void configureModelFiles(const std::string modelConfigFilePath, const std::string modelWeightFilePath,
                                                         const std::string modelUserFilePath);
 
        /**
@@ -153,10 +153,10 @@ public:
                 *
                 * @since_tizen 6.0
                 */
-       int ConfigureInputInfo(int width, int height, int dim, int ch, double stdValue, double meanValue, int dataType,
+       int configureInputInfo(int width, int height, int dim, int ch, double stdValue, double meanValue, int dataType,
                                                   const std::vector<std::string> names);
 
-       int ConfigureOutputInfo(std::vector<std::string> names, std::vector<inference_engine_tensor_info> &tensors_info);
+       int configureOutputInfo(std::vector<std::string> names, std::vector<inference_engine_tensor_info> &tensors_info);
 
        /**
         * @brief Configure input information from model meta file.
@@ -181,28 +181,28 @@ public:
                 *
                 * @since_tizen 6.0
                 */
-       int ConfigureTargetDevices(const int targetDevices);
+       int configureTargetDevices(const int targetDevices);
 
        /**
                 * @brief   Configure the maximum number of inference results
                 *
                 * @since_tizen 5.5
                 */
-       void ConfigureOutput(const int maxOutputNumbers);
+       void configureOutput(const int maxOutputNumbers);
 
        /**
                 * @brief   Configure the confidence threshold
                 *
                 * @since_tizen 5.5
                 */
-       void ConfigureThreshold(const double threshold);
+       void configureThreshold(const double threshold);
 
        /**
                 * @brief   Parses the metadata file path
                 *
                 * @since_tizen 6.5
                 */
-       int ParseMetadata(const std::string filePath);
+       int parseMetadata(const std::string filePath);
 
        /**
                 * @brief   Bind a backend engine
@@ -221,7 +221,7 @@ public:
                 * @retval #MEDIA_VISION_ERROR_NONE Successful
                 * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
                 */
-       int Bind(int backend_type, int device_type);
+       int bind(int backend_type, int device_type);
 
        /**
                 * @brief   Load model files
@@ -235,7 +235,7 @@ public:
                 * @retval #MEDIA_VISION_ERROR_NONE Successful
                 * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
                 */
-       int Load();
+       int load();
 
        /**
                 * @brief       Runs inference with a region of a given image
@@ -247,11 +247,11 @@ public:
                 * @since_tizen 5.5
                 * @return @c true on success, otherwise a negative error value
                 */
-       int Run(std::vector<mv_source_h> &mvSources, std::vector<mv_rectangle_s> &rects);
+       int run(std::vector<mv_source_h> &mvSources, std::vector<mv_rectangle_s> &rects);
 
-       int Run(std::vector<std::vector<float> > &input_tensors);
+       int run(std::vector<std::vector<float> > &input_tensors);
 
-       int Run();
+       int run();
 
        /**
                 * @brief       Gets that given engine is supported or not
@@ -259,7 +259,7 @@ public:
                 * @since_tizen 5.5
                 * @return @c true on success, otherwise a negative error value
                 */
-       std::pair<std::string, bool> GetSupportedInferenceBackend(int backend);
+       std::pair<std::string, bool> getSupportedInferenceBackend(int backend);
 
        /**
                 * @brief       Gets the ImageClassificationResults
@@ -267,7 +267,7 @@ public:
                 * @since_tizen 5.5
                 * @return @c true on success, otherwise a negative error value
                 */
-       int GetClassficationResults(ImageClassificationResults *results);
+       int getClassficationResults(ImageClassificationResults *results);
 
        /**
                 * @brief       Gets the ObjectDetectioResults
@@ -275,7 +275,7 @@ public:
                 * @since_tizen 5.5
                 * @return @c true on success, otherwise a negative error value
                 */
-       int GetObjectDetectionResults(ObjectDetectionResults *results);
+       int getObjectDetectionResults(ObjectDetectionResults *results);
 
        /**
                 * @brief       Gets the FaceDetectioResults
@@ -283,7 +283,7 @@ public:
                 * @since_tizen 5.5
                 * @return @c true on success, otherwise a negative error value
                 */
-       int GetFaceDetectionResults(FaceDetectionResults *results);
+       int getFaceDetectionResults(FaceDetectionResults *results);
 
        /**
                 * @brief       Gets the FacialLandmarkDetectionResults
@@ -291,7 +291,7 @@ public:
                 * @since_tizen 5.5
                 * @return @c true on success, otherwise a negative error value
                 */
-       int GetFacialLandMarkDetectionResults(FacialLandMarkDetectionResults *results);
+       int getFacialLandMarkDetectionResults(FacialLandMarkDetectionResults *results);
 
        /**
                 * @brief       Gets the PoseLandmarkDetectionResults
@@ -299,24 +299,24 @@ public:
                 * @since_tizen 6.0
                 * @return @c true on success, otherwise a negative error value
                 */
-       int GetPoseLandmarkDetectionResults(std::unique_ptr<mv_inference_pose_s> &detectionResults, int width, int height);
+       int getPoseLandmarkDetectionResults(std::unique_ptr<mv_inference_pose_s> &detectionResults, int width, int height);
 
-       mv_engine_config_h GetEngineConfig(void)
+       mv_engine_config_h getEngineConfig(void)
        {
                return engine_config;
        }
 
-       void SetEngineConfig(mv_engine_config_h config)
+       void setEngineConfig(mv_engine_config_h config)
        {
                engine_config = config;
        }
 
-       int GetTargetType()
+       int getTargetType()
        {
                return mConfig.mTargetTypes;
        }
 
-       TensorBuffer &GetOutputTensorBuffer()
+       TensorBuffer &getOutputTensorBuffer()
        {
                return mOutputTensorBuffers;
        }
@@ -383,18 +383,18 @@ private:
 private:
        int setInputInfo();
        int setOutputInfo(inference_engine_layer_property &property);
-       void CheckSupportedInferenceBackend();
-       int CheckBackendType(const mv_inference_backend_type_e backendType);
-       bool IsTargetDeviceSupported(const int targetDevices);
-       int ConvertEngineErrorToVisionError(int error);
-       int ConvertTargetTypes(int given_types);
-       int ConvertToCv(int given_type);
-       int ConvertOutputDataTypeToFloat();
-       int Preprocess(std::vector<mv_source_h> &mv_sources, std::vector<cv::Mat> &cv_sources);
-       inference_tensor_data_type_e ConvertToIE(int given_type);
-       int PrepareTenosrBuffers(void);
-       void CleanupTensorBuffers(void);
-       int SetUserFile(std::string filename);
+       void checkSupportedInferenceBackend();
+       int checkBackendType(const mv_inference_backend_type_e backendType);
+       bool isTargetDeviceSupported(const int targetDevices);
+       int convertEngineErrorToVisionError(int error);
+       int convertTargetTypes(int given_types);
+       int convertToCv(int given_type);
+       int convertOutputDataTypeToFloat();
+       int preprocess(std::vector<mv_source_h> &mv_sources, std::vector<cv::Mat> &cv_sources);
+       inference_tensor_data_type_e convertToIE(int given_type);
+       int prepareTenosrBuffers(void);
+       void cleanupTensorBuffers(void);
+       int setUserFile(std::string filename);
 };
 
 } /* Inference */
index 558dbb0..49afd52 100644 (file)
@@ -72,7 +72,7 @@ Inference::Inference()
 {
        LOGI("ENTER");
 
-       CheckSupportedInferenceBackend();
+       checkSupportedInferenceBackend();
 
        for (auto &backend : mSupportedInferenceBackend) {
                LOGI("%s: %s", backend.second.first.c_str(), backend.second.second ? "TRUE" : "FALSE");
@@ -82,7 +82,7 @@ Inference::Inference()
 
 Inference::~Inference()
 {
-       CleanupTensorBuffers();
+       cleanupTensorBuffers();
 
        if (!mInputLayerProperty.layers.empty()) {
                mInputLayerProperty.layers.clear();
@@ -104,7 +104,7 @@ Inference::~Inference()
        LOGI("Released backend engine.");
 }
 
-void Inference::CheckSupportedInferenceBackend()
+void Inference::checkSupportedInferenceBackend()
 {
        LOGI("ENTER");
 
@@ -121,7 +121,7 @@ void Inference::CheckSupportedInferenceBackend()
        LOGI("LEAVE");
 }
 
-int Inference::ConvertEngineErrorToVisionError(int error)
+int Inference::convertEngineErrorToVisionError(int error)
 {
        int ret = MEDIA_VISION_ERROR_NONE;
 
@@ -172,7 +172,7 @@ int Inference::ConvertEngineErrorToVisionError(int error)
        return ret;
 }
 
-int Inference::ConvertTargetTypes(int given_types)
+int Inference::convertTargetTypes(int given_types)
 {
        int target_types = INFERENCE_TARGET_NONE;
 
@@ -186,7 +186,7 @@ int Inference::ConvertTargetTypes(int given_types)
        return target_types;
 }
 
-int Inference::ConvertToCv(int given_type)
+int Inference::convertToCv(int given_type)
 {
        int type = 0;
        const int ch = mConfig.mTensorInfo.ch;
@@ -209,7 +209,7 @@ int Inference::ConvertToCv(int given_type)
        return type;
 }
 
-inference_tensor_data_type_e Inference::ConvertToIE(int given_type)
+inference_tensor_data_type_e Inference::convertToIE(int given_type)
 {
        inference_tensor_data_type_e type = INFERENCE_TENSOR_DATA_TYPE_FLOAT32;
 
@@ -228,7 +228,7 @@ inference_tensor_data_type_e Inference::ConvertToIE(int given_type)
        return type;
 }
 
-int Inference::SetUserFile(std::string filename)
+int Inference::setUserFile(std::string filename)
 {
        std::ifstream fp(filename.c_str());
        if (!fp.is_open()) {
@@ -247,7 +247,7 @@ int Inference::SetUserFile(std::string filename)
        return MEDIA_VISION_ERROR_NONE;
 }
 
-void Inference::ConfigureModelFiles(const std::string modelConfigFilePath, const std::string modelWeightFilePath,
+void Inference::configureModelFiles(const std::string modelConfigFilePath, const std::string modelWeightFilePath,
                                                                        const std::string modelUserFilePath)
 {
        LOGI("ENTER");
@@ -259,7 +259,7 @@ void Inference::ConfigureModelFiles(const std::string modelConfigFilePath, const
        LOGI("LEAVE");
 }
 
-int Inference::ConfigureInputInfo(int width, int height, int dim, int ch, double stdValue, double meanValue,
+int Inference::configureInputInfo(int width, int height, int dim, int ch, double stdValue, double meanValue,
                                                                  int dataType, const std::vector<std::string> names)
 {
        LOGI("ENTER");
@@ -373,7 +373,7 @@ int Inference::setInputInfo()
 
        for (auto &name : mConfig.mInputLayerNames) {
                inference_engine_tensor_info tensor_info;
-               tensor_info.data_type = ConvertToIE(mConfig.mDataType);
+               tensor_info.data_type = convertToIE(mConfig.mDataType);
 
                // In case of OpenCV, only supports NCHW
                tensor_info.shape_type = INFERENCE_TENSOR_SHAPE_NCHW;
@@ -404,7 +404,7 @@ int Inference::setInputInfo()
        return ret;
 }
 
-int Inference::ConfigureOutputInfo(const std::vector<std::string> names,
+int Inference::configureOutputInfo(const std::vector<std::string> names,
                                                                   std::vector<inference_engine_tensor_info> &tensors_info)
 {
        LOGI("ENTER");
@@ -516,7 +516,7 @@ int Inference::setOutputInfo(inference_engine_layer_property &property)
        return ret;
 }
 
-int Inference::CheckBackendType(const mv_inference_backend_type_e backendType)
+int Inference::checkBackendType(const mv_inference_backend_type_e backendType)
 {
        // Check if a given backend type is valid or not.
        if (backendType <= MV_INFERENCE_BACKEND_NONE || backendType >= MV_INFERENCE_BACKEND_MAX) {
@@ -535,7 +535,7 @@ int Inference::CheckBackendType(const mv_inference_backend_type_e backendType)
        return MEDIA_VISION_ERROR_NONE;
 }
 
-int Inference::ConfigureTargetDevices(const int targetDevices)
+int Inference::configureTargetDevices(const int targetDevices)
 {
        // Check if given target types are valid or not.
        if (MV_INFERENCE_TARGET_DEVICE_NONE >= targetDevices || MV_INFERENCE_TARGET_DEVICE_MAX <= targetDevices) {
@@ -550,7 +550,7 @@ int Inference::ConfigureTargetDevices(const int targetDevices)
        return MEDIA_VISION_ERROR_NONE;
 }
 
-bool Inference::IsTargetDeviceSupported(const int targetDevices)
+bool Inference::isTargetDeviceSupported(const int targetDevices)
 {
        if (!(mBackendCapacity.supported_accel_devices & targetDevices)) {
                LOGE("Backend doesn't support a given %x device acceleration.", targetDevices);
@@ -560,19 +560,19 @@ bool Inference::IsTargetDeviceSupported(const int targetDevices)
        return true;
 }
 
-void Inference::ConfigureOutput(const int maxOutputNumbers)
+void Inference::configureOutput(const int maxOutputNumbers)
 {
        mConfig.mMaxOutputNumbers =
                        std::max(std::min(maxOutputNumbers, MV_INFERENCE_OUTPUT_NUMBERS_MAX), MV_INFERENCE_OUTPUT_NUMBERS_MIN);
 }
 
-void Inference::ConfigureThreshold(const double threshold)
+void Inference::configureThreshold(const double threshold)
 {
        mConfig.mConfidenceThresHold =
                        std::max(std::min(threshold, MV_INFERENCE_CONFIDENCE_THRESHOLD_MAX), MV_INFERENCE_CONFIDENCE_THRESHOLD_MIN);
 }
 
-int Inference::ParseMetadata(const std::string filePath)
+int Inference::parseMetadata(const std::string filePath)
 {
        LOGI("ENTER");
        int ret = mMetadata.Init(filePath);
@@ -592,7 +592,7 @@ int Inference::ParseMetadata(const std::string filePath)
        return MEDIA_VISION_ERROR_NONE;
 }
 
-void Inference::CleanupTensorBuffers(void)
+void Inference::cleanupTensorBuffers(void)
 {
        LOGI("ENTER");
 
@@ -607,11 +607,11 @@ void Inference::CleanupTensorBuffers(void)
        LOGI("LEAVE");
 }
 
-int Inference::PrepareTenosrBuffers(void)
+int Inference::prepareTenosrBuffers(void)
 {
        // If there are input and output tensor buffers allocated before then release the buffers.
        // They will be allocated again according to a new model file to be loaded.
-       CleanupTensorBuffers();
+       cleanupTensorBuffers();
 
        // IF model file is loaded again then the model type could be different so
        // clean up input and output layer properties so that they can be updated again
@@ -630,13 +630,13 @@ int Inference::PrepareTenosrBuffers(void)
        int ret = mBackend->GetInputTensorBuffers(inputTensorBuffers);
        if (ret != INFERENCE_ENGINE_ERROR_NONE) {
                LOGE("Fail to get input tensor buffers from backend engine.");
-               return ConvertEngineErrorToVisionError(ret);
+               return convertEngineErrorToVisionError(ret);
        }
 
        ret = mBackend->GetInputLayerProperty(mInputLayerProperty);
        if (ret != INFERENCE_ENGINE_ERROR_NONE) {
                LOGE("Fail to get input layer property from backend engine.");
-               return ConvertEngineErrorToVisionError(ret);
+               return convertEngineErrorToVisionError(ret);
        }
 
        // If the backend engine isn't able to allocate input tensor buffers internally,
@@ -663,13 +663,13 @@ int Inference::PrepareTenosrBuffers(void)
        ret = mBackend->GetOutputTensorBuffers(outputTensorBuffers);
        if (ret != INFERENCE_ENGINE_ERROR_NONE) {
                LOGE("Fail to get output tensor buffers from backend engine.");
-               return ConvertEngineErrorToVisionError(ret);
+               return convertEngineErrorToVisionError(ret);
        }
 
        ret = mBackend->GetOutputLayerProperty(mOutputLayerProperty);
        if (ret != INFERENCE_ENGINE_ERROR_NONE) {
                LOGE("Fail to get output layer property from backend engine.");
-               return ConvertEngineErrorToVisionError(ret);
+               return convertEngineErrorToVisionError(ret);
        }
 
        // If the backend engine isn't able to allocate output tensor buffers internally,
@@ -694,7 +694,7 @@ int Inference::PrepareTenosrBuffers(void)
        return MEDIA_VISION_ERROR_NONE;
 }
 
-int Inference::ConvertOutputDataTypeToFloat()
+int Inference::convertOutputDataTypeToFloat()
 {
        IETensorBuffer &ieTensorBuffers = mOutputTensorBuffers.getIETensorBuffer();
 
@@ -722,11 +722,11 @@ int Inference::ConvertOutputDataTypeToFloat()
        return MEDIA_VISION_ERROR_NONE;
 }
 
-int Inference::Bind(int backend_type, int device_type)
+int Inference::bind(int backend_type, int device_type)
 {
        LOGI("ENTER");
 
-       int ret = CheckBackendType(static_cast<mv_inference_backend_type_e>(backend_type));
+       int ret = checkBackendType(static_cast<mv_inference_backend_type_e>(backend_type));
        if (ret != MEDIA_VISION_ERROR_NONE)
                return ret;
 
@@ -779,7 +779,7 @@ int Inference::Bind(int backend_type, int device_type)
                return ret;
        }
 
-       if (!IsTargetDeviceSupported(mConfig.mTargetTypes)) {
+       if (!isTargetDeviceSupported(mConfig.mTargetTypes)) {
                mBackend->UnbindBackend();
                LOGE("Tried to configure invalid target types.");
                return MEDIA_VISION_ERROR_NOT_SUPPORTED;
@@ -790,7 +790,7 @@ int Inference::Bind(int backend_type, int device_type)
        return MEDIA_VISION_ERROR_NONE;
 }
 
-int Inference::Load(void)
+int Inference::load(void)
 {
        LOGI("ENTER");
 
@@ -801,7 +801,7 @@ int Inference::Load(void)
                return MEDIA_VISION_ERROR_INVALID_PARAMETER;
        }
 
-       int ret = (userFileLength > 0) ? SetUserFile(label_file) : MEDIA_VISION_ERROR_NONE;
+       int ret = (userFileLength > 0) ? setUserFile(label_file) : MEDIA_VISION_ERROR_NONE;
        if (ret != MEDIA_VISION_ERROR_NONE) {
                LOGE("Fail to load label file.");
                return ret;
@@ -848,13 +848,13 @@ int Inference::Load(void)
                LOGE("Fail to load model");
                mCanRun = false;
                std::vector<std::string>().swap(models);
-               return ConvertEngineErrorToVisionError(ret);
+               return convertEngineErrorToVisionError(ret);
        }
 
        std::vector<std::string>().swap(models);
 
        // Prepare input and output tensor buffers.
-       ret = PrepareTenosrBuffers();
+       ret = prepareTenosrBuffers();
        if (ret != INFERENCE_ENGINE_ERROR_NONE) {
                LOGE("Fail to prepare buffer");
                mCanRun = false;
@@ -865,16 +865,16 @@ int Inference::Load(void)
 
        LOGI("LEAVE");
 
-       return ConvertEngineErrorToVisionError(ret);
+       return convertEngineErrorToVisionError(ret);
 }
 
-int Inference::Preprocess(std::vector<mv_source_h> &mv_sources, std::vector<cv::Mat> &cv_sources)
+int Inference::preprocess(std::vector<mv_source_h> &mv_sources, std::vector<cv::Mat> &cv_sources)
 {
        unsigned int src_idx = 0;
 
        for (auto &buffer : mInputTensorBuffers.getIETensorBuffer()) {
                inference_engine_tensor_buffer &tensor_buffer = buffer.second;
-               int data_type = ConvertToCv(tensor_buffer.data_type);
+               int data_type = convertToCv(tensor_buffer.data_type);
                LayerInfo layerInfo;
                Options opt;
                mv_colorspace_e colorspace = MEDIA_VISION_COLORSPACE_INVALID;
@@ -923,7 +923,7 @@ int Inference::Preprocess(std::vector<mv_source_h> &mv_sources, std::vector<cv::
        return MEDIA_VISION_ERROR_NONE;
 }
 
-int Inference::Run(std::vector<mv_source_h> &mvSources, std::vector<mv_rectangle_s> &rects)
+int Inference::run(std::vector<mv_source_h> &mvSources, std::vector<mv_rectangle_s> &rects)
 {
        int ret = INFERENCE_ENGINE_ERROR_NONE;
 
@@ -965,7 +965,7 @@ int Inference::Run(std::vector<mv_source_h> &mvSources, std::vector<mv_rectangle
        // TODO. consider multiple cv sources.
        mSourceSize = cvSources[0].size();
 
-       ret = Preprocess(mvSources, cvSources);
+       ret = preprocess(mvSources, cvSources);
        if (ret != MEDIA_VISION_ERROR_NONE) {
                LOGE("Fail to preprocess given input sources.");
                return ret;
@@ -975,10 +975,10 @@ int Inference::Run(std::vector<mv_source_h> &mvSources, std::vector<mv_rectangle
        if (ret != INFERENCE_ENGINE_ERROR_NONE)
                return ret;
 
-       return ConvertOutputDataTypeToFloat();
+       return convertOutputDataTypeToFloat();
 }
 
-int Inference::Run(std::vector<std::vector<float> > &input_tensors)
+int Inference::run(std::vector<std::vector<float> > &input_tensors)
 {
        int ret = INFERENCE_ENGINE_ERROR_NONE;
 
@@ -1025,10 +1025,10 @@ int Inference::Run(std::vector<std::vector<float> > &input_tensors)
        if (ret != INFERENCE_ENGINE_ERROR_NONE)
                return ret;
 
-       return ConvertOutputDataTypeToFloat();
+       return convertOutputDataTypeToFloat();
 }
 
-int Inference::Run()
+int Inference::run()
 {
        int ret = INFERENCE_ENGINE_ERROR_NONE;
 
@@ -1041,15 +1041,15 @@ int Inference::Run()
        if (ret != INFERENCE_ENGINE_ERROR_NONE)
                return ret;
 
-       return ConvertOutputDataTypeToFloat();
+       return convertOutputDataTypeToFloat();
 }
 
-std::pair<std::string, bool> Inference::GetSupportedInferenceBackend(int backend)
+std::pair<std::string, bool> Inference::getSupportedInferenceBackend(int backend)
 {
        return mSupportedInferenceBackend[backend];
 }
 
-int Inference::GetClassficationResults(ImageClassificationResults *results)
+int Inference::getClassficationResults(ImageClassificationResults *results)
 {
        // Will contain top N results in ascending order.
        std::vector<std::pair<float, int> > topScore;
@@ -1133,7 +1133,7 @@ int Inference::GetClassficationResults(ImageClassificationResults *results)
        return MEDIA_VISION_ERROR_NONE;
 }
 
-int Inference::GetObjectDetectionResults(ObjectDetectionResults *results)
+int Inference::getObjectDetectionResults(ObjectDetectionResults *results)
 {
        if (mMetadata.GetOutputMeta().IsParsed()) {
                OutputMetadata &outputMeta = mMetadata.GetOutputMeta();
@@ -1307,7 +1307,7 @@ int Inference::GetObjectDetectionResults(ObjectDetectionResults *results)
        return MEDIA_VISION_ERROR_NONE;
 }
 
-int Inference::GetFaceDetectionResults(FaceDetectionResults *results)
+int Inference::getFaceDetectionResults(FaceDetectionResults *results)
 {
        if (mMetadata.GetOutputMeta().IsParsed()) {
                OutputMetadata &outputMeta = mMetadata.GetOutputMeta();
@@ -1449,7 +1449,7 @@ int Inference::GetFaceDetectionResults(FaceDetectionResults *results)
        return MEDIA_VISION_ERROR_NONE;
 }
 
-int Inference::GetFacialLandMarkDetectionResults(FacialLandMarkDetectionResults *results)
+int Inference::getFacialLandMarkDetectionResults(FacialLandMarkDetectionResults *results)
 {
        LOGI("ENTER");
 
@@ -1549,7 +1549,7 @@ int Inference::GetFacialLandMarkDetectionResults(FacialLandMarkDetectionResults
        return MEDIA_VISION_ERROR_NONE;
 }
 
-int Inference::GetPoseLandmarkDetectionResults(std::unique_ptr<mv_inference_pose_s> &detectionResults, int width,
+int Inference::getPoseLandmarkDetectionResults(std::unique_ptr<mv_inference_pose_s> &detectionResults, int width,
                                                                                           int height)
 {
        LOGI("ENTER");
index 734237c..aa71757 100644 (file)
@@ -30,7 +30,7 @@ mv_engine_config_h mv_inference_get_engine_config(mv_inference_h infer)
 {
        Inference *pInfer = static_cast<Inference *>(infer);
 
-       return pInfer->GetEngineConfig();
+       return pInfer->getEngineConfig();
 }
 
 int mv_inference_create_open(mv_inference_h *infer)
@@ -107,7 +107,7 @@ static int configure_tensor_info_from_meta_file(Inference *pInfer, mv_engine_con
                goto release_model_meta_file_path;
        }
 
-       ret = pInfer->ParseMetadata(std::string(modelMetaFilePath));
+       ret = pInfer->parseMetadata(std::string(modelMetaFilePath));
        if (ret != MEDIA_VISION_ERROR_NONE) {
                LOGE("Fail to ParseMetadata");
        }
@@ -169,7 +169,7 @@ static int configure_model_open(Inference *pInfer, mv_engine_config_h engine_con
                goto release_model_user_file_path;
        }
 
-       if (IsConfigFilePathRequired(pInfer->GetTargetType(), backendType)) {
+       if (IsConfigFilePathRequired(pInfer->getTargetType(), backendType)) {
                if (access(modelConfigFilePath, F_OK)) {
                        LOGE("modelConfigFilePath in [%s] ", modelConfigFilePath);
                        ret = MEDIA_VISION_ERROR_INVALID_PATH;
@@ -185,7 +185,7 @@ static int configure_model_open(Inference *pInfer, mv_engine_config_h engine_con
                goto release_model_user_file_path;
        }
 
-       pInfer->ConfigureModelFiles(std::string(modelConfigFilePath), std::string(modelWeightFilePath),
+       pInfer->configureModelFiles(std::string(modelConfigFilePath), std::string(modelWeightFilePath),
                                                                std::string(modelUserFilePath));
 
 release_model_user_file_path:
@@ -254,7 +254,7 @@ static int configure_input_info_open(Inference *pInfer, mv_engine_config_h engin
                goto out_of_function;
        }
 
-       pInfer->ConfigureInputInfo(tensorWidth, tensorHeight, 1, tensorCh, stdValue, meanValue, dataType,
+       pInfer->configureInputInfo(tensorWidth, tensorHeight, 1, tensorCh, stdValue, meanValue, dataType,
                                                           std::vector<std::string>(1, std::string(node_name)));
 
        free(node_name);
@@ -274,7 +274,7 @@ int mv_inference_configure_engine_open(mv_inference_h infer, mv_engine_config_h
        int backendType = 0;
        int targetTypes = 0;
 
-       pInfer->SetEngineConfig(engine_config);
+       pInfer->setEngineConfig(engine_config);
 
        int ret = mv_engine_config_get_int_attribute(engine_config, MV_INFERENCE_BACKEND_TYPE, &backendType);
        if (ret != MEDIA_VISION_ERROR_NONE) {
@@ -289,7 +289,7 @@ int mv_inference_configure_engine_open(mv_inference_h infer, mv_engine_config_h
        }
 
        // Set target device type.
-       if (pInfer->ConfigureTargetDevices(targetTypes) != MEDIA_VISION_ERROR_NONE) {
+       if (pInfer->configureTargetDevices(targetTypes) != MEDIA_VISION_ERROR_NONE) {
                LOGE("Tried to configure invalid target types.");
                goto out_of_function;
        }
@@ -297,7 +297,7 @@ int mv_inference_configure_engine_open(mv_inference_h infer, mv_engine_config_h
        // Create a inference-engine-common class object and load its corresponding library.
        // Ps. Inference engine gets a capability from a given backend by Bind call
        // so access to mBackendCapacity should be done after Bind.
-       ret = pInfer->Bind(backendType, targetTypes);
+       ret = pInfer->bind(backendType, targetTypes);
        if (ret != MEDIA_VISION_ERROR_NONE) {
                LOGE("Fail to bind a backend engine.");
                goto out_of_function;
@@ -322,7 +322,7 @@ int mv_inference_configure_output_open(mv_inference_h infer, mv_engine_config_h
                goto out_of_function;
        }
 
-       pInfer->ConfigureOutput(maxOutput);
+       pInfer->configureOutput(maxOutput);
 
 out_of_function:
        LOGI("LEAVE");
@@ -343,7 +343,7 @@ int mv_inference_configure_confidence_threshold_open(mv_inference_h infer, mv_en
                goto out_of_function;
        }
 
-       pInfer->ConfigureThreshold(threshold);
+       pInfer->configureThreshold(threshold);
 
 out_of_function:
        LOGI("LEAVE");
@@ -364,7 +364,7 @@ static int configure_post_process_info_open(Inference *pInfer, mv_engine_config_
                goto out_of_function;
        }
 
-       pInfer->ConfigureOutput(maxOutput);
+       pInfer->configureOutput(maxOutput);
 
        ret = mv_engine_config_get_double_attribute(engine_config, MV_INFERENCE_CONFIDENCE_THRESHOLD, &threshold);
        if (ret != MEDIA_VISION_ERROR_NONE) {
@@ -372,7 +372,7 @@ static int configure_post_process_info_open(Inference *pInfer, mv_engine_config_
                goto out_of_function;
        }
 
-       pInfer->ConfigureThreshold(threshold);
+       pInfer->configureThreshold(threshold);
 
 out_of_function:
        LOGI("LEAVE");
@@ -401,7 +401,7 @@ static int configure_output_info_open(Inference *pInfer, mv_engine_config_h engi
 
        std::vector<inference_engine_tensor_info> tensors_info;
 
-       pInfer->ConfigureOutputInfo(names, tensors_info);
+       pInfer->configureOutputInfo(names, tensors_info);
 
        if (node_names) {
                for (idx = 0; idx < size; ++idx)
@@ -468,7 +468,7 @@ int mv_inference_prepare_open(mv_inference_h infer)
        }
 
        // Request to load model files to a backend engine.
-       ret = pInfer->Load();
+       ret = pInfer->load();
        if (ret != MEDIA_VISION_ERROR_NONE)
                LOGE("Fail to load model files.");
 
@@ -486,7 +486,7 @@ int mv_inference_foreach_supported_engine_open(mv_inference_h infer, mv_inferenc
        std::pair<std::string, bool> backend;
 
        for (int i = 0; i < MV_INFERENCE_BACKEND_MAX; ++i) {
-               backend = pInfer->GetSupportedInferenceBackend(i);
+               backend = pInfer->getSupportedInferenceBackend(i);
                callback((backend.first).c_str(), backend.second, user_data);
        }
 
@@ -507,7 +507,7 @@ int mv_inference_image_classify_open(mv_source_h source, mv_inference_h infer, m
        if (roi != NULL)
                rects.push_back(*roi);
 
-       int ret = pInfer->Run(sources, rects);
+       int ret = pInfer->run(sources, rects);
        if (ret != MEDIA_VISION_ERROR_NONE) {
                LOGE("Fail to run inference");
                return ret;
@@ -515,7 +515,7 @@ int mv_inference_image_classify_open(mv_source_h source, mv_inference_h infer, m
 
        ImageClassificationResults classificationResults;
 
-       ret = pInfer->GetClassficationResults(&classificationResults);
+       ret = pInfer->getClassficationResults(&classificationResults);
        if (ret != MEDIA_VISION_ERROR_NONE) {
                LOGE("Fail to get inference results");
                return ret;
@@ -551,7 +551,7 @@ int mv_inference_object_detect_open(mv_source_h source, mv_inference_h infer,
        std::vector<mv_rectangle_s> rects;
 
        sources.push_back(source);
-       int ret = pInfer->Run(sources, rects);
+       int ret = pInfer->run(sources, rects);
        if (ret != MEDIA_VISION_ERROR_NONE) {
                LOGE("Fail to run inference");
                return ret;
@@ -559,7 +559,7 @@ int mv_inference_object_detect_open(mv_source_h source, mv_inference_h infer,
 
        ObjectDetectionResults objectDetectionResults;
 
-       ret = pInfer->GetObjectDetectionResults(&objectDetectionResults);
+       ret = pInfer->getObjectDetectionResults(&objectDetectionResults);
        if (ret != MEDIA_VISION_ERROR_NONE) {
                LOGE("Fail to get inference results");
                return ret;
@@ -604,7 +604,7 @@ int mv_inference_face_detect_open(mv_source_h source, mv_inference_h infer, mv_i
 
        sources.push_back(source);
 
-       int ret = pInfer->Run(sources, rects);
+       int ret = pInfer->run(sources, rects);
        if (ret != MEDIA_VISION_ERROR_NONE) {
                LOGE("Fail to run inference");
                return ret;
@@ -612,7 +612,7 @@ int mv_inference_face_detect_open(mv_source_h source, mv_inference_h infer, mv_i
 
        FaceDetectionResults faceDetectionResults;
 
-       ret = pInfer->GetFaceDetectionResults(&faceDetectionResults);
+       ret = pInfer->getFaceDetectionResults(&faceDetectionResults);
        if (ret != MEDIA_VISION_ERROR_NONE) {
                LOGE("Fail to get inference results");
                return ret;
@@ -647,7 +647,7 @@ int mv_inference_facial_landmark_detect_open(mv_source_h source, mv_inference_h
        if (roi != NULL)
                rects.push_back(*roi);
 
-       int ret = pInfer->Run(sources, rects);
+       int ret = pInfer->run(sources, rects);
        if (ret != MEDIA_VISION_ERROR_NONE) {
                LOGE("Fail to run inference");
                return ret;
@@ -655,7 +655,7 @@ int mv_inference_facial_landmark_detect_open(mv_source_h source, mv_inference_h
 
        FacialLandMarkDetectionResults facialLandMarkDetectionResults;
 
-       ret = pInfer->GetFacialLandMarkDetectionResults(&facialLandMarkDetectionResults);
+       ret = pInfer->getFacialLandMarkDetectionResults(&facialLandMarkDetectionResults);
        if (ret != MEDIA_VISION_ERROR_NONE) {
                LOGE("Fail to get inference results");
                return ret;
@@ -700,7 +700,7 @@ int mv_inference_pose_landmark_detect_open(mv_source_h source, mv_inference_h in
        if (roi != NULL)
                rects.push_back(*roi);
 
-       ret = pInfer->Run(sources, rects);
+       ret = pInfer->run(sources, rects);
        if (ret != MEDIA_VISION_ERROR_NONE) {
                LOGE("Fail to run inference");
                return ret;
@@ -708,7 +708,7 @@ int mv_inference_pose_landmark_detect_open(mv_source_h source, mv_inference_h in
 
        std::unique_ptr<mv_inference_pose_s> pose;
 
-       ret = pInfer->GetPoseLandmarkDetectionResults(pose, width, height);
+       ret = pInfer->getPoseLandmarkDetectionResults(pose, width, height);
        if (ret != MEDIA_VISION_ERROR_NONE) {
                LOGE("Fail to get inference results");
                return ret;
index d6854db..aade5d1 100644 (file)
@@ -84,7 +84,7 @@ void ObjectDetection::parseMetaFile()
 
 void ObjectDetection::configure()
 {
-       int ret = _inference->Bind(_backendType, _targetDeviceType);
+       int ret = _inference->bind(_backendType, _targetDeviceType);
        if (ret != MEDIA_VISION_ERROR_NONE)
                throw InvalidOperation("Fail to bind a backend engine.");
 }
@@ -99,10 +99,10 @@ void ObjectDetection::prepare()
        if (ret != MEDIA_VISION_ERROR_NONE)
                throw InvalidOperation("Fail to configure output tensor info from meta file.");
 
-       _inference->ConfigureModelFiles("", _modelFilePath, "");
+       _inference->configureModelFiles("", _modelFilePath, "");
 
        // Request to load model files to a backend engine.
-       ret = _inference->Load();
+       ret = _inference->load();
        if (ret != MEDIA_VISION_ERROR_NONE)
                throw InvalidOperation("Fail to load model files.");
 }
@@ -127,7 +127,7 @@ void ObjectDetection::inference(mv_source_h source)
 
        sources.push_back(source);
 
-       int ret = _inference->Run();
+       int ret = _inference->run();
        if (ret != MEDIA_VISION_ERROR_NONE)
                throw InvalidOperation("Fail to run inference");
 
@@ -136,7 +136,7 @@ void ObjectDetection::inference(mv_source_h source)
 
 void ObjectDetection::getOutputNames(vector<string> &names)
 {
-       TensorBuffer &tensor_buffer_obj = _inference->GetOutputTensorBuffer();
+       TensorBuffer &tensor_buffer_obj = _inference->getOutputTensorBuffer();
        IETensorBuffer &ie_tensor_buffer = tensor_buffer_obj.getIETensorBuffer();
 
        for (IETensorBuffer::iterator it = ie_tensor_buffer.begin(); it != ie_tensor_buffer.end(); it++)
@@ -147,7 +147,7 @@ void ObjectDetection::getOutputTensor(string &target_name, vector<float> &tensor
 {
        LOGI("ENTER");
 
-       TensorBuffer &tensor_buffer_obj = _inference->GetOutputTensorBuffer();
+       TensorBuffer &tensor_buffer_obj = _inference->getOutputTensorBuffer();
 
        inference_engine_tensor_buffer *tensor_buffer = tensor_buffer_obj.getTensorBuffer(target_name);
        if (!tensor_buffer)
index 3c5afa7..75ecd93 100644 (file)
@@ -29,7 +29,7 @@ public:
        DataAugment();
        virtual ~DataAugment();
 
-       virtual void Preprocess(std::vector<float> &in_vec, std::vector<float> &out_vec, int width, int height) = 0;
+       virtual void preprocess(std::vector<float> &in_vec, std::vector<float> &out_vec, int width, int height) = 0;
 };
 
 #endif
\ No newline at end of file
index 5175ed1..7312571 100644 (file)
@@ -28,7 +28,7 @@ public:
        DataAugmentDefault();
        ~DataAugmentDefault();
 
-       void Preprocess(std::vector<float> &in_vec, std::vector<float> &out_vec, int width, int height) final;
+       void preprocess(std::vector<float> &in_vec, std::vector<float> &out_vec, int width, int height) final;
 };
 
 #endif
\ No newline at end of file
index d7b53c7..bfe13e8 100644 (file)
@@ -28,7 +28,7 @@ public:
        DataAugmentFlip();
        ~DataAugmentFlip();
 
-       void Preprocess(std::vector<float> &in_vec, std::vector<float> &out_vec, int width, int height) final;
+       void preprocess(std::vector<float> &in_vec, std::vector<float> &out_vec, int width, int height) final;
 };
 
 #endif
\ No newline at end of file
index f727aec..ba60d7c 100644 (file)
@@ -31,7 +31,7 @@ public:
        DataAugmentRotate(unsigned int degree = 90);
        ~DataAugmentRotate();
 
-       void Preprocess(std::vector<float> &in_vec, std::vector<float> &out_vec, int width, int height) final;
+       void preprocess(std::vector<float> &in_vec, std::vector<float> &out_vec, int width, int height) final;
 };
 
 #endif
\ No newline at end of file
index 4d770ba..19384b7 100644 (file)
@@ -37,16 +37,16 @@ public:
        DataSetManager();
        virtual ~DataSetManager();
 
-       void Clear();
-       bool IsFeatureVectorDuplicated(const std::vector<float> &vec);
-       std::vector<std::vector<float> > &GetData(void);
-       std::vector<std::vector<float> > &GetLabel(void);
-       size_t GetFeaVecSize(void);
-       std::vector<unsigned int> &GetLabelIdx(void);
-
-       virtual bool IsFeatureVectorAllowed(unsigned int label_idx) = 0;
-       virtual void LoadDataSet(const std::string file_name, unsigned int new_label_cnt) = 0;
-       virtual void AddDataSet(std::vector<float> &feature_vec, const unsigned int label_idx,
+       void clear();
+       bool isFeatureVectorDuplicated(const std::vector<float> &vec);
+       std::vector<std::vector<float> > &getData(void);
+       std::vector<std::vector<float> > &getLabel(void);
+       size_t getFeaVecSize(void);
+       std::vector<unsigned int> &getLabelIdx(void);
+
+       virtual bool isFeatureVectorAllowed(unsigned int label_idx) = 0;
+       virtual void loadDataSet(const std::string file_name, unsigned int new_label_cnt) = 0;
+       virtual void addDataSet(std::vector<float> &feature_vec, const unsigned int label_idx,
                                                        const unsigned int label_cnt) = 0;
 };
 
index f63bade..50b9256 100644 (file)
@@ -41,18 +41,18 @@ public:
        FeatureVectorManager(const std::string feature_vector_file = "feature_vector_file.dat");
        virtual ~FeatureVectorManager() = default;
 
-       const std::string &GetFileName();
+       const std::string &getFileName();
 
-       static void GetVecFromImg(const std::string image_file, std::vector<float> &vec, unsigned int width,
+       static void getVecFromImg(const std::string image_file, std::vector<float> &vec, unsigned int width,
                                                          unsigned int height);
-       static void GetVecFromRGB(unsigned char *in_data, std::vector<float> &vec, unsigned int width, unsigned int height,
+       static void getVecFromRGB(unsigned char *in_data, std::vector<float> &vec, unsigned int width, unsigned int height,
                                                          size_t re_width, size_t re_height);
-       static void GetVecFromXRGB(unsigned char *in_data, std::vector<float> &vec, unsigned int in_width,
+       static void getVecFromXRGB(unsigned char *in_data, std::vector<float> &vec, unsigned int in_width,
                                                           unsigned int in_height, unsigned int re_width, unsigned int re_height);
 
-       virtual void WriteHeader(size_t feature_size, size_t label_cnt, unsigned int data_set_cnt) = 0;
-       virtual void StoreData(std::vector<std::vector<float> > &features_vec, std::vector<unsigned int> &label_index) = 0;
-       virtual void Remove() = 0;
+       virtual void writeHeader(size_t feature_size, size_t label_cnt, unsigned int data_set_cnt) = 0;
+       virtual void storeData(std::vector<std::vector<float> > &features_vec, std::vector<unsigned int> &label_index) = 0;
+       virtual void remove() = 0;
 
        static constexpr unsigned int feature_vector_signature = 0xFEA09841;
 };
index bcbe3ec..9d22148 100644 (file)
@@ -22,8 +22,8 @@
 
 namespace FaceRecogUtil
 {
-bool IsFileExist(const std::string file_path);
-bool IsImageFile(const std::string image_file);
+bool isFileExist(const std::string file_path);
+bool isImageFile(const std::string image_file);
 }
 
 #endif
\ No newline at end of file
index 1902569..c7cbecc 100644 (file)
@@ -38,20 +38,20 @@ private:
 public:
        LabelManager(std::string label_file, double decision_threshold);
        ~LabelManager();
-       void Clear();
-       float GetDecisionThreshold();
-       float GetDecisionWeight();
-       unsigned int GetLabelIndex(const std::string given_label);
-       bool IsExist(const std::string given_label);
-       unsigned int RemoveLabel(const std::string given_label);
-       int GetLabelString(std::string &label, const int idx);
-       unsigned int AddLabelToFile(std::string given_label);
-       int ImportLabel(void);
-       bool AddLabelToMap(const std::string given_label, const std::string image_file);
-       size_t GetMaxLabel(const std::string label_file);
-       size_t GetMaxLabel();
-       std::string GetLabelFromAnswer(const std::vector<float> &result);
-       void Remove();
+       void clear();
+       float getDecisionThreshold();
+       float getDecisionWeight();
+       unsigned int getLabelIndex(const std::string given_label);
+       bool isExist(const std::string given_label);
+       unsigned int removeLabel(const std::string given_label);
+       int getLabelString(std::string &label, const int idx);
+       unsigned int addLabelToFile(std::string given_label);
+       int importLabel(void);
+       bool addLabelToMap(const std::string given_label, const std::string image_file);
+       size_t getMaxLabel(const std::string label_file);
+       size_t getMaxLabel();
+       std::string getLabelFromAnswer(const std::vector<float> &result);
+       void removeFile();
 };
 
 #endif
index ee49b9e..3d2bbc6 100644 (file)
 #include "data_set_manager.h"
 #include "feature_vector_manager.h"
 
-typedef struct {
+struct TrainingEngineBackendInfo {
        std::vector<std::string> input_layer_names;
        std::vector<std::string> output_layer_names;
        std::vector<inference_engine_tensor_info> input_tensor_info;
        std::vector<inference_engine_tensor_info> output_tensor_info;
        training_engine_optimizer_property optimizer_property;
        training_engine_compile_property compile_property;
-} TrainingEngineBackendInfo;
+};
 
 class TrainingModel
 {
 private:
-       virtual void SaveModel(const std::string file_path) = 0;
-       virtual void RemoveModel(const std::string file_path) = 0;
+       virtual void saveModel(const std::string file_path) = 0;
+       virtual void removeModel(const std::string file_path) = 0;
 
 protected:
        std::unique_ptr<TrainingEngineInterface::Common::TrainingEngineCommon> _training;
@@ -54,15 +54,15 @@ public:
                                  const std::vector<size_t> input_tensor_shape, const std::string internal_model_file);
        virtual ~TrainingModel();
 
-       void ApplyDataSet(std::unique_ptr<DataSetManager> &data_set);
-       void ClearDataSet(std::unique_ptr<DataSetManager> &data_set);
-       void Compile();
-       void Train();
-       void RemoveModel();
+       void applyDataSet(std::unique_ptr<DataSetManager> &data_set);
+       void clearDataSet(std::unique_ptr<DataSetManager> &data_set);
+       void compile();
+       void train();
+       void removeModel();
        void getWeights(float **weights, size_t *size, std::string name);
 
-       virtual void ConfigureModel(int num_of_class) = 0;
-       virtual TrainingEngineBackendInfo &GetTrainingEngineInfo() = 0;
+       virtual void configureModel(int num_of_class) = 0;
+       virtual TrainingEngineBackendInfo &getTrainingEngineInfo() = 0;
 };
 
 #endif
\ No newline at end of file
index 26e7c98..cedb039 100644 (file)
@@ -24,7 +24,7 @@ DataAugmentDefault::DataAugmentDefault() : DataAugment()
 DataAugmentDefault::~DataAugmentDefault()
 {}
 
-void DataAugmentDefault::Preprocess(vector<float> &in_vec, vector<float> &out_vec, int width, int height)
+void DataAugmentDefault::preprocess(vector<float> &in_vec, vector<float> &out_vec, int width, int height)
 {
        cv::Mat cvSrc = cv::Mat(cv::Size(width, height), CV_32FC3, in_vec.data()).clone();
 
index 381751b..f210f64 100644 (file)
@@ -24,7 +24,7 @@ DataAugmentFlip::DataAugmentFlip() : DataAugment()
 DataAugmentFlip::~DataAugmentFlip()
 {}
 
-void DataAugmentFlip::Preprocess(vector<float> &in_vec, vector<float> &out_vec, int width, int height)
+void DataAugmentFlip::preprocess(vector<float> &in_vec, vector<float> &out_vec, int width, int height)
 {
        cv::Mat cvSrc = cv::Mat(cv::Size(width, height), CV_32FC3, in_vec.data()).clone();
 
index 2d82a5d..6ffc224 100644 (file)
@@ -26,7 +26,7 @@ DataAugmentRotate::DataAugmentRotate(unsigned int degree) : _degree(degree)
 DataAugmentRotate::~DataAugmentRotate()
 {}
 
-void DataAugmentRotate::Preprocess(vector<float> &in_vec, vector<float> &out_vec, int width, int height)
+void DataAugmentRotate::preprocess(vector<float> &in_vec, vector<float> &out_vec, int width, int height)
 {
        cv::Mat cvSrc = cv::Mat(cv::Size(width, height), CV_32FC3, in_vec.data()).clone();
 
index 079eb0d..ed69fbb 100644 (file)
@@ -23,10 +23,10 @@ DataSetManager::DataSetManager() : _data(), _labels(), _label_index(), _feature_
 
 DataSetManager::~DataSetManager()
 {
-       Clear();
+       clear();
 }
 
-void DataSetManager::Clear()
+void DataSetManager::clear()
 {
        for (auto &data : _data)
                data.clear();
@@ -41,7 +41,7 @@ void DataSetManager::Clear()
        _fv_cnt_per_label.clear();
 }
 
-bool DataSetManager::IsFeatureVectorDuplicated(const vector<float> &vec)
+bool DataSetManager::isFeatureVectorDuplicated(const vector<float> &vec)
 {
        if (_data.empty())
                return false;
@@ -53,22 +53,22 @@ bool DataSetManager::IsFeatureVectorDuplicated(const vector<float> &vec)
        return false;
 }
 
-vector<vector<float> > &DataSetManager::GetData(void)
+vector<vector<float> > &DataSetManager::getData(void)
 {
        return _data;
 }
 
-vector<vector<float> > &DataSetManager::GetLabel(void)
+vector<vector<float> > &DataSetManager::getLabel(void)
 {
        return _labels;
 }
 
-size_t DataSetManager::GetFeaVecSize(void)
+size_t DataSetManager::getFeaVecSize(void)
 {
        return _feature_vector_size;
 }
 
-vector<unsigned int> &DataSetManager::GetLabelIdx(void)
+vector<unsigned int> &DataSetManager::getLabelIdx(void)
 {
        return _label_index;
 }
\ No newline at end of file
index 4de8a12..bddeb47 100644 (file)
@@ -26,17 +26,17 @@ using namespace mediavision::machine_learning::exception;
 FeatureVectorManager::FeatureVectorManager(const string feature_vector_file) : _feature_vector_file(feature_vector_file)
 {}
 
-const string &FeatureVectorManager::GetFileName()
+const string &FeatureVectorManager::getFileName()
 {
        return _feature_vector_file;
 }
 
-void FeatureVectorManager::GetVecFromImg(const string image_file, vector<float> &vec, unsigned int width,
+void FeatureVectorManager::getVecFromImg(const string image_file, vector<float> &vec, unsigned int width,
                                                                                 unsigned int height)
 {
        cv::Mat src, dst;
 
-       if (!FaceRecogUtil::IsImageFile(image_file))
+       if (!FaceRecogUtil::isImageFile(image_file))
                throw InvalidOperation("Invalid image file.");
 
        src = cv::imread(image_file);
@@ -62,7 +62,7 @@ void FeatureVectorManager::GetVecFromImg(const string image_file, vector<float>
        vec.assign((float *) dst.data, (float *) dst.data + dst.total() * dst.channels());
 }
 
-void FeatureVectorManager::GetVecFromRGB(unsigned char *in_data, vector<float> &vec, unsigned int width,
+void FeatureVectorManager::getVecFromRGB(unsigned char *in_data, vector<float> &vec, unsigned int width,
                                                                                 unsigned int height, size_t re_width, size_t re_height)
 {
        cv::Mat cvSrc = cv::Mat(cv::Size(width, height), CV_MAKETYPE(CV_8U, 3), in_data).clone();
@@ -84,7 +84,7 @@ void FeatureVectorManager::GetVecFromRGB(unsigned char *in_data, vector<float> &
        vec.assign((float *) dst.data, (float *) dst.data + dst.total() * dst.channels());
 }
 
-void FeatureVectorManager::GetVecFromXRGB(unsigned char *in_data, vector<float> &vec, unsigned int in_width,
+void FeatureVectorManager::getVecFromXRGB(unsigned char *in_data, vector<float> &vec, unsigned int in_width,
                                                                                  unsigned int in_height, unsigned int re_width, unsigned int re_height)
 {
        cv::Mat argb(cv::Size(in_width, in_height), CV_8UC4, in_data);
index 482af4b..2e9f230 100644 (file)
@@ -18,7 +18,7 @@
 
 namespace FaceRecogUtil
 {
-bool IsFileExist(const std::string file_path)
+bool isFileExist(const std::string file_path)
 {
        struct stat fileStat;
 
@@ -31,7 +31,7 @@ bool IsFileExist(const std::string file_path)
        return true;
 }
 
-bool IsImageFile(const std::string image_file)
+bool isImageFile(const std::string image_file)
 {
        size_t size = image_file.size();
 
index feee3bb..3366315 100644 (file)
@@ -34,22 +34,22 @@ LabelManager::LabelManager(string label_file, double decision_threshold) : _labe
 LabelManager::~LabelManager()
 {}
 
-void LabelManager::Clear()
+void LabelManager::clear()
 {
        _labels_and_files.clear();
 }
 
-float LabelManager::GetDecisionThreshold()
+float LabelManager::getDecisionThreshold()
 {
        return _decision_threshold;
 }
 
-float LabelManager::GetDecisionWeight()
+float LabelManager::getDecisionWeight()
 {
        return _decision_weight;
 }
 
-unsigned int LabelManager::GetLabelIndex(const string given_label)
+unsigned int LabelManager::getLabelIndex(const string given_label)
 {
        ifstream readFile;
 
@@ -76,7 +76,7 @@ unsigned int LabelManager::GetLabelIndex(const string given_label)
        throw InvalidOperation("Label index not found.");
 }
 
-bool LabelManager::IsExist(const string given_label)
+bool LabelManager::isExist(const string given_label)
 {
        ifstream readFile;
 
@@ -102,7 +102,7 @@ bool LabelManager::IsExist(const string given_label)
        return false;
 }
 
-unsigned int LabelManager::RemoveLabel(const string given_label)
+unsigned int LabelManager::removeLabel(const string given_label)
 {
        ifstream readFile;
 
@@ -152,7 +152,7 @@ unsigned int LabelManager::RemoveLabel(const string given_label)
        return label_index;
 }
 
-int LabelManager::GetLabelString(string &label, const int idx)
+int LabelManager::getLabelString(string &label, const int idx)
 {
        ifstream readFile;
 
@@ -181,7 +181,7 @@ int LabelManager::GetLabelString(string &label, const int idx)
        return ret;
 }
 
-unsigned int LabelManager::AddLabelToFile(string given_label)
+unsigned int LabelManager::addLabelToFile(string given_label)
 {
        ofstream writeFile;
 
@@ -194,13 +194,13 @@ unsigned int LabelManager::AddLabelToFile(string given_label)
        writeFile.write(given_label.c_str(), given_label.size());
        writeFile.close();
 
-       return GetMaxLabel(_label_file);
+       return getMaxLabel(_label_file);
 }
 
-int LabelManager::ImportLabel(void)
+int LabelManager::importLabel(void)
 {
        // label count is 0 if lael file doesn't exist.
-       if (!FaceRecogUtil::IsFileExist(_label_file))
+       if (!FaceRecogUtil::isFileExist(_label_file))
                return 0;
 
        ifstream readFile;
@@ -215,7 +215,7 @@ int LabelManager::ImportLabel(void)
        string line;
 
        while (getline(readFile, line)) {
-               bool duplicated = AddLabelToMap(line, line);
+               bool duplicated = addLabelToMap(line, line);
                if (duplicated)
                        continue;
 
@@ -227,7 +227,7 @@ int LabelManager::ImportLabel(void)
        return label_cnt;
 }
 
-bool LabelManager::AddLabelToMap(const string given_label, const string image_file)
+bool LabelManager::addLabelToMap(const string given_label, const string image_file)
 {
        // Find same one if not empty. If same one exists in the map then skip.
        if (!_labels_and_files.empty()) {
@@ -241,10 +241,10 @@ bool LabelManager::AddLabelToMap(const string given_label, const string image_fi
        return false;
 }
 
-size_t LabelManager::GetMaxLabel(const string label_file)
+size_t LabelManager::getMaxLabel(const string label_file)
 {
        // label count is 0 if lael file doesn't exist.
-       if (!FaceRecogUtil::IsFileExist(label_file))
+       if (!FaceRecogUtil::isFileExist(label_file))
                return 0;
 
        ifstream readFile;
@@ -266,12 +266,12 @@ size_t LabelManager::GetMaxLabel(const string label_file)
        return label_cnt;
 }
 
-size_t LabelManager::GetMaxLabel()
+size_t LabelManager::getMaxLabel()
 {
-       return GetMaxLabel(_label_file);
+       return getMaxLabel(_label_file);
 }
 
-string LabelManager::GetLabelFromAnswer(const vector<float> &result)
+string LabelManager::getLabelFromAnswer(const vector<float> &result)
 {
        if (result.empty())
                throw InvalidParameter("result vector is empty.");
@@ -282,14 +282,14 @@ string LabelManager::GetLabelFromAnswer(const vector<float> &result)
 
        string answer_label;
 
-       int ret = GetLabelString(answer_label, answer_idx);
+       int ret = getLabelString(answer_label, answer_idx);
        if (ret)
                throw InvalidOperation("answer label not found.");
 
        return answer_label;
 }
 
-void LabelManager::Remove()
+void LabelManager::removeFile()
 {
        // Remove existing files forcely.
        int ret = ::remove(_label_file.c_str());
index 9f20fab..d89205d 100644 (file)
@@ -56,10 +56,10 @@ TrainingModel::~TrainingModel()
                _training->UnbindBackend();
 }
 
-void TrainingModel::ApplyDataSet(unique_ptr<DataSetManager> &data_set)
+void TrainingModel::applyDataSet(unique_ptr<DataSetManager> &data_set)
 {
-       auto &values = data_set->GetData();
-       auto &labels = data_set->GetLabel();
+       auto &values = data_set->getData();
+       auto &labels = data_set->getLabel();
 
        LOGD("Generating feature vectors for training");
 
@@ -80,19 +80,19 @@ void TrainingModel::ApplyDataSet(unique_ptr<DataSetManager> &data_set)
                throw InvalidOperation("Fail to set dataset to model.", ret);
 }
 
-void TrainingModel::ClearDataSet(unique_ptr<DataSetManager> &data_set)
+void TrainingModel::clearDataSet(unique_ptr<DataSetManager> &data_set)
 {
-       data_set->Clear();
+       data_set->clear();
        _training->DestroyDataset(_data_set.get());
 }
 
-void TrainingModel::Compile()
+void TrainingModel::compile()
 {
        auto optimizer = _training->CreateOptimizer(TRAINING_OPTIMIZER_TYPE_SGD);
        if (!optimizer)
                throw InvalidOperation("Fail to create a optimizer.");
 
-       int ret = _training->SetOptimizerProperty(optimizer.get(), GetTrainingEngineInfo().optimizer_property);
+       int ret = _training->SetOptimizerProperty(optimizer.get(), getTrainingEngineInfo().optimizer_property);
        if (ret != TRAINING_ENGINE_ERROR_NONE)
                throw InvalidOperation("Fail to set optimizer property.", ret);
 
@@ -100,12 +100,12 @@ void TrainingModel::Compile()
        if (ret != TRAINING_ENGINE_ERROR_NONE)
                throw InvalidOperation("Fail to add optimizer to model.", ret);
 
-       ret = _training->CompileModel(_model.get(), GetTrainingEngineInfo().compile_property);
+       ret = _training->CompileModel(_model.get(), getTrainingEngineInfo().compile_property);
        if (ret != TRAINING_ENGINE_ERROR_NONE)
                throw InvalidOperation("Fail to compile model.", ret);
 }
 
-void TrainingModel::Train()
+void TrainingModel::train()
 {
        training_engine_model_property model_property;
        int ret = _training->TrainModel(_model.get(), model_property);
@@ -113,7 +113,7 @@ void TrainingModel::Train()
                throw InvalidOperation("Fail to train model.", ret);
 
        // Save model file.
-       SaveModel(_internal_model_file);
+       saveModel(_internal_model_file);
 }
 
 void TrainingModel::getWeights(float **weights, size_t *size, std::string name)
@@ -121,7 +121,7 @@ void TrainingModel::getWeights(float **weights, size_t *size, std::string name)
        // TODO.
 }
 
-void TrainingModel::RemoveModel()
+void TrainingModel::removeModel()
 {
-       RemoveModel(_internal_model_file);
+       removeModel(_internal_model_file);
 }
\ No newline at end of file