Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6403 Discussions

C++ equivalent code for python in Openvino

nnain1
New Contributor I
903 Views

I have OpenVino python code as below and I am converting to c++.

exec_net, plugin, input_blob, out_blob, shape = load_ir_model(args.model, args.device,
args.plugin_dir, args.cpu_extension)
n_batch, channels, height, width = shape

image = cv2.imread(args.input_image)
img_to_display = image.copy()
in_frame = cv2.resize(image, (width, height))
in_frame = in_frame.transpose((2, 0, 1)) # Change data layout from HWC to CHW
in_frame = in_frame.reshape((n_batch, channels, height, width))

result = exec_net.infer(inputs={input_blob: in_frame})
lp_code = result[out_blob][0]

 

The rest of the code are Ok to convert to C++ except these two lines

result = exec_net.infer(inputs={input_blob: in_frame})
lp_code = result[out_blob][0]

What are c++ api equivalent for two python codes.

0 Kudos
1 Reply
Iffa_Intel
Moderator
897 Views

Greetings,

Please note that the "exec_net.infer()" and "result()" are functions created based on Python.

You need to go to these functions source and ensure it is compatible to be used with C++.

Compatible means, you probably have to convert these parts too.

 

Hope my answer helps!

Sincerely,

Iffa

 

0 Kudos
Reply