RuntimeError: Failed to allocate graph: MYRIAD device is not opened

RuntimeError: Failed to allocate graph: MYRIAD device is not opened


验证blob文件的正确性的时候【验证blob文件,文末贴上】,openvino出现了错误,对于错误,找到主要错误:

E: [ncAPI] [    675891] [python] getFirmwarePath:654	Firmware not found in: /home/shamus/anaconda3/envs/blob/lib/python3.7/site-packages/openvino/libs/usb-ma248x.mvcmd
E: [ncAPI] [    675891] [python] ncDeviceOpen:919	Can't get firmware, error: NC_ERROR
Traceback (most recent call last):
  File "/home/shamus/yuxueshan/NEW/depthai_DDSix_4/conver/check_blob_test.py", line 30, in 
    exec_net, input_blob = get_net(model_blob)
  File "/home/shamus/yuxueshan/NEW/depthai_DDSix_4/conver/check_blob_test.py", line 13, in get_net
    exec_net = ie.import_network(model_blob, device_name=device_name)
  File "ie_api.pyx", line 463, in openvino.inference_engine.ie_api.IECore.import_network
  File "ie_api.pyx", line 494, in openvino.inference_engine.ie_api.IECore.import_network
RuntimeError: Failed to allocate graph: MYRIAD device is not opened.

大体来说,就是找不到usb-ma248x.mvcmd文件,(当然前提是:myriad的库装了)
RuntimeError: Failed to allocate graph: MYRIAD device is not opened_第1张图片
解决方案:
找到文件的位置【我之前是挨个找的】

如果你的openvino安装的时候用的普通用户,位置是在usr/local/intel/openvino_2022/runtime/lib/intel64/usb-ma2x8x.mvcmd:
RuntimeError: Failed to allocate graph: MYRIAD device is not opened_第2张图片
复制文件,到你现在环境(一般都是虚拟环境下的安装的openvino库中)

~/anaconda3/envs/blob/lib/python3.7/site-packages/openvino/libsRuntimeError: Failed to allocate graph: MYRIAD device is not opened_第3张图片
然后重新运行程序:(Victory~)【当然是王者男孩发出的开心】
在这里插入图片描述
答应大家的验证blob文件正确性的代码【当然你得对应作出修改,直接复制粘贴肯定达咩的】

"""
IR--->blob
https://aistudio.baidu.com/aistudio/projectdetail/2358719
"""
from openvino.inference_engine import IECore
import numpy as np

model_blob = r'/home/shamus/yuxueshan/check.blob'


def get_net(model_blob, device_name='MYRIAD'):
    ie = IECore()
    exec_net = ie.import_network(model_blob, device_name=device_name)
    input_blob = next(iter(exec_net.input_info))
    return exec_net, input_blob


# Run inference
overlay_data = [147, 147, 246, 245, 317, 317, 396, 390, 125, 244, 152, 152, 249, 249, 321, 323, 401, 396, 130, 249, 159,
                160, 257, 257, 328, 331, 407, 406, 139, 255, 171, 172, 267, 269, 337, 340, 415, 414, 150, 264, 183, 183,
                278, 281, 348, 350, 421, 423, 161, 276, 193, 192, 287, 290, 358, 359, 428, 430, 170, 286, 196, 196, 293,
                296, 363, 363, 432, 435, 175, 291]
overlay_data = np.array(overlay_data, dtype=np.float32)
overlay_data.resize((7, 10))
overlay_data = np.dstack(
    (overlay_data, overlay_data, overlay_data))  # 单通道数据变三通道数据(action_fre*interest变为action_fre*interest*3)
overlay_data = overlay_data.transpose((2, 0, 1)) * 1  # 改变数据的shape(将action_fre*interest*3变为3*action_fre*interest)
overlay_data = overlay_data[np.newaxis, :]  # 插入一个新的维度(将三维数据3*action_fre*interest转成四维数据1*3*action_fre*interest)

exec_net, input_blob = get_net(model_blob)
res = exec_net.infer(inputs={input_blob: overlay_data})

# res = result['output']

res = np.squeeze(res)

print(res)
print(type(res))

引用:

https://aistudio.baidu.com/aistudio/projectdetail/2358719

你可能感兴趣的:(oak,python,openvino,边缘计算)