[IE Python Sample] Migrate hello_query_device to OV2.0 API (#9029)
This commit is contained in:
parent
33fb7d2036
commit
c41acdeaf3
@ -5,7 +5,7 @@
|
||||
import logging as log
|
||||
import sys
|
||||
|
||||
from openvino.inference_engine import IECore
|
||||
from openvino.runtime import Core
|
||||
|
||||
|
||||
def param_to_string(metric) -> str:
|
||||
@ -19,34 +19,33 @@ def param_to_string(metric) -> str:
|
||||
def main():
|
||||
log.basicConfig(format='[ %(levelname)s ] %(message)s', level=log.INFO, stream=sys.stdout)
|
||||
|
||||
# ---------------------------Initialize inference engine core----------------------------------------------------------
|
||||
log.info('Creating Inference Engine')
|
||||
ie = IECore()
|
||||
# --------------------------- Step 1. Initialize OpenVINO Runtime Core --------------------------------------------
|
||||
core = Core()
|
||||
|
||||
# ---------------------------Get metrics of available devices----------------------------------------------------------
|
||||
# --------------------------- Step 2. Get metrics of available devices --------------------------------------------
|
||||
log.info('Available devices:')
|
||||
for device in ie.available_devices:
|
||||
for device in core.available_devices:
|
||||
log.info(f'{device} :')
|
||||
log.info('\tSUPPORTED_METRICS:')
|
||||
for metric in ie.get_metric(device, 'SUPPORTED_METRICS'):
|
||||
for metric in core.get_metric(device, 'SUPPORTED_METRICS'):
|
||||
if metric not in ('SUPPORTED_METRICS', 'SUPPORTED_CONFIG_KEYS'):
|
||||
try:
|
||||
metric_val = ie.get_metric(device, metric)
|
||||
metric_val = core.get_metric(device, metric)
|
||||
except TypeError:
|
||||
metric_val = 'UNSUPPORTED TYPE'
|
||||
log.info(f'\t\t{metric}: {param_to_string(metric_val)}')
|
||||
log.info('')
|
||||
|
||||
log.info('\tSUPPORTED_CONFIG_KEYS (default values):')
|
||||
for config_key in ie.get_metric(device, 'SUPPORTED_CONFIG_KEYS'):
|
||||
for config_key in core.get_metric(device, 'SUPPORTED_CONFIG_KEYS'):
|
||||
try:
|
||||
config_val = ie.get_config(device, config_key)
|
||||
config_val = core.get_config(device, config_key)
|
||||
except TypeError:
|
||||
config_val = 'UNSUPPORTED TYPE'
|
||||
log.info(f'\t\t{config_key}: {param_to_string(config_val)}')
|
||||
log.info('')
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------------------------------------------
|
||||
return 0
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user