栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Windows安装openvino过程中的问题记录

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Windows安装openvino过程中的问题记录

一、Windows安装openvino参考资料:

1.windows10 64位 OpenVINO安装教程
博主的配置:
安装的vs2019版本,安装过程中遇到Q1;
openvino安装路径更换到D盘,测试过程中会遇到Q2。
2.Windows 10 系统安装 OpenVINO (2022.1.0)

二、测试时遇到的问题: 1.参考资料windows10 64位 OpenVINO安装的必要步骤中的运行推理管道验证脚本部分,出现下面错误。

Q1:‘vswhere’ 不是内部或外部命令,也不是可运行的程序或批处理文件。

'vswhere' 不是内部或外部命令,也不是可运行的程序或批处理文件。
 Build tools for Visual Studio 2015 / 2017 / 2019 cannot be found. 
 If you use Visual Studio 2017, please download and install build tools from
 https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017
 Error

原因:安装的vs2019版本
解决方法:重新安装2017版本

Q2:could not find any instance of Visual Studio.

could not find any instance of Visual Studio.
-- Configuring incomplete, errors occurred!
See also "D:/Program File/Intel/openvino_2020.3.355/deployment_tools/inference_engine/samples/cpp/CMakeFiles/CMakeOutput.log".
Error

原因: OpenVINO 安装到D盘
解决办法:把.bat 脚本中的“cd”命令全都改成“cd /d”,或者把 OpenVINO 安装到 C盘。

2.运行demo_squeezenet_download_convert_run.bat报错
 ###############|| Run Inference Engine classification sample||###############
等待 2 秒,按一个键继续 …
已复制 1 个文件。
系统找不到指定的路径。
classification_sample.exe -i F:MovidiusOpenVINO_toolkitcomputer_vision_sdk_2018.5.456deployment_toolsdemocar.png -m “C:UsersChanDocumentsIntelOpenVINOopenvino_modelsirFP32classificationsqueezenet1.1caffesqueezenet1.1.xml” -d CPU
‘classification_sample.exe’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。
Error

解决方法:

运行demo_security_barrier_camera.bat遇到同样的问题,解决方法一样。

3.运行D:Program FileIntelopenvino_2020.3.355deployment_toolsmodel_optimizer>python mo_onnx.py --input_model E:workyolov5yolov5s.onnx报错

解决方法:
pip uninstall nuimpy
pip install numpy==1.15.1

4。运行python export.py --weights yolov5s.pt --img 640 --batch 1报错

首先要修改export.py文件内的opset=10

> [ ERROR ]  Cannot infer shapes or values for node "Resize_118".
[ ERROR ]  operands could not be broadcast together with shapes (4,) (0,)
[ ERROR ]
[ ERROR ]  It can happen due to bug in custom shape infer function .
[ ERROR ]  Or because the node inputs have incorrect values/shapes.
[ ERROR ]  Or because input shapes are incorrect (embedded to the model or passed via --input_shape).
[ ERROR ]  Run Model Optimizer with --log_level=DEBUG for more information.
[ ERROR ]  Exception occurred during running replacer "REPLACEMENT_ID" (): Stopped shape/value propagation at "Resize_118" node.
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #38.

解决方法:python export.py --weights yolov5s.pt --include torchscript onnx

5.在python下运行from openvino.inference_engine import IECore,出现from .ie_api import * ImportError: DLL load failed报错

第一步:按下图添加代码

第二步:执行setupvars.bat获取path的最新结果

第三步:复制新增的环境变量信息,手动添加的系统环境变量path中

6.提示ImportError: DLL load failed while importing ie_api: 找不到指定的模块。

1.yololibsite-packagesopenvinoinference_engine_init_.py下的错误

 Traceback (most recent call last):   
  File "F:/DLproject/YOLOX-main/demo/OpenVINO/python/openvino_inference.py", line 15, in 
    from openvino.inference_engine import IECore
  File "E:ProgramDataAnaconda3envsyololibsite-packagesopenvinoinference_engine__init__.py", line 31, in 
    from .ie_api import *
ImportError: DLL load failed while importing ie_api: 找不到指定的模块。

解决方法:在__init__.py文件中的对应位置加上:os.environ[‘PATH’] = os.path.abspath(lib_path) + ‘;’ + os.environ[‘PATH’]
具体如下:

# -*- coding: utf-8 -*-
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
 
import os
import sys
 
if sys.platform == 'win32':
    # Installer, yum, pip installs openvino dlls to the different directories
    # and those paths need to be visible to the openvino modules
    #
    # If you're using a custom installation of openvino,
    # add the location of openvino dlls to your system PATH.
    #
    # looking for the libs in the pip installation path by default.
    openvino_libs = [os.path.join(os.path.dirname(__file__), '..', '..', 'openvino', 'libs')]
    # setupvars.bat script set all libs paths to OPENVINO_LIB_PATHS environment variable.
    openvino_libs_installer = os.getenv('OPENVINO_LIB_PATHS')
    if openvino_libs_installer:
        openvino_libs.extend(openvino_libs_installer.split(';'))
    for lib in openvino_libs:
        lib_path = os.path.join(os.path.dirname(__file__), lib)
        if os.path.isdir(lib_path):
            # On Windows, with Python >= 3.8, DLLs are no longer imported from the PATH.
            if (3, 8) <= sys.version_info:
                os.add_dll_directory(os.path.abspath(lib_path))
                # 加上这句
                os.environ['PATH'] = os.path.abspath(lib_path) + ';' + os.environ['PATH']
            else:
                os.environ['PATH'] = os.path.abspath(lib_path) + ';' + os.environ['PATH']
 
from .ie_api import *
 
__all__ = ['IENetwork', 'TensorDesc', 'IECore', 'Blob', 'PreProcessInfo', 'get_version']
__version__ = get_version()  # type: ignore

2.pythonpython3.7openvinoinference_engine_init_.py下的错误

问题描述:

解决方法:在环境变量中新增如下两项

7.运行mo.py文件

1.用netron查看onnx文件,查找transpose


2.点击查到的transpose,查看其对应的conv

3.点击conv,查看name


4.运行如下代码

python mo.py --input_model yolov5s.onnx -s 255 --reverse_input_channels --output Conv_156
(最后填写的是第3步的name)
8.模型推理

在https://github.com/violet17/yolov5_demo下载yolo5_demo.py文件,运行如下代码

python yolov5_demo.py -i E:workyolov5dataimagesbus.jpg -m yolov5s.xml

注:每次运行前需要先运行openvinobin下的setupvars.bat文件

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/966216.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号