mv_machine_learning: use in-class initialization
authorInki Dae <inki.dae@samsung.com>
Wed, 5 Jul 2023 01:55:07 +0000 (10:55 +0900)
committerKwanghoon Son <k.son@samsung.com>
Wed, 12 Jul 2023 09:45:35 +0000 (18:45 +0900)
[Issue type] : code cleanup

Change-Id: Icc71f07575c5ec4348c6d6e9e83a9bd35b7f58d6
Signed-off-by: Inki Dae <inki.dae@samsung.com>
mv_machine_learning/face_recognition/include/face_recognition.h
mv_machine_learning/face_recognition/src/face_recognition.cpp

index 88a82b96807512c11369b6c08f5086fc9fe81045..7f2e6fd8f5bdfe1eed5a891315ac3d3a94e004e3 100644 (file)
@@ -59,29 +59,29 @@ struct FaceRecognitionInput {
  *          and raw data count.
  */
 struct FaceRecognitionResult {
-       unsigned int label_idx; /**< label index of label file. */
+       unsigned int label_idx {}; /**< label index of label file. */
        std::vector<float> raw_data; /**< raw data to each label. */
        std::vector<std::string> labels;
        std::string label; /**< label string. */
-       bool is_valid; /**< inference result is valid or not. */
+       bool is_valid {}; /**< inference result is valid or not. */
 };
 
 struct FaceRecognitionConfig {
-       training_target_type_e training_target_device_type;
-       training_backend_type_e training_engine_backend_type;
-       mv_inference_target_device_e inference_target_device_type;
-       mv_inference_backend_type_e inference_engine_backend_type;
+       training_target_type_e training_target_device_type { TRAINING_TARGET_NONE };
+       training_backend_type_e training_engine_backend_type { TRAINING_BACKEND_NONE };
+       mv_inference_target_device_e inference_target_device_type { MV_INFERENCE_TARGET_DEVICE_NONE };
+       mv_inference_backend_type_e inference_engine_backend_type { MV_INFERENCE_BACKEND_NONE };
        std::string internal_model_file_path;
        std::string label_file_path;
        std::string feature_vector_file_path;
-       double decision_threshold;
+       double decision_threshold {};
        std::vector<size_t> input_tensor_shape;
 };
 
 class FaceRecognition
 {
 private:
-       face_recognition::WorkingStatus _status;
+       face_recognition::WorkingStatus _status { face_recognition::WorkingStatus::NONE };
        std::unique_ptr<mediavision::inference::Inference> _internal;
        std::unique_ptr<mediavision::inference::Inference> _backbone;
        std::unique_ptr<TrainingModel> _training_model;
@@ -96,7 +96,7 @@ private:
        int getAnswer();
 
 public:
-       FaceRecognition();
+       FaceRecognition() = default;
        ~FaceRecognition() = default;
 
        int initialize();
index 0303f6c269d5d25261a829874f8f65266d062a52..6ed5f4ca2a383b59a4d5b02687d66fce6126f61f 100644 (file)
@@ -44,16 +44,6 @@ namespace mediavision
 {
 namespace machine_learning
 {
-FaceRecognition::FaceRecognition()
-               : _status(WorkingStatus::NONE)
-               , _internal()
-               , _backbone()
-               , _training_model()
-               , _label_manager()
-               , _config()
-               , _result()
-{}
-
 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