Open3
OpenVINO API 2.0
demo_video_openvino2.py
import time
import numpy as np
import openvino.runtime as ov
core = ov.Core()
compiled_model = core.compile_model(
"dmhead_mask_Nx3x224x224/openvino/FP16/dmhead_mask_Nx3x224x224.xml",
"AUTO",
)
infer_request = compiled_model.create_infer_request()
data = np.ones(shape=(10,3,224,224), dtype=np.float32)
shared_tensor = ov.Tensor(data, shared_memory=True)
print(compiled_model.inputs)
print(compiled_model.outputs)
start = time.time()
infer_request.infer(inputs=[shared_tensor])
results = infer_request.get_output_tensor().data
print(results)
print(f'elapsed_time: {(time.time()-start)*1000} ms')
mo \
--framework onnx \
--input_model dmhead_mask_Nx3x224x224.onnx \
--data_type FP32 \
--output_dir dmhead_mask_Nx3x224x224/openvino/FP32 \
--model_name dmhead_mask_Nx3x224x224
mo \
--framework onnx \
--input_model dmhead_mask_Nx3x224x224.onnx \
--data_type FP16 \
--output_dir dmhead_mask_Nx3x224x224/openvino/FP16 \
--model_name dmhead_mask_Nx3x224x224
$ python demo_video_openvino2.py
[<ConstOutput: names[input] shape{?,3,224,224} type: f32>]
[<ConstOutput: names[yaw_roll_pitch] shape{?,3} type: f32>]
[[-18.210234 1.0664468 -5.9454856]
[-18.210234 1.0664468 -5.9454856]
[-18.210234 1.0664468 -5.9454856]
[-18.210234 1.0664468 -5.9454856]
[-18.210234 1.0664468 -5.9454856]
[-18.210234 1.0664468 -5.9454856]
[-18.210234 1.0664468 -5.9454856]
[-18.210234 1.0664468 -5.9454856]
[-18.210234 1.0664468 -5.9454856]
[-18.210234 1.0664468 -5.9454856]]
elapsed_time: 197.1743106842041 ms