Skip to content

Commit 5c84931

Browse files
authored
AC: update filter logic to respect original launcher names (#3017)
1 parent 5cadc0a commit 5c84931

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

tools/accuracy_checker/openvino/tools/accuracy_checker/config/config_reader.py

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -622,11 +622,39 @@ def filtered(launcher, targets, args):
622622
return targets and launcher.get('device', '').lower() not in targets
623623

624624

625+
def complete_openvino_launchers(launchers, use_new_api):
626+
if use_new_api is None:
627+
return launchers
628+
orig_ov_launchers = []
629+
updated_ov_launchers = []
630+
631+
for idx, launcher in enumerate(launchers):
632+
fwk = launcher.get('framework')
633+
if fwk not in ['openvino', 'dlsdk']:
634+
continue
635+
if use_new_api:
636+
if fwk == 'openvino':
637+
orig_ov_launchers.append(idx)
638+
else:
639+
updated_ov_launchers.append(idx)
640+
else:
641+
if fwk == 'openvino':
642+
updated_ov_launchers.append(idx)
643+
else:
644+
orig_ov_launchers.append(idx)
645+
if not orig_ov_launchers:
646+
for idx in updated_ov_launchers:
647+
launchers[idx]['framework'] = 'openvino' if use_new_api else 'dlsdk'
648+
return launchers
649+
650+
625651
def filter_models(config, target_devices, args):
626652
models_after_filtration = []
627653
for model in config['models']:
628654
launchers_after_filtration = []
629655
launchers = model['launchers']
656+
if 'use_new_api' in args:
657+
launchers = complete_openvino_launchers(launchers, args['use_new_api'])
630658
for launcher in launchers:
631659
if 'device' not in launcher and target_devices:
632660
for device in target_devices:
@@ -661,6 +689,8 @@ def filter_modules(config, target_devices, args):
661689
continue
662690
module_config = evaluation['module_config']
663691
launchers = module_config['launchers']
692+
if 'use_new_api' in args:
693+
launchers = complete_openvino_launchers(launchers, args['use_new_api'])
664694
if target_devices:
665695
launchers_without_device = [launcher for launcher in launchers if 'device' not in launcher]
666696
for launcher in launchers_without_device:
@@ -856,11 +886,6 @@ def _async_evaluation_args(launcher_entry):
856886

857887
if launcher_entry['framework'].lower() not in ['dlsdk', 'openvino']:
858888
return launcher_entry
859-
if 'use_new_api' in arguments and arguments.use_new_api is not None:
860-
if launcher_entry['framework'].lower() == 'dlsdk' and arguments.use_new_api:
861-
launcher_entry['framework'] = 'openvino'
862-
elif launcher_entry['framework'].lower() == 'openvino' and not arguments.use_new_api:
863-
launcher_entry['framework'] = 'dlsdk'
864889

865890
launcher_entry.update(update_launcher_entry)
866891
_convert_models_args(launcher_entry)

0 commit comments

Comments
 (0)