mv_machine_learning: cleanup namespace
authorInki Dae <inki.dae@samsung.com>
Mon, 18 Jul 2022 09:30:01 +0000 (18:30 +0900)
committerInki Dae <inki.dae@samsung.com>
Wed, 20 Jul 2022 05:16:57 +0000 (14:16 +0900)
[Issue type] cleanup

Cleaned up the use of namespace for Face recognition framework
according to Tizen coding style document.

Change-Id: Ib5c8e751911c73a2d32e5ed453d3c04a51aef28c
Signed-off-by: Inki Dae <inki.dae@samsung.com>
13 files changed:
mv_machine_learning/common/include/machine_learning_exception.h
mv_machine_learning/face_recognition/include/face_recognition.h
mv_machine_learning/face_recognition/include/face_recognition_adapter.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/mv_face_recognition_open.cpp
mv_machine_learning/face_recognition/src/nntrainer_dsm.cpp
mv_machine_learning/face_recognition/src/nntrainer_fvm.cpp
mv_machine_learning/face_recognition/src/simple_shot.cpp
mv_machine_learning/training/src/data_augment_rotate.cpp
mv_machine_learning/training/src/feature_vector_manager.cpp
mv_machine_learning/training/src/label_manager.cpp
mv_machine_learning/training/src/training_model.cpp

index 05d33c9..1038c93 100644 (file)
@@ -22,9 +22,9 @@
 
 #include <mv_common.h>
 
