From 95fb088f78a132b0d7549167a8ebe1543cc9a9f6 Mon Sep 17 00:00:00 2001 From: "Trawinski, Dariusz" Date: Tue, 5 Nov 2024 15:31:23 +0100 Subject: [PATCH] compatibility with model_api for modelconfig response (#95) * compatibility with model_api for modelconfig response * error handling --- mediapipe/calculators/ovms/modelapiovmsadapter.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mediapipe/calculators/ovms/modelapiovmsadapter.cc b/mediapipe/calculators/ovms/modelapiovmsadapter.cc index e7fa510c5e..a5e8d8235a 100644 --- a/mediapipe/calculators/ovms/modelapiovmsadapter.cc +++ b/mediapipe/calculators/ovms/modelapiovmsadapter.cc @@ -260,7 +260,16 @@ void OVMSInferenceAdapter::loadModel(const std::shared_ptr& mod } const ov::AnyMap* servableMetadataRtInfo; ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataInfo(servableMetadata, reinterpret_cast(&servableMetadataRtInfo))); - this->modelConfig = *servableMetadataRtInfo; + try { + if ((*servableMetadataRtInfo).count("model_info") == 0) { + this->modelConfig = ov::AnyMap{}; + } else { + this->modelConfig = (*servableMetadataRtInfo).at("model_info").as(); + } + } catch (const std::exception& e) { + LOG(INFO) << "Exception occurred while accessing model_info: " << e.what(); + this->modelConfig = ov::AnyMap{}; + } } ov::element::Type_t OVMSInferenceAdapter::getInputDatatype(const std::string& inputName) const {