mv_machine_learning: handle exception case correctly
authorInki Dae <inki.dae@samsung.com>
Fri, 15 Apr 2022 01:45:51 +0000 (10:45 +0900)
committerInki Dae <inki.dae@samsung.com>
Wed, 20 Jul 2022 05:16:40 +0000 (14:16 +0900)
[Version] 0.18.3-0
[Issue type] : bug fix

Handled an exception case correctly. In case that internal model file
doesn't exist, this patch returns MEDIA_VISION_ERROR_INVALID_PATH
so that app can check such exception case correctly.

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

index 1108235c0540db7f0ab11e07dcc47b0d0ef1e926..d4df50b2964976b90c35865919f8cf539a8255cb 100644 (file)
@@ -419,6 +419,11 @@ int FaceRecognition::RecognizeFace(vector<float>& vec, vector<float>& out_vec, u
                output_tensor_info[0].shape[0] = _label_manager->GetMaxLabel();
                _internal->UpdateLayerInfo(input_layers, output_layers, input_tensor_info, output_tensor_info);
 
+               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;
+               }
+
                // model file could be created in runtime so just return -1 if the model file doesn't exist.
                ret = _internal->Load(_config.internal_model_file_path);
                if (ret != INFERENCE_ENGINE_ERROR_NONE) {
index 3833eb9930d6d573c9aeebbd5f72bab2dc220a34..4748a1a1bf7914f779eb3bc71f10c57f23684a44 100644 (file)
@@ -1,6 +1,6 @@
 Name:        capi-media-vision
 Summary:     Media Vision library for Tizen Native API
-Version:     0.18.2
+Version:     0.18.3
 Release:     0
 Group:       Multimedia/Framework
 License:     Apache-2.0 and BSD-3-Clause