deprecate mean_file option in Caffe (#8707)

* deprecate mean_file option

* add deprecation warning even if error happens

* removed Suppress for now deprecated options

* review fixes

* added dot
This commit is contained in:
Svetlana Dolinina 2021-12-08 17:38:46 +03:00 committed by GitHub
parent 64367fbca2
commit 672565a8ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 10 deletions

View File

@ -63,10 +63,10 @@ Caffe*-specific parameters:
-k K Path to CustomLayersMapping.xml to register custom
layers
--mean_file MEAN_FILE, -mf MEAN_FILE
Mean image to be used for the input. Should be a
[DEPRECATED] Mean image to be used for the input. Should be a
binaryproto file
--mean_file_offsets MEAN_FILE_OFFSETS, -mo MEAN_FILE_OFFSETS
Mean image offsets to be used for the input
[DEPRECATED] Mean image offsets to be used for the input
binaryproto file. When the mean image is bigger than
the expected input, it is cropped. By default, centers
of the input image and the mean image are the same and

View File

@ -42,7 +42,7 @@ To convert a Paddle\* model:
Parameters to convert your model:
* [Framework-agnostic parameters](Converting_Model_General.md): These parameters are used to convert a model trained with any supported framework.
> **NOTE:** `--scale`, `--scale_values`, `--mean_values`, `--mean_file` are not supported in the current version of mo_paddle.
> **NOTE:** `--scale`, `--scale_values`, `--mean_values` are not supported in the current version of mo_paddle.
### Example of Converting a Paddle* Model
Below is the example command to convert yolo v3 Paddle\* network to OpenVINO IR network with Model Optimizer.

View File

@ -6,7 +6,7 @@ mo --input_model INPUT_MODEL --output_dir <OUTPUT_MODEL_DIR>
```
You need to have have write permissions for an output directory.
> **NOTE**: Some models require using additional arguments to specify conversion parameters, such as `--input_shape`, `--scale`, `--scale_values`, `--mean_values`, `--mean_file`. To learn about when you need to use these parameters, refer to [Converting a Model Using General Conversion Parameters](Converting_Model_General.md).
> **NOTE**: Some models require using additional arguments to specify conversion parameters, such as `--input_shape`, `--scale`, `--scale_values`, `--mean_values`. To learn about when you need to use these parameters, refer to [Converting a Model Using General Conversion Parameters](Converting_Model_General.md).
To adjust the conversion process, you may use general parameters defined in the [Converting a Model Using General Conversion Parameters](Converting_Model_General.md) and
Framework-specific parameters for:

View File

@ -151,7 +151,7 @@ Usually neural network models are trained with the normalized input data. This m
In the first case, the Model Optimizer generates the IR with required pre-processing layers and Inference Engine samples may be used to infer the model.
In the second case, information about mean/scale values should be provided to the Model Optimizer to embed it to the generated IR. Model Optimizer provides a number of command line parameters to specify them: `--scale`, `--scale_values`, `--mean_values`, `--mean_file`.
In the second case, information about mean/scale values should be provided to the Model Optimizer to embed it to the generated IR. Model Optimizer provides a number of command line parameters to specify them: `--scale`, `--scale_values`, `--mean_values`.
If both mean and scale values are specified, the mean is subtracted first and then scale is applied. Input values are *divided* by the scale value(s).

View File

@ -124,12 +124,14 @@ class CanonicalizePathCheckExistenceIfNeededAction(CanonicalizePathCheckExistenc
class DeprecatedCanonicalizePathCheckExistenceAction(CanonicalizePathCheckExistenceAction):
def __call__(self, parser, namespace, values, option_string=None):
super().__call__(parser, namespace, values, option_string)
dep_msg = "Use of deprecated cli option {} detected. Option use in the following releases will be fatal. ".format(
option_string)
if 'tensorflow_use_custom_operations_config' in option_string:
dep_msg += 'Please use --transformations_config cli option instead'
if 'mean_file' in option_string or 'mean_offset' in option_string:
dep_msg += 'Please use --mean_values cli option instead.'
log.error(dep_msg, extra={'is_warning': True})
super().__call__(parser, namespace, values, option_string)
def readable_file(path: str):
@ -377,7 +379,7 @@ def get_common_cli_parser(parser: argparse.ArgumentParser = None):
'the Inference Engine API in runtime may fail for such an IR.',
action='store_true', default=False)
common_group.add_argument('--keep_shape_ops',
help='The option is ignored. Expected behavior is enabled by default.',
help=argparse.SUPPRESS,
action=IgnoredAction, default=True)
common_group.add_argument('--disable_weights_compression',
help='Disable compression and store weights with original precision.',
@ -524,11 +526,13 @@ def get_caffe_cli_parser(parser: argparse.ArgumentParser = None):
'CustomLayersMapping.xml'),
action=CanonicalizePathCheckExistenceAction)
caffe_group.add_argument('--mean_file', '-mf',
help='Mean image to be used for the input. Should be a binaryproto file',
help='[DEPRECATED] ' +
'Mean image to be used for the input. Should be a binaryproto file',
default=None,
action=CanonicalizePathCheckExistenceAction)
action=DeprecatedCanonicalizePathCheckExistenceAction)
caffe_group.add_argument('--mean_file_offsets', '-mo',
help='Mean image offsets to be used for the input binaryproto file. ' +
help='[DEPRECATED] ' +
'Mean image offsets to be used for the input binaryproto file. ' +
'When the mean image is bigger than the expected input, it is cropped. By default, centers ' +
'of the input image and the mean image are the same and the mean image is cropped by ' +
'dimensions of the input image. The format to pass this option is the following: "-mo (x,y)". In this ' +