From: Tae-Young Chung Date: Thu, 10 Oct 2019 02:39:55 +0000 (+0900) Subject: Fix bugs X-Git-Tag: submit/tizen/20191010.064454~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=48f59f70379c317200b63986525e86c864ff32b7;p=platform%2Fcore%2Fmultimedia%2Finference-engine-interface.git Fix bugs 1. The number of channels should be applied while allocating memory to mInputBuffer. 2. The length of top_results should be less than its' size, not mOutputNumbers. Change-Id: I0aa01da1a4230803554ab16835966599221b7cbe Signed-off-by: Tae-Young Chung --- diff --git a/packaging/inference-engine-interface.spec b/packaging/inference-engine-interface.spec index 8118191..06a183e 100644 --- a/packaging/inference-engine-interface.spec +++ b/packaging/inference-engine-interface.spec @@ -1,7 +1,7 @@ Name: inference-engine-interface Summary: Interface of inference engines Version: 0.0.1 -Release: 7 +Release: 8 Group: Multimedia/Framework License: Apache-2.0 Source0: %{name}-%{version}.tar.gz diff --git a/vision/inference_engine_vision_impl.cpp b/vision/inference_engine_vision_impl.cpp index cf4b32f..5dd57a6 100644 --- a/vision/inference_engine_vision_impl.cpp +++ b/vision/inference_engine_vision_impl.cpp @@ -215,12 +215,26 @@ int InferenceEngineVision::Load() //get type and allocate memory to mInputBuffer; InputAttrType attrType = static_cast(mCommonEngine->GetInputLayerAttrType()); if (attrType == InputAttrUInt8) { - mMatType = CV_8UC3; - LOGI("InputType is UINT8"); + LOGI("InputType is %d ch with UINT8", mCh); + if (mCh == 1) { + mMatType = CV_8UC1; + } else if (mCh == 3) { + mMatType = CV_8UC3; + } else { + LOGE("Not supported"); + return INFERENCE_ENGINE_ERROR_NOT_SUPPORTED_FORMAT; + } } else if (attrType == InputAttrFloat32) { - mMatType = CV_32FC3; - LOGI("InputType FLOAT32"); + LOGI("InputType is %d ch with FLOAT32", mCh); + if (mCh == 1) { + mMatType = CV_32FC1; + } else if (mCh == 3) { + mMatType = CV_32FC3; + } else { + LOGE("Not supported"); + return INFERENCE_ENGINE_ERROR_NOT_SUPPORTED_FORMAT; + } } else { LOGE("Not supported"); @@ -356,7 +370,7 @@ int InferenceEngineVision::GetInferenceResult(ImageClassificationResults& result int classIdx = -1; results.number_of_classes = 0; - for (int idx = 0; idx < mOutputNumbers; ++idx) { + for (int idx = 0; idx < top_results.size(); ++idx) { if (top_results[idx].first < mThreshold) continue; LOGI("idx:%d", idx);