-namespace Mediavision {
-namespace MachineLearning {
-namespace Exception {
+namespace mediavision {
+namespace machine_learning {
+namespace exception {
 
 class BaseException : public std::exception {
 private:
index f4d65a8..a239471 100644 (file)
 #include "data_augment_flip.h"
 #include "data_augment_rotate.h"
 
-namespace Mv
+namespace mediavision
 {
-namespace FaceRecognition
+namespace machine_learning
+{
+namespace face_recognition
 {
 
-namespace Status
+namespace status
 {
 enum {
        NONE = 0,
@@ -46,19 +48,18 @@ enum {
        INFERENCED,
        DELETED
 };
-} // Status
+} // status
 
-namespace Mode
+namespace mode
 {
 enum {
        REGISTER = 0,
        INFERENCE,
        DELETE
 };
-} // Mode
+} // mode
 
-} // FaceRecognition
-} // Mv
+} // face_recognition
 
 typedef struct {
        unsigned int mode;
@@ -131,4 +132,7 @@ public:
 
 };
 
+} // machine_learning
+} // mediavision
+
 #endif
\ No newline at end of file
index f5a4ad0..b4ab9fa 100644 (file)
@@ -60,6 +60,7 @@ namespace mediavision
 {
 namespace machine_learning
 {
+
 template <typename T, typename V>
 class FaceRecognitionAdapter : public mediavision::common::ITask<T, V> {
 private:
@@ -82,6 +83,7 @@ public:
        void perform();
        V& getOutput();
 };
+
 } // machine_learning
 } // mediavision
 
index 11ad1a2..13b120d 100644 (file)
 using namespace std;
 using namespace mediavision::inference;
 using namespace TrainingEngineInterface::Common;
-using namespace Mv::FaceRecognition::Status;
-using namespace Mediavision::MachineLearning::Exception;
+using namespace mediavision::machine_learning::face_recognition::status;
+using namespace mediavision::machine_learning::exception;
+
+namespace mediavision
+{
+namespace machine_learning
+{
 
 FaceRecognition::FaceRecognition() :
                _status(NONE), _internal(), _backbone(), _face_net_info(), _training_model(), _label_manager()
@@ -614,3 +619,6 @@ int FaceRecognition::GetLabel(const char **out_label)
 
        return _result;
  }
+
+} // machine_learning
+} // mediavision
\ No newline at end of file
index de0abb9..da8aeec 100644 (file)
 
 using namespace std;
 using namespace MediaVision::Common;
-using namespace Mediavision::MachineLearning::Exception;
+using namespace mediavision::machine_learning::exception;
+using namespace mediavision::machine_learning::face_recognition;
 
 namespace mediavision
 {
 namespace machine_learning
 {
+
 template <typename T, typename V>
 FaceRecognitionAdapter<T, V>::FaceRecognitionAdapter()
 {
@@ -101,7 +103,7 @@ void FaceRecognitionAdapter<T, V>::setInput(T& t)
 template <typename T, typename V>
 void FaceRecognitionAdapter<T, V>::perform()
 {
-       if (_source.mode == Mv::FaceRecognition::Mode::REGISTER) {
+       if (_source.mode == mode::REGISTER) {
                for (auto& s : _source.register_src) {
                        int ret = _face_recognition->RegisterNewFace(s.first, s.second);
                        if (ret != MEDIA_VISION_ERROR_NONE)
@@ -111,7 +113,7 @@ void FaceRecognitionAdapter<T, V>::perform()
                return;
        }
 
-       if (_source.mode == Mv::FaceRecognition::Mode::INFERENCE) {
+       if (_source.mode == mode::INFERENCE) {
                int ret = _face_recognition->RecognizeFace(_source.inference_src);
                if (ret == MEDIA_VISION_ERROR_NO_DATA)
                        throw NoData("Label not found.");
@@ -119,7 +121,7 @@ void FaceRecognitionAdapter<T, V>::perform()
                return;
        }
 
-       if (_source.mode == Mv::FaceRecognition::Mode::DELETE) {
+       if (_source.mode == mode::DELETE) {
                for (auto& l : _source.labels) {
                        int ret = _face_recognition->DeleteLabel(l);
                        if (ret != MEDIA_VISION_ERROR_NONE)
index d34b699..3dbbb67 100644 (file)
@@ -26,8 +26,8 @@
 using namespace std;
 using namespace mediavision::common;
 using namespace mediavision::machine_learning;
-using namespace Mv::FaceRecognition;
-using namespace Mediavision::MachineLearning::Exception;
+using namespace mediavision::machine_learning::face_recognition;
+using namespace mediavision::machine_learning::exception;
 
 int mv_face_recognition_create_open(mv_face_recognition_h *handle)
 {
@@ -121,7 +121,7 @@ int mv_face_recognition_register_open(mv_face_recognition_h handle, mv_source_h
                Context *context = static_cast<Context *>(handle);
                auto itask = static_cast<ITask<mv_face_recognition_input_s, mv_face_recognition_result_s> *>(context->__itasks["face_recognition"]);
 
-               mv_face_recognition_input_s input = { Mode::REGISTER };
+               mv_face_recognition_input_s input = { mode::REGISTER };
 
                input.register_src.clear();
                input.register_src.insert(make_pair(source, string(label)));
@@ -150,7 +150,7 @@ int mv_face_recognition_unregister_open(mv_face_recognition_h handle, const char
                Context *context = static_cast<Context *>(handle);
                auto itask = static_cast<ITask<mv_face_recognition_input_s, mv_face_recognition_result_s> *>(context->__itasks["face_recognition"]);
 
-               mv_face_recognition_input_s input = { Mode::DELETE };
+               mv_face_recognition_input_s input = { mode::DELETE };
 
                input.labels.clear();
                input.labels.push_back(string(label));
@@ -179,7 +179,7 @@ int mv_face_recognition_inference_open(mv_face_recognition_h handle, mv_source_h
                Context *context = static_cast<Context *>(handle);
                auto itask = static_cast<ITask<mv_face_recognition_input_s, mv_face_recognition_result_s> *>(context->__itasks["face_recognition"]);
 
-               mv_face_recognition_input_s input = { Mode::INFERENCE };
+               mv_face_recognition_input_s input = { mode::INFERENCE };
 
                input.inference_src = source;
                itask->setInput(input);
index 1a95cdf..2eedaa4 100644 (file)
@@ -22,7 +22,7 @@
 #include "nntrainer_dsm.h"
 
 using namespace std;
-using namespace Mediavision::MachineLearning::Exception;
+using namespace mediavision::machine_learning::exception;
 
 void NNTrainerDSM::PrintHeader(FeaVecHeader& fvh)
 {
index e9ffb6b..0f20e9a 100644 (file)
@@ -20,7 +20,7 @@
 #include "nntrainer_fvm.h"
 
 using namespace std;
-using namespace Mediavision::MachineLearning::Exception;
+using namespace mediavision::machine_learning::exception;
 
 NNTrainerFVM::NNTrainerFVM(const string feature_vector_file)
        : FeatureVectorManager(feature_vector_file)
index 6dd97f2..25a51ad 100644 (file)
@@ -30,7 +30,7 @@
 
 using namespace std;
 using namespace TrainingEngineInterface::Common;
-using namespace Mediavision::MachineLearning::Exception;
+using namespace mediavision::machine_learning::exception;
 
 SimpleShot::SimpleShot(const mv_inference_backend_type_e backend_type,
                                           const mv_inference_target_device_e target_type,
index 5ccb588..4b20623 100644 (file)
@@ -18,7 +18,7 @@
 #include "data_augment_rotate.h"
 
 using namespace std;
-using namespace Mediavision::MachineLearning::Exception;
+using namespace mediavision::machine_learning::exception;
 
 DataAugmentRotate::DataAugmentRotate(unsigned int degree) : _degree(degree)
 {
index 6e83e80..62d90a3 100644 (file)
@@ -21,7 +21,7 @@
 #include "feature_vector_manager.h"
 
 using namespace std;
-using namespace Mediavision::MachineLearning::Exception;
+using namespace mediavision::machine_learning::exception;
 
 FeatureVectorManager::FeatureVectorManager(const string feature_vector_file)
        : _feature_vector_file(feature_vector_file)
index b72b3d6..2f65c27 100644 (file)
@@ -21,7 +21,7 @@
 #include "label_manager.h"
 
 using namespace std;
-using namespace Mediavision::MachineLearning::Exception;
+using namespace mediavision::machine_learning::exception;
 
 LabelManager::LabelManager(string label_file, double decision_threshold) : _labels_and_files(), _label_file(label_file)
 {
index fe9183f..6737791 100644 (file)
@@ -31,7 +31,7 @@
 
 using namespace std;
 using namespace TrainingEngineInterface::Common;
-using namespace Mediavision::MachineLearning::Exception;
+using namespace mediavision::machine_learning::exception;
 
 TrainingModel::TrainingModel(const mv_inference_backend_type_e backend_type,
                                                         const mv_inference_target_device_e target_type,