Skip to content

Commit d6fbc33

Browse files
authored
Merge pull request #3531 from eaidova/ea/mask_rcnn
AC: update mask rcnn support and fix onnx launcher
2 parents d643bde + 797ebc9 commit d6fbc33

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/mask_rcnn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,13 @@ def _find_output(predictions):
256256

257257
def _process_masks_pytorch(self, boxes, raw_masks, identifiers, original_image_size, classes):
258258
masks = []
259-
raw_mask_for_all_classes = np.shape(raw_masks)[1] != len(identifiers)
259+
raw_mask_for_all_classes = np.shape(raw_masks)[1] != len(identifiers) and np.ndim(raw_masks) == 4
260260
if raw_mask_for_all_classes:
261261
per_obj_raw_masks = []
262262
for cls, raw_mask in zip(classes, raw_masks):
263263
per_obj_raw_masks.append(raw_mask[cls, ...] if self.scores_out else raw_mask)
264264
else:
265-
per_obj_raw_masks = np.squeeze(raw_masks, axis=1)
265+
per_obj_raw_masks = np.squeeze(raw_masks, axis=1) if np.ndim(raw_masks) == 4 else raw_masks
266266

267267
for box, raw_cls_mask in zip(boxes, per_obj_raw_masks):
268268
mask = self.segm_postprocess(box, raw_cls_mask, *original_image_size, True, True)

tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/onnx_launcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def _create_session_via_execution_providers_api(self, model):
110110
self.device = device or 'CPU'
111111
kwargs = {}
112112
if device:
113-
kwargs['provider_options'] = {[{'device_type': self.device}]}
113+
kwargs['provider_options'] = [{'device_type': self.device}]
114114
session = onnx_rt.InferenceSession(
115115
model, providers=self.execution_providers, **kwargs)
116116

0 commit comments

Comments
 (0)