Skip to content

Commit 8e2aaa9

Browse files
authored
AC: properly handle NHWC layout for yolo v3 (#3021)
1 parent 35a7b54 commit 8e2aaa9

File tree

1 file changed

+4
-2
lines changed
  • tools/accuracy_checker/openvino/tools/accuracy_checker/adapters

1 file changed

+4
-2
lines changed

tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/yolo.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def process(self, raw, identifiers, frame_meta):
272272
self.select_output_blob(predictions)
273273
predictions = predictions[self.output_blob]
274274
out_precision = frame_meta[0].get('output_precision', {})
275-
out_layout = frame_meta[0].get('outpupt_layout', {})
275+
out_layout = frame_meta[0].get('output_layout', {})
276276
if self.output_blob in out_precision and predictions.dtype != out_precision[self.output_blob]:
277277
predictions = predictions.view(out_precision[self.output_blob])
278278
if self.output_blob in out_layout and out_layout[self.output_blob] == 'NHWC':
@@ -367,7 +367,7 @@ def parameters(cls):
367367
description="Preprocesses output in the original way."
368368
),
369369
'output_format': StringField(
370-
choices=['BHW', 'HWB'], optional=True, default='BHW',
370+
choices=['BHW', 'HWB'], optional=True,
371371
description="Set output layer format"
372372
),
373373
'multiple_labels': BoolField(
@@ -456,6 +456,8 @@ def process(self, raw, identifiers, frame_meta):
456456
detections = {'labels': [], 'scores': [], 'x_mins': [], 'y_mins': [], 'x_maxs': [], 'y_maxs': []}
457457
input_shape = list(meta.get('input_shape', {'data': (1, 3, 416, 416)}).values())[0]
458458
nchw_layout = input_shape[1] == 3
459+
if self.output_format is None:
460+
self.output_format = 'BHW' if nchw_layout else 'HWB'
459461
self.processor.width_normalizer = input_shape[3 if nchw_layout else 2]
460462
self.processor.height_normalizer = input_shape[2 if nchw_layout else 1]
461463
for layer_id, p in enumerate(prediction):

0 commit comments

Comments
 (0)