Fix bugs
authorTae-Young Chung <ty83.chung@samsung.com>
Thu, 10 Oct 2019 02:39:55 +0000 (11:39 +0900)
committerTae-Young Chung <ty83.chung@samsung.com>
Thu, 10 Oct 2019 02:39:58 +0000 (11:39 +0900)
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 <ty83.chung@samsung.com>
packaging/inference-engine-interface.spec
vision/inference_engine_vision_impl.cpp

index 81181914c4f64b230692350e81f3a5d2eb0136d7..06a183e9a602939535251f3f9e4f72afe9f4453f 100644 (file)
@@ -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
index cf4b32f477e96b2a6cf6e021aa7f979a32885b73..5dd57a6291dd8fff9bfc5e4f607a392492abf2fe 100644 (file)
@@ -215,12 +215,26 @@ int InferenceEngineVision::Load()
     //get type and allocate memory to mInputBuffer;
     InputAttrType attrType = static_cast<InputAttrType>(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);