return ConvertEngineErrorToVisionError(ret);
}
+ tensor_t inputData;
+ std::vector<int> info{1, mCh, mInputSize.height, mInputSize.width};
+ inputData.dimInfo.push_back(info);
+
+ // some plug-in (opencv) doesn't allocate memory for input while loading models
+ // But, others (tflite) allcate memory while loading.
+ // Thus, the SetInputData() will be implemented in plug-in such as OpenCV, but
+ // just leave empty in plug-in such as tflite.
+ ret = mBackend->SetInputDataBuffer(inputData);
+ if (ret != INFERENCE_ENGINE_ERROR_NONE) {
+ LOGE("Fail to SetInputData");
+ return ConvertEngineErrorToVisionError(ret);;
+ }
+
+ void *dataPtr = mBackend->GetInputDataPtr();
+ if (dataPtr == nullptr) {
+ LOGE("input data address is null");
+ std::vector<std::string>().swap(models);
+ return MEDIA_VISION_ERROR_INTERNAL;
+ }
+
//get type and allocate memory to mInputBuffer;
InputAttrType attrType = static_cast<InputAttrType>(mBackend->GetInputLayerAttrType());
if (attrType == InputAttrUInt8) {
return MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT;
}
- tensor_t inputData;
- std::vector<int> info{1, mMatType, mInputSize.height, mInputSize.width};
- inputData.dimInfo.push_back(info);
-
- // some plug-in (opencv) doesn't allocate memory for input while loading models
- // But, others (tflite) allcate memory while loading.
- // Thus, the SetInputData() will be implemented in plug-in such as OpenCV, but
- // just leave empty in plug-in such as tflite.
- ret = mBackend->SetInputDataBuffer(inputData);
- if (ret != INFERENCE_ENGINE_ERROR_NONE) {
- LOGE("Fail to SetInputData");
- return ConvertEngineErrorToVisionError(ret);;
- }
-
- void *dataPtr = mBackend->GetInputDataPtr();
- if (dataPtr == nullptr) {
- LOGE("input data address is null");
- std::vector<std::string>().swap(models);
- return MEDIA_VISION_ERROR_INTERNAL;
- }
-
mInputBuffer = cv::Mat(mInputSize.height, mInputSize.width, mMatType, dataPtr);
mCanRun = true;