迪斯卡默:我从来没有使用过openCV或openVINO,甚至没有使用过任何接近ML的东西。然而,我一直在研究神经网络(在线阅读材料),因为我必须在边缘设备上使用英特尔的openVINO。以下是官方文档中关于在openVINO中使用openCV的内容(在openCV中使用openVINO的推理引擎)。
使用->Optimize的模型优化器创建预训练的模型(创建IR文件对)使用这些IR文件
openCV's dnn.readnet() //this is where the inference engine gets set? https://docs.openvinotoolkit.org/latest/_docs_install_guides_installing_openvino_raspbian.html
我试着深入挖掘,找到了第三方的参考资料。这里采取了一种不同的方法。
->Intermediatte文件(不创建bin/xml。而是使用caffe模型文件)
->the推理引擎是用以下行显式定义的
net.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)https://www.learnopencv.com/using-openvino-with-opencv/
现在我知道要利用openCV,我们必须使用它的推理机和预先训练好的模型。我想知道这两种方法中哪一种是正确的(或首选的),如果是这样的话,我不会错过任何东西。
发布于 2019-08-09 15:00:25
可以从以下网址开始使用OpenVino:https://docs.openvinotoolkit.org/latest/_docs_install_guides_installing_openvino_windows.html
您将需要一组前提条件来运行您的示例。OpenCV是您的计算机视觉软件包,可用于图像处理。
Openvino推理要求您转换任何经过训练的模型(.caffemodel、.pb等)。转换为中间表示(.xml、.bin)文件。
要更好地了解OpenVino和样例演示,请观看视频/订阅OpenVino Youtube频道:https://www.youtube.com/channel/UCkN8KINLvP1rMkL4trkNgTg
发布于 2019-08-16 13:53:37
如果您正在使用的拓扑结构受OpenVino支持,那么最好的使用方法是openvino附带的opencv。为此,您需要
1.通过在openvino路径(C:\Program Files (x86)\IntelSWTools\ openvino \bin)中运行setupvars.bat来初始化openvino环境
2.使用模型优化器为模型生成IR文件(xml&bin)。
3.使用路径/ inference _ engine _ samples _build/中的推理引擎示例运行
如果拓扑不受支持,则可以执行您提到的其他过程。
发布于 2021-01-29 03:12:30
我遇到的最常见的问题是:
:NCS2
位于OpenVino目录中的OpenCV预构建二进制文件已经支持IE,并且也是一个选项。
请注意,神经计算棒2又名NCS2 (OpenVino IE/VPU/MYRIAD)需要FP16模型格式(float16)。另外,尽量让你的图像保持这种格式,以避免转换损失。你可以输入这些格式的图片: FP32,FP16,U8
我发现这个指南很有帮助:https://learnopencv.com/using-openvino-with-opencv/
下面是一个从https://medium.com/sclable/intel-openvino-with-opencv-f5ad03363a38获取NCS2的示例
# Load the model.
net = cv2.dnn.readNet(ARCH_FPATH, MODEL_FPATH)
# Specify target device.
net.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)
net.setPreferableTarget(cv2.dnn.DNN_TARGET_MYRIAD) # NCS 2
# Read an image.
print("Processing input image...")
img = cv2.imread(IMG_FPATH)
if img is None:
raise Exception(f'Image not found here: {IMG_FPATH}')
# Prepare input blob and perform inference
blob = cv2.dnn.blobFromImage(img, size=(672, 384), ddepth=cv2.CV_8U)
net.setInput(blob)
out = net.forward()
# Draw detected faces
for detect in out.reshape(-1, 7):
conf = float(detect[2])
xmin = int(detect[3] * frame.shape[1])
ymin = int(detect[4] * frame.shape[0])
xmax = int(detect[5] * frame.shape[1])
ymax = int(detect[6] * frame.shape[0])
if conf > CONF_THRESH:
cv2.rectangle(img, (xmin, ymin), (xmax, ymax), color=(0, 255, 0))这里有更多示例(jupyter notebook/python):https://github.com/sclable/openvino_opencv
https://stackoverflow.com/questions/57423838
复制相似问题