mv_machine_learning: correct variable types and cleanup
authorInki Dae <inki.dae@samsung.com>
Fri, 13 May 2022 04:20:20 +0000 (13:20 +0900)
committerInki Dae <inki.dae@samsung.com>
Wed, 20 Jul 2022 05:16:40 +0000 (14:16 +0900)
[Version] : 0.21.3-0
[Issue type] : code cleanup

Corrected types of width and height values and dropped commeted code.

Change-Id: Ic94297e97b4ecb420675176a826a8df3febed134
Signed-off-by: Inki Dae <inki.dae@samsung.com>
mv_machine_learning/face_recognition/src/face_recognition.cpp
mv_machine_learning/training/include/feature_vector_manager.h
mv_machine_learning/training/src/feature_vector_manager.cpp
packaging/capi-media-vision.spec

index 9bb086f9cb8d3c642e00fde68f8cabdb4f833b02..a46dff65646e6ea5fca187dd3bca261e8d54c32a 100644 (file)
@@ -183,10 +183,10 @@ int FaceRecognition::GetVecFromMvSource(mv_source_h img_src, std::vector<float>&
 
        vector<model_layer_info>& input_layer_info = GetBackboneInputLayerInfo();
        // TODO. consider mutiple tensor info.
-       unsigned int re_width = input_layer_info[0].tensor_info.shape[0];
-       unsigned int re_height = input_layer_info[0].tensor_info.shape[1];
+       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 => %d x %d", width, height, re_width, re_height);
+       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);
 
@@ -501,9 +501,6 @@ int FaceRecognition::DeleteLabel(string label_name)
 
                data_set->LoadDataSet(fvm->GetFileName());
 
-               // Remove existing data file.
-               //remove(fvm->GetFileName().c_str());
-
                vector<vector<float>> feature_vectors = data_set->GetData();
                vector<unsigned int> label_idx_vectors = data_set->GetLabelIdx();
 
index 457d14ef1d9382a0e3d0b212ff41d31e4a84edb9..e6beaf56d0195232d095934e46fe579274f90383 100644 (file)
@@ -42,11 +42,14 @@ public:
 
        const std::string& GetFileName();
 
-       static void GetVecFromImg(const std::string image_file, std::vector<float>& vec, int width, int height);
-       static void GetVecFromRGB(unsigned char *in_data, std::vector<float>& vec, int width, int height,
-                                                         int re_width, int re_height);
+       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,
+                                                         size_t re_width, size_t re_height);
        static void GetVecFromXRGB(unsigned char *in_data, std::vector<float>& vec,
-                                                          int in_width, int in_height, int re_width, int re_height);
+                                                          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 one_hot_table_size, unsigned int  data_set_cnt) = 0;
        virtual void ReadHeader(FeaVecHeader& header) = 0;
index 519e662d667b886deeb2b6a62980089d9423acfd..6e83e801b1762594d23cf7440ba4253ccef83885 100644 (file)
@@ -33,7 +33,8 @@ const string& FeatureVectorManager::GetFileName()
        return _feature_vector_file;
 }
 
-void FeatureVectorManager::GetVecFromImg(const string image_file, vector<float>& vec, int width, int height)
+void FeatureVectorManager::GetVecFromImg(const string image_file, vector<float>& vec,
+                                                                                unsigned int width, unsigned int height)
 {
        cv::Mat src, dst;
 
@@ -64,7 +65,8 @@ void FeatureVectorManager::GetVecFromImg(const string image_file, vector<float>&
 }
 
 void FeatureVectorManager::GetVecFromRGB(unsigned char *in_data, vector<float>& vec,
-                                                                                int width, int height, int re_width, int re_height)
+                                                                                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();
 
@@ -86,7 +88,8 @@ void FeatureVectorManager::GetVecFromRGB(unsigned char *in_data, vector<float>&
 }
 
 void FeatureVectorManager::GetVecFromXRGB(unsigned char *in_data, vector<float>& vec,
-                                                       int in_width, int in_height, int re_width, int re_height)
+                                                       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 8f3dd9f29a97e66feb3819ac65350ffbcf4e34f6..e89c1d6fca694a88759804723c89d54165950644 100644 (file)
@@ -1,6 +1,6 @@
 Name:        capi-media-vision
 Summary:     Media Vision library for Tizen Native API
-Version:     0.21.2
+Version:     0.21.3
 Release:     0
 Group:       Multimedia/Framework
 License:     Apache-2.0 and BSD-3-Clause