-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
- [PP] Addded ability to preprocess inputs into plugin desired format #857
- [PP] Addded ability to preprocess inputs into plugin desired format #857
Conversation
fe8d75c
to
be11fd8
Compare
be11fd8
to
7e5b7eb
Compare
for (auto& pp_result : inputs) { | ||
auto const& input_name = pp_result.first; | ||
auto & result_blob = pp_result.second; | ||
auto const& ir_input_blob = _inputs[input_name]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if result_blob
(inputs[input_name]
) and ir_input_blob
(_inputs[input_name]
) point to the one blob?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's handled in the device_specific_preproc_req
flag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not relevant any more - patch is reworked
execute(_roiBlob, outBlob, info, serial, batchSize); | ||
} | ||
void PreProcessData::execute(const Blob::Ptr& inBlob, Blob::Ptr &outBlob, const PreProcessInfo& info, bool serial, int batchSize) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: redundant line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not relevant any more - patch is reworked
if (_roiBlob == nullptr) { | ||
THROW_IE_EXCEPTION << "Input pre-processing is called without ROI blob set"; | ||
if (inBlob == nullptr) { | ||
THROW_IE_EXCEPTION << "Input pre-processing is called with null inBlob"; | ||
} | ||
|
||
batchSize = PreprocEngine::getCorrectBatchSize(batchSize, _roiBlob); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose _roiBlob
should be replaced with inBlob
everywhere in the function body (including its sub-routines).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not relevant any more - patch is reworked
auto pp_it = _preProcData.find(input_name); | ||
const bool preprocDataExists = (pp_it != _preProcData.end()); | ||
|
||
Blob::Ptr roi_blob = (preprocDataExists) ? (*pp_it).second ->getRoiBlob() : Blob::Ptr{nullptr}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does getRoiBlob
always returns non-NULL? Just from its name I would expect that this is an optional crop
pre-processing, which might not be enabled by user (for example, only color space conversion preprocessing).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think yes, if preprocDataExists
is true
, it means that preporoc engine is created for particular input and setRoiBlob
is called in SetBlob
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ilya-lavrenov is correct.
getRoiBlob
is a bad name, and now should be something like getUserBlob
. I have added a FIXME to rename it (and accompanying one seRoiBlob
)
Blob::Ptr roi_blob = (preprocDataExists) ? (*pp_it).second ->getRoiBlob() : Blob::Ptr{nullptr}; | ||
|
||
const bool device_specific_preproc_req = (ir_input_blob != result_blob); | ||
const bool user_specific_preproc_req = (roi_blob != nullptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the previous comment - I would expect that user_specific_preproc_req == preprocDataExists
. And roi_blob
is just an optional pre-processing configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
roi_blob
is not empty, if preprocDataExists
is true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not relevant any more - patch is reworked
@@ -779,6 +779,7 @@ class PreProcessData : public IPreProcessData { | |||
Blob::Ptr getRoiBlob() const override; | |||
|
|||
void execute(Blob::Ptr &outBlob, const PreProcessInfo& info, bool serial, int batchSize = -1) override; | |||
void execute(const Blob::Ptr& inBlob, Blob::Ptr &outBlob, const PreProcessInfo& info, bool serial, int batchSize = -1) override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to rename outBlob
to preprocessedBlobs
as inference requests also has some outBlobs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inBlob
to userBlob
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed outBlob
to preprocessedBlob
and _roiBlob
to _userBlob
. (though renaming of according methods is postponed)
@anton-potapov Please add usage example with explanations into |
if (device_specific_preproc_req && !preprocDataExists) { | ||
pp_it = _preProcData.emplace_hint(_preProcData.end(), input_name, CreatePreprocDataHelper()); | ||
} | ||
auto& pp = (*pp_it).second; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(*pp_it).second
-> pp_it->second
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not relevant any more - patch is reworked
@@ -779,6 +779,7 @@ class PreProcessData : public IPreProcessData { | |||
Blob::Ptr getRoiBlob() const override; | |||
|
|||
void execute(Blob::Ptr &outBlob, const PreProcessInfo& info, bool serial, int batchSize = -1) override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need a method with a single blob argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not relevant any more - patch is reworked
} | ||
auto& pp = (*pp_it).second; | ||
|
||
auto src_blob = (roi_blob) ? roi_blob : ir_input_blob; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src_blob
-> user_blob
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not relevant any more - patch is reworked
@@ -228,13 +228,29 @@ class InferRequestInternal : virtual public IInferRequestInternal { | |||
* @param serial Whether to use multiple threads to execute the step | |||
*/ | |||
void execDataPreprocessing(InferenceEngine::BlobMap& inputs, bool serial = false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why inputs
? I suppose they are outputs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed to preprocessedBlobs
|
||
Blob::Ptr roi_blob = (preprocDataExists) ? (*pp_it).second ->getRoiBlob() : Blob::Ptr{nullptr}; | ||
|
||
const bool device_specific_preproc_req = (ir_input_blob != result_blob); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to see the usage of this function when device_specific_preproc_req
is true
, because currently all plugins call this function with _inputs
and device_specific_preproc_req
is always false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not relevant any more - patch is reworked
@anton-potapov when are we going to proceed with this PR? |
7e5b7eb
to
02139a7
Compare
02139a7
to
72dc849
Compare
c9cff58
to
e8946d2
Compare
d62ba8e
to
b63d411
Compare
added |
b63d411
to
12e96c2
Compare
@ilya-lavrenov ping |
d90f60b
to
f8ca497
Compare
inference-engine/src/plugin_api/cpp_interfaces/impl/ie_infer_request_internal.hpp
Outdated
Show resolved
Hide resolved
inference-engine/src/plugin_api/cpp_interfaces/impl/ie_infer_request_internal.hpp
Outdated
Show resolved
Hide resolved
inference-engine/src/plugin_api/cpp_interfaces/impl/ie_infer_request_internal.hpp
Outdated
Show resolved
Hide resolved
inference-engine/src/plugin_api/cpp_interfaces/impl/ie_infer_request_internal.hpp
Outdated
Show resolved
Hide resolved
inference-engine/src/plugin_api/cpp_interfaces/impl/ie_infer_request_internal.hpp
Outdated
Show resolved
Hide resolved
929a08f
to
1223f07
Compare
@ilyachur @vinograd47 please, have a look as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general LGTM.
But I have a question. Do we have any plugins (excludes the template plugin) which use it?
Because I have found when added the tests for pre-processing that majority of plugins use the own code for pre-processing.
Not yet.
This is correct, test were added in advance to make sure the behaviour is not broken during the refactoring. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK to me
1223f07
to
3b97794
Compare
3fcc2e1
to
71f443f
Compare
desired format changed InferRequestInternal: - added _deviceInputs member to store plugin desired perprocessing targets - added default argument to preProcessingRequired to describe plugin specific desired preprocessing target - SetBlob and GetBlob to deal with plugin desired preprocessing targets (_deviceInputs) - added addInputPreProcessingFor helper method to avoid code duplication changed TEMPLATE plugin to use new functionality: - removed explicit presicion conversion (to use built-in one of InferRequestInternal) - _networkInputBlobs to use InferRequestInternal::_deviceInputs
71f443f
to
b974c2c
Compare
…#857) desired format changed InferRequestInternal: - added _deviceInputs member to store plugin desired perprocessing targets - added default argument to preProcessingRequired to describe plugin specific desired preprocessing target - SetBlob and GetBlob to deal with plugin desired preprocessing targets (_deviceInputs) - added addInputPreProcessingFor helper method to avoid code duplication changed TEMPLATE plugin to use new functionality: - removed explicit presicion conversion (to use built-in one of InferRequestInternal) - _networkInputBlobs to use InferRequestInternal::_deviceInputs
…#857) desired format changed InferRequestInternal: - added _deviceInputs member to store plugin desired perprocessing targets - added default argument to preProcessingRequired to describe plugin specific desired preprocessing target - SetBlob and GetBlob to deal with plugin desired preprocessing targets (_deviceInputs) - added addInputPreProcessingFor helper method to avoid code duplication changed TEMPLATE plugin to use new functionality: - removed explicit presicion conversion (to use built-in one of InferRequestInternal) - _networkInputBlobs to use InferRequestInternal::_deviceInputs
…#857) desired format changed InferRequestInternal: - added _deviceInputs member to store plugin desired perprocessing targets - added default argument to preProcessingRequired to describe plugin specific desired preprocessing target - SetBlob and GetBlob to deal with plugin desired preprocessing targets (_deviceInputs) - added addInputPreProcessingFor helper method to avoid code duplication changed TEMPLATE plugin to use new functionality: - removed explicit presicion conversion (to use built-in one of InferRequestInternal) - _networkInputBlobs to use InferRequestInternal::_deviceInputs
…#857) desired format changed InferRequestInternal: - added _deviceInputs member to store plugin desired perprocessing targets - added default argument to preProcessingRequired to describe plugin specific desired preprocessing target - SetBlob and GetBlob to deal with plugin desired preprocessing targets (_deviceInputs) - added addInputPreProcessingFor helper method to avoid code duplication changed TEMPLATE plugin to use new functionality: - removed explicit presicion conversion (to use built-in one of InferRequestInternal) - _networkInputBlobs to use InferRequestInternal::_deviceInputs
[PP] Addded ability to preprocess inputs into plugin
desired format
changed InferRequestInternal:
targets
specific desired preprocessing target
(_deviceInputs)
duplication
changed TEMPLATE plugin to use new functionality:
InferRequestInternal)