专栏算法工具链地平线AI工具链获得fcos_512x512.onnx浮点模型存在问题

地平线AI工具链获得fcos_512x512.onnx浮点模型存在问题

已解决
Posion2023-02-01
80
25

用户您好,请详细描述您所遇到的问题:

  1. 问题涉及的技术领域:工具链下载模型

  2. 问题描述:在horizon_xj3_open_explorer_v2.3.3_20220727\ddk\samples\ai_toolchain\horizon_model_train_samples运行 1) pip3 install horizon_hat-1.5.5-py3-none-any.whl 2) pip3 install hemat-1.0.3-py3-none-any.whl (1error2warning)后进入tools运行python3 export_onnx.py --config ../configs/detection/fcos/fcos_efficientnetb0_mscoco.py --onnx-name focs.onnx
  3. 复现概率:必现

  4. 提供必要的问题日志:

1)中error与warning

ERROR: Command errored out with exit status 1:

command: /usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-dpfg422c/sklearn_66e940d6c97c497a85f2c23642b05718/setup.py'"'"'; __file__='"'"'/tmp/pip-install-dpfg422c/sklearn_66e940d6c97c497a85f2c23642b05718/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-svwwr7vf

cwd: /tmp/pip-install-dpfg422c/sklearn_66e940d6c97c497a85f2c23642b05718/

Complete output (18 lines):

The 'sklearn' PyPI package is deprecated, use 'scikit-learn'

rather than 'sklearn' for pip commands.

Here is how to fix this error in the main use cases:

- use 'pip install scikit-learn' rather than 'pip install sklearn'

- replace 'sklearn' by 'scikit-learn' in your pip requirements files

(requirements.txt, setup.py, setup.cfg, Pipfile, etc ...)

- if the 'sklearn' package is used by one of your dependencies,

it would be great if you take some time to track which package uses

'sklearn' instead of 'scikit-learn' and report it to their issue tracker

- as a last resort, set the environment variable

SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True to avoid this error

More information is available at

https://github.com/scikit-learn/sklearn-pypi-package

If the previous advice does not cover your use case, feel free to report it at

https://github.com/scikit-learn/sklearn-pypi-package/issues/new

----------------------------------------

WARNING: Discarding https://files.pythonhosted.org/packages/db/1e/af4e9cded5093a92e60d4ae7149a02c7427661b2db66c8ea4d34b17864a2/sklearn-0.0.post1.tar.gz#sha256=76b9ed1623775168657b86b5fe966d45752e5c87f528de6240c38923b94147c5 (from https://pypi.org/simple/sklearn/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/zipp/

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.

horizon-tc-ui 1.5.7 requires numpy==1.16.5, but you have numpy 1.19.5 which is incompatible.

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

WARNING: You are using pip version 21.3; however, version 21.3.1 is available.You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.

2)中warning

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

WARNING: You are using pip version 21.3; however, version 21.3.1 is available.

You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.

  1. 软件上是否有做自定义修改:否

算法工具链
评论2
0/1000
  • 颜值即正义
    Lv.2

    您好,请问您是否是在对应的docker中使用的呢?按照您的操作步骤,均没有问题呀,如下图所示:

    1. pip install horizon_hat-1.5.5-py3-none-any.whl

    2. pip install hemat-1.0.3-py3-none-any.whl

    3. python3 export_onnx.py --config ../configs/detection/fcos/fcos_efficientnetb0_mscoco.py --onnx-name focs.onnx

    2023-02-02
    0
    23
    • Posion回复颜值即正义:

      使用的是CPU Docker

      2023-02-02
      0
    • 颜值即正义回复Posion:

      用到这部分的功能,需要使用GPU全量docker,此外,建议您使用22年12月发布的新版XJ3工具链2.4.2,获取链接如下:https://developer.horizon.ai/forumDetail/136488103547258769

      2023-02-02
      0
    • Posion回复颜值即正义:

      试运行了openexplorer/ai_toolchain_ubuntu_gpu:v1.13.6也存在报错问题,想请问下您对应docker的python版本是多少呢

      2023-02-03
      0
    • 颜值即正义回复Posion:

      docker中对应的Python版本是Python3.6

      2023-02-03
      0
    • Posion回复颜值即正义:

      通过windows自带的PowerShell解压2.4.2的.tar.gz后出现Error exit delayed from previous errors

      2023-02-14
      0
    • 颜值即正义回复Posion:

      您好,您的问题已复现,经排查,这是由于OE包中有软连接导致的权限不足的问题,为了更好地呈现,使用软件进行可视化解读:

      这些在linux端解压是不会出现这种问题的哈,建议您使用linux环境进行开发:

      此外,建议您一种类型的问题发一个帖子哈,方便我们及时回复,也方便大家遇到类似问题时进行参考~

      2023-02-14
      0
    • Posion回复颜值即正义:

      好的,不过我在尝试2.4.2的OE包跟docker后在相同目录运行安装

      还是一样在报错。

      2023-02-15
      0
    • 颜值即正义回复Posion:

      您好,您的这个属于各种包之间存在的冲突,OE包一定和docker对应哈,这样才不会出现问题。

      2023-02-15
      0
    • Posion回复颜值即正义:

      重新确认了一下OE包跟docker是对应的,重新解压了OE包以及新建docker容器尝试运行代码还是会出现报错

      2023-02-15
      0
    • 颜值即正义回复Posion:

      和您确认一下哈,从报错看,是torch版本兼容性的问题,请问您的docker里的torch版本是多少呢?OE2.4.2对应的docker里面的torch版本是1.9.1,看报错,您的docker里torch是1.10.1

      2023-02-15
      0
    • Posion回复颜值即正义:

      查出来对应应该是1.9.1,但是在执行pip3 install horizon_hat-1.1.1+openexplore1.5.6.float-py3-none-any.whl好像会自动下载成1.10.1

      2023-02-15
      0
    • 颜值即正义回复Posion:

      您好,我这边并没有复现您的情况呀,如下图所示:

      2023-02-15
      0
    • Posion回复颜值即正义:

      如上述忽略警告后能生成一个onnx的模型,但是运行01_check.sh会出现大量警告,并且在03_build.sh转换模型时参数存在许多0.99...的情况,在04_

      01:

      03:

      请问是哪里需要修改吗,还是存在什么问题

      2023-02-16
      0
    • 颜值即正义回复Posion:

      你好,这个warning不用管哈,那些0.99几表示余弦相似度,是正常的,关于日志这块解读,可以参考我们手册的转换结果解读部分:https://developer.horizon.ai/api/v1/fileData/documents_pi/ai_toolchain_develop/horizon_ai_toolchain_user_guide/ptq_user_guide/chapter_model_conversion.html#model-conversion

      2023-02-16
      0
    • Posion回复颜值即正义:

      最后面的Threshold是0.几没关系的吗,因为这一列的参数除了第一个是127之外其他都没大于1,而且这个模型后面转换后运行单张图片的识别也识别不出来内容。

      2023-02-16
      0
    • 颜值即正义回复Posion:
      是的,Threshold是0.几是正常的哈。请问您运行的是哪个示例呢?
      2023-02-16
      0
    • Posion回复颜值即正义:

      通过上述获得的onnx模型从上至下运行

      03的内容展示如下:

      至于04_inference.sh,没有输出识别的内容以及对应的demo.jpg

      2023-02-16
      0
    • 颜值即正义回复Posion:

      您好,直接运行这个示例是没问题的,如下图所示:

      更换了模型的话,可能出现的问题点就很多了,比如预处理和后处理方式不同等原因,OE包中的这些都是参考示例哈,在此基础上进行的修改需要您投入精力去调试哈。

      2023-02-16
      0
    • 颜值即正义回复颜值即正义:

      您可以参考这篇文章进行调试:https://developer.horizon.ai/forumDetail/71036815603174578

      2023-02-16
      0
    • Posion回复颜值即正义:
      2023-02-17
      0
    • 颜值即正义回复Posion:

      您好,更换模型,是需要匹配与之对应的前后处理的,模型转换时yaml配置中均值与归一化等操作也是需要对应的,不是说您提供一个模型,我们这边就可以跑的。我们这边不承接前后处理对齐的工作哈,需要您自己去看哦~

      2023-02-17
      0
    • Posion回复颜值即正义:

      1. pip install horizon_hat-1.5.5-py3-none-any.whl

      2. pip install hemat-1.0.3-py3-none-any.whl

      3. python3 export_onnx.py --config ../configs/detection/fcos/fcos_efficientnetb0_mscoco.py --onnx-name focs.onnx

      请问您能把这三个语句运行完的fcos模型发给我对比一下吗,因为我不确定这样获取的模型是否跟OE包中\ddk\samples\ai_toolchain\model_zoo\mapper\detection\fcos_efficientnetb0的模型一致,还有就是请问您运行1.2.3后您的numpy版本是多少


      2023-02-21
      1
    • 颜值即正义回复Posion:

      运行过程如下图:

      生成的onnx获取链接如下:

      https://pan.horizon.ai/index.php/s/aadZsFrEJHsx48q

      2023-02-21
      0
  • 颜值即正义
    Lv.2
    2023-04-24
    0
    0