Skip to content

Commit 035f6fe

Browse files
author
Anna Grebneva
authored
Fixed setting of NCH input layout (#3451)
1 parent f4544d7 commit 035f6fe

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/input_feeder.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
'NC': [0, 1],
4444
'CN': [1, 0],
4545
'CNH': [1, 0, 2],
46+
'NCH': [0, 1, 2],
47+
'NSH': [0, 1, 2],
4648
'N': [0]
4749
}
4850

@@ -54,7 +56,8 @@
5456
(0, 1, 4, 3, 2): 'NDCWH',
5557
(0, 1): 'NC',
5658
(1, 0): 'CN',
57-
(1, 0, 2): 'CNH'
59+
(1, 0, 2): 'CNH',
60+
(0, 1, 2): 'NCH'
5861
}
5962

6063
PRECISION_TO_DTYPE = {

tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/openvino_launcher.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,9 @@ def __init__(self, config_entry, model_name='', delayed_model_loading=False,
104104
self._num_requests = None
105105

106106
if not delayed_model_loading:
107-
self._model, self._weights = automatic_model_search(
108-
self._model_name, self.get_value_from_config('model'),
109-
self.get_value_from_config('weights'),
110-
self.get_value_from_config('_model_type')
111-
)
107+
self._model, self._weights = automatic_model_search(self._model_name, self.get_value_from_config('model'),
108+
self.get_value_from_config('weights'),
109+
self.get_value_from_config('_model_type'))
112110
self.load_network(log=not postpone_inputs_configuration, preprocessing=preprocessor)
113111
self.allow_reshape_input = self.get_value_from_config('allow_reshape_input') and self.network is not None
114112
if not postpone_inputs_configuration:
@@ -153,10 +151,7 @@ def device(self):
153151

154152
@property
155153
def inputs(self):
156-
if self.network is None:
157-
inputs = self.exec_network.inputs
158-
else:
159-
inputs = self.network.inputs
154+
inputs = self.exec_network.inputs if self.network is None else self.network.inputs
160155
return {input_info.get_node().friendly_name: input_info.get_node() for input_info in inputs}
161156

162157
@property
@@ -835,7 +830,9 @@ def _data_to_blob(self, layer_shape, data, layout): # pylint:disable=R0911,R091
835830
if len(np.squeeze(np.zeros(layer_shape))) == len(np.squeeze(np.zeros(data_shape))):
836831
return np.resize(data, layer_shape)
837832
if len(layer_shape) == 3 and len(data_shape) == 4:
838-
return np.transpose(data, layout)[0] if layout is not None else data[0]
833+
if layout is not None:
834+
return np.transpose(data[0], layout) if len(layout) == 3 else np.transpose(data, layout)[0]
835+
return data[0]
839836
if len(layer_shape) == 1:
840837
return np.resize(data, layer_shape)
841838
if (len(data_shape) == 3) and (len(layer_shape) == 2) and (data_shape[0] == 1) and (

0 commit comments

Comments
 (0)