From 9aee3b7ebabc2b664c74c093d33c8a149317bb6b Mon Sep 17 00:00:00 2001 From: Tae-Young Chung Date: Wed, 8 Sep 2021 10:14:23 +0900 Subject: Skip ParseMetadata() if a metadata json file doesn't exist Change-Id: Ibfc01bd79fe300447034f7504c4573abec47223a Signed-off-by: Tae-Young Chung --- .../mv_inference/inference/src/mv_inference_open.cpp | 17 +++++++++++------ packaging/capi-media-vision.spec | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/mv_machine_learning/mv_inference/inference/src/mv_inference_open.cpp b/mv_machine_learning/mv_inference/inference/src/mv_inference_open.cpp index d41b4718..da295ab8 100644 --- a/mv_machine_learning/mv_inference/inference/src/mv_inference_open.cpp +++ b/mv_machine_learning/mv_inference/inference/src/mv_inference_open.cpp @@ -168,12 +168,6 @@ int mv_inference_configure_model_open(mv_inference_h infer, goto _ERROR_; } - if (!IsJsonFile(std::string(modelMetaFilePath))) { - ret = MEDIA_VISION_ERROR_INVALID_PATH; - LOGE("Model meta file should be json"); - goto _ERROR_; - } - ret = mv_engine_config_get_double_attribute( engine_config, MV_INFERENCE_MODEL_MEAN_VALUE, &modelMeanValue); if (ret != MEDIA_VISION_ERROR_NONE) { @@ -219,6 +213,17 @@ int mv_inference_configure_model_open(mv_inference_h infer, std::string(modelWeightFilePath), std::string(modelUserFilePath)); + if (std::string(modelMetaFilePath).empty()) { + LOGW("Skip ParseMetadata and run without Metadata"); + goto _ERROR_; + } + + if (!IsJsonFile(std::string(modelMetaFilePath))) { + ret = MEDIA_VISION_ERROR_INVALID_PATH; + LOGE("Model meta file should be json"); + goto _ERROR_; + } + ret = pInfer->ParseMetadata(std::string(modelMetaFilePath)); if (ret != MEDIA_VISION_ERROR_NONE) { LOGE("Fail to ParseMetadata"); diff --git a/packaging/capi-media-vision.spec b/packaging/capi-media-vision.spec index a6a9574d..456297f0 100644 --- a/packaging/capi-media-vision.spec +++ b/packaging/capi-media-vision.spec @@ -1,6 +1,6 @@ Name: capi-media-vision Summary: Media Vision library for Tizen Native API -Version: 0.8.15 +Version: 0.8.16 Release: 0 Group: Multimedia/Framework License: Apache-2.0 and BSD-3-Clause -- cgit v1.2.3