[VPU] Add option to disable preprocessing check inside the model (#4616)

This commit is contained in:
Andrew Bakalin 2021-03-24 12:57:02 +03:00 committed by GitHub
parent 29873c0a1d
commit 66cca724f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 0 deletions

View File

@ -112,6 +112,7 @@ struct CompilationConfig final {
bool forcePureTensorIterator = false;
bool enableMemoryTypesAnnotation = false;
bool enableWeightsAnalysis = true;
bool checkPreprocessingInsideModel = true;
bool enableCustomReshapeParam = false;
//

View File

@ -44,6 +44,15 @@ DECLARE_VPU_CONFIG(MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION);
*/
DECLARE_VPU_CONFIG(MYRIAD_ENABLE_WEIGHTS_ANALYSIS);
/**
* @brief MyriadPlugin uses heuristic algorithm to avoid accuracy degradations.
* This algorithm tries to find the preprocessing at the beginning of the model to adjust its parameters.
* This option should be set to "NO" if preprocessing is not a part of the model and performed separately
* in order to avoid accuracy degradation.
* Default is "YES"
*/
DECLARE_VPU_CONFIG(MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL);
/**
* @brief Used to enable reshapeBeforeConvTiling pass in cases where
* user have reshape parameter "alt_width" in IR.

View File

@ -87,6 +87,11 @@ bool isScalable(const Stage& stage) {
}
bool checkGrowingOutput(const Model& model) {
const auto& env = CompileEnv::get();
if (!env.config.checkPreprocessingInsideModel) {
return false;
}
static const float SCALE_THRESHOLD = 0.125f;
for (const auto& stage : model->getStages()) {

View File

@ -68,6 +68,7 @@ IE_SUPPRESS_DEPRECATED_START
ie::MYRIAD_FORCE_PURE_TENSOR_ITERATOR,
ie::MYRIAD_DISABLE_CONVERT_STAGES,
ie::MYRIAD_ENABLE_WEIGHTS_ANALYSIS,
ie::MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL,
ie::MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION,
ie::MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM,
@ -186,6 +187,7 @@ void ParsedConfig::parse(const std::map<std::string, std::string>& config) {
setOption(_compileConfig.forcePureTensorIterator, switches, config, ie::MYRIAD_FORCE_PURE_TENSOR_ITERATOR);
setOption(_compileConfig.disableConvertStages, switches, config, ie::MYRIAD_DISABLE_CONVERT_STAGES);
setOption(_compileConfig.enableWeightsAnalysis, switches, config, ie::MYRIAD_ENABLE_WEIGHTS_ANALYSIS);
setOption(_compileConfig.checkPreprocessingInsideModel, switches, config, ie::MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL);
setOption(_compileConfig.enableEarlyEltwiseReLUFusion, switches, config, ie::MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION);
setOption(_compileConfig.enableCustomReshapeParam, switches, config, ie::MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM);