2 Copyright (C) 2018-2019 Intel Corporation
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
18 from functools import partial
19 from argparse import ArgumentParser
21 from ..accuracy_checker.accuracy_checker.utils import get_path
24 class CommandLineReader:
27 parser = ArgumentParser(description='openvino.tools.calibration')
30 '-d', '--definitions',
31 help='Optional. Path to the YML file with definitions',
37 help='Required. Path to the YML file with local configuration',
43 help='Optional. Prefix path to the models and weights',
44 type=partial(get_path, is_directory=True),
45 default=pathlib.Path.cwd(),
50 help='Optional. Prefix path to the data source',
51 type=partial(get_path, is_directory=True),
52 default=pathlib.Path.cwd(),
56 '-a', '--annotations',
57 help='Optional. Prefix path to the converted annotations and datasets meta data',
58 type=partial(get_path, is_directory=True),
59 default=pathlib.Path.cwd(),
64 help='Optional. Prefix path to extensions folder',
65 type=partial(get_path, is_directory=True),
66 default=pathlib.Path.cwd(),
70 '--cpu_extensions_mode', '--cpu-extensions-mode',
71 help='Optional. specified preferable set of processor instruction for automatic searching cpu extension lib',
73 choices=['avx2', 'sse4'])
76 '-C', '--converted_models', '--converted-models',
77 help='Optional. Directory to store Model Optimizer converted models. Used for DLSDK launcher only',
78 type=partial(get_path, is_directory=True),
83 '-M', '--model_optimizer', '--model-optimizer',
84 help='Optional. Path to model optimizer caffe directory',
85 type=partial(get_path, is_directory=True),
86 # there is no default value because if user did not specify it we use specific locations
87 # defined in model_conversion.py
92 '--tf_custom_op_config_dir', '--tf-custom-op-config-dir',
93 help='Optional. Path to directory with tensorflow custom operation configuration files for model optimizer',
94 type=partial(get_path, is_directory=True),
95 # there is no default value because if user did not specify it we use specific location
96 # defined in model_conversion.py
101 '--tf_obj_detection_api_pipeline_config_path', '--tf-obj-detection-api-pipeline-config-path',
102 help='Optional. Path to directory with tensorflow object detection api pipeline configuration files for model optimizer',
103 type=partial(get_path, is_directory=True),
104 # there is no default value because if user did not specify it we use specific location
105 # defined in model_conversion.py
111 help='Optional. Progress reporter',
116 '-td', '--target_devices', '--target-devices',
117 help='Optional. Space-separated list of devices for infer',
124 '-tt', '--target_tags', '--target-tags',
125 help='Optional. Space-separated list of launcher tags for infer',
132 help='Optional. Precision to calibrate. Default value is INT8',
138 '--ignore_layer_types', '--ignore-layer-types',
139 help='Optional. Layer types list which will be skipped during quantization',
145 '--ignore_layer_types_path', '--ignore-layer-types-path',
146 help='Optional. Ignore layer types file path',
152 '--ignore_layer_names', '--ignore-layer-names',
153 help='Optional. Layer names list which will be skipped during quantization',
159 '--ignore_layer_names_path', '--ignore-layer-names-path',
160 help='Optional. Ignore layer names file path',
165 '--batch_size', '--batch-size',
166 help='Optional. Batch size value. If not specified, the batch size value is determined from IR',
171 '-th', '--threshold',
172 help='Optional. Accuracy drop of quantized model should not exceed this threshold. '
173 'Should be pointer in percents without percent sign. (1%% is default)',
179 '-ic', '--benchmark_iterations_count', '--benchmark-iterations-count',
180 help='Optional. Benchmark itertations count. (1000 is default)',
186 '-mn', '--metric_name', '--metric-name',
187 help='Optional. Metric name used during calibration',
192 '-mt', '--metric_type', '--metric-type',
193 help='Optional. Metric type used during calibration',
198 '-o', '--output_dir', '--output-dir',
199 help='Optional. Directory to store converted models. Original model directory is used if not defined',
200 type=partial(get_path, is_directory=True),
204 '-cfc', '--calibrate_fully_connected', '--calibrate-fully-connected',
205 help='Optional. FullyConnected INT8 convertion support (False is default)',