示例#1
0
def main():
    log.basicConfig(format='[ %(levelname)s ] %(message)s', level=log.INFO, stream=sys.stdout)

    # --------------------------- Step 1. Initialize OpenVINO Runtime Core --------------------------------------------
    core = Core()

    # --------------------------- Step 2. Get metrics of available devices --------------------------------------------
    log.info('Available devices:')
    for device in core.available_devices:
        log.info(f'{device} :')
        log.info('\tSUPPORTED_METRICS:')
        for metric in core.get_metric(device, 'SUPPORTED_METRICS'):
            if metric not in ('SUPPORTED_METRICS', 'SUPPORTED_CONFIG_KEYS'):
                try:
                    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 core.get_metric(device, 'SUPPORTED_CONFIG_KEYS'):
            try:
                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
示例#2
0
def test_get_config():
    ie = Core()
    conf = ie.get_config("CPU", "CPU_BIND_THREAD")
    assert conf == "YES"
# ! [compiled_model_get_ro_property]
nireq = compiled_model.get_property("OPTIMAL_NUMBER_OF_INFER_REQUESTS")
# ! [compiled_model_get_ro_property]


from openvino.inference_engine import IECore


core = IECore()
#! [core_get_metric]
full_device_name = core.get_metric("CPU", "FULL_DEVICE_NAME")
#! [core_get_metric]

#! [core_get_config]
num_streams = core.get_config("CPU", "CPU_THROUGHPUT_STREAMS")
#! [core_get_config]

#! [core_set_config]
core.set_config({"PERF_COUNT": "YES"}, "CPU")
#! [core_set_config]

net = core.read_network("sample.xml")

#! [core_load_network]
exec_network = core.load_network(net, "MULTI", {"DEVICE_PRIORITIES": "CPU, GPU",
                                                "PERFORMANCE_HINT": "THROUGHPUT",
                                                "ENFORCE_BF16": "NO"})
#! [core_load_network]

#! [executable_network_set_config]