OpenVino start_async problem - Incorrect request_id specified

366 Views Asked by At

I am trying to run tests to check how big is the difference between sync and async detection in python with openvino-python but I am having some trouble with making async work. When I try to run function below, error from start_async says "Incorrect request_id specified".

def async_test(i):
    ie = IECore()

    net = ie.read_network(model=parameters['path_to_xml_file'], weights=parameters['path_to_bin_file'])

    exec_net = ie.load_network(network=net, device_name="CPU")

    input_image = cv2.imread(foto)

    batch = [input_image]

    input_image = preprocess_resize(batch, parameters["img_size"])

    input_image = np.moveaxis(input_image, 3, 1)

    input_layer = next(iter(net.inputs))

    for x in range(i):
        inference_res = exec_net.start_async(request_id=x, inputs={input_layer: input_image})
        inference_res.wait(0)

I tried looking around some openvino docs but couldn't find anything sensible for my application.

1

There are 1 best solutions below

0
On BEST ANSWER

So after few days of searching I have found out that you need to put num_requests argument into ie.load_network() as such:

exec_net = ie.load_network(network=net, device_name="CPU", num_requests = x)

Where x is int or more of requests you want to use.

For some reason it's not mentioned anywhere in intel docs and only found it because of some post on Intel forum.