From ea00eae922b9f63c7061953d46847202436631e6 Mon Sep 17 00:00:00 2001 From: Indira Salyahova Date: Sat, 12 Feb 2022 19:12:58 +0300 Subject: [PATCH] [POT] Fix for measuring input shape when inference model with batch greater 1 in FBC (#10063) * fix: diffrent batch shape in prediction and target in ac * add calculate metric in engine True * resolve conflicts --- .../algorithms/quantization/fast_bias_correction/algorithm.py | 3 +++ tools/pot/openvino/tools/pot/api/engine.py | 1 + 2 files changed, 4 insertions(+) diff --git a/tools/pot/openvino/tools/pot/algorithms/quantization/fast_bias_correction/algorithm.py b/tools/pot/openvino/tools/pot/algorithms/quantization/fast_bias_correction/algorithm.py index 1ef020fbcd2..c084658ff6d 100755 --- a/tools/pot/openvino/tools/pot/algorithms/quantization/fast_bias_correction/algorithm.py +++ b/tools/pot/openvino/tools/pot/algorithms/quantization/fast_bias_correction/algorithm.py @@ -212,7 +212,10 @@ class FastBiasCorrection(Algorithm): if input_node.type == 'FakeQuantize': input_node = nu.get_node_input(input_node, 0) calculate_input_shape[input_node.fullname] = {'shape_node': lambda x: x.shape} + calculate_metrics = self._engine.calculate_metrics + self._engine.calculate_metrics = False _, inputs_shape = self._engine.predict(calculate_input_shape, sampler) + self._engine.calculate_metrics = calculate_metrics for node_name, shape_node in inputs_shape.items(): inputs_shape[node_name] = shape_node['shape_node'][0] if len(inputs_shape[node_name]) > 1: diff --git a/tools/pot/openvino/tools/pot/api/engine.py b/tools/pot/openvino/tools/pot/api/engine.py index c841b5453c5..97a50315c2a 100644 --- a/tools/pot/openvino/tools/pot/api/engine.py +++ b/tools/pot/openvino/tools/pot/api/engine.py @@ -24,6 +24,7 @@ class Engine(ABC): self._statistic_graph_builder = StatisticGraphBuilder() self._stat_requests_number = self.config.get('stat_requests_number', None) self._eval_requests_number = self.config.get('eval_requests_number', None) + self.calculate_metrics = True def set_model(self, model): """ Set/reset model to instance of engine class