Giter VIP home page Giter VIP logo

Comments (8)

saladjay avatar saladjay commented on May 22, 2024 4

image
像这种就能成功pytorch->onnx->tensorRT,截取的区间不要是最后一个维度。同时在pytorch->onnx的过程中最好不要使用像[:,0:2,:]的操作,除了batch,最好每个维度都给出确定的数字。希望能帮到同样像导出tensorRT的人。

from ultra-light-fast-generic-face-detector-1mb.

Linzaer avatar Linzaer commented on May 22, 2024 1

@saladjay tensorRt没怎么用过,不过你说的这部分属于后处理代码部分,数学算子比较多一点,各个框架之间算子转换兼容性比较容易出问题。其实你可以在导出onnx的时候注释掉ssd.py中调用convert_locations_to_boxes()和center_form_to_corner_form()这两处,应该是第95~98行,让推理框架只负责提取特征,输出上面boxes偏移量就好,框解码部分的后处理代码可以用c++写,不是很复杂,可控速度也不慢优化程度高。而且推理框架处理这段可能效果反而不太好,不太可控。

from ultra-light-fast-generic-face-detector-1mb.

saladjay avatar saladjay commented on May 22, 2024

一般情况下,ONNX导入到TensorRT报这个错误,是因为pytorch使用了view层。但是我去看代码,没有找出view层在哪里。

from ultra-light-fast-generic-face-detector-1mb.

Linzaer avatar Linzaer commented on May 22, 2024

compute_header里有view,你可以用onnx-simplifier 生成精简onnx试下。

from ultra-light-fast-generic-face-detector-1mb.

saladjay avatar saladjay commented on May 22, 2024

image
我解决上面那个的问题,在compute_header中使用view(int(num1),num2)这种方式解决。
接下来slice操作报错了。slice对应pytorch的tensor取区间操作。我反复查看了pytorch的代码,没发现越界的问题。不知道怎么解决。

from ultra-light-fast-generic-face-detector-1mb.

saladjay avatar saladjay commented on May 22, 2024

image
image

from ultra-light-fast-generic-face-detector-1mb.

atanx avatar atanx commented on May 22, 2024

image
像这种就能成功pytorch->onnx->tensorRT,截取的区间不要是最后一个维度。同时在pytorch->onnx的过程中最好不要使用像[:,0:2,:]的操作,除了batch,最好每个维度都给出确定的数字。希望能帮到同样像导出tensorRT的人。

遇到一样的问题。

In node 76 (convert_axis): UNSUPPORTED_NODE: Assertion failed: axis >= 0 && axis < nbDims

能详细讲一下怎么转tensorrt模型吗?

from ultra-light-fast-generic-face-detector-1mb.

saladjay avatar saladjay commented on May 22, 2024

像这种就能成功pytorch->onnx->tensorRT,截取的区间不要是最后一个维度。同时在pytorch->onnx的过程中最好不要使用像[:,0:2,:]的操作,除了batch,最好每个维度都给出确定的数字。希望能帮到同样像导出tensorRT的人。

遇到一样的问题。
In node 76 (convert_axis): UNSUPPORTED_NODE: Assertion failed: axis >= 0 && axis < nbDims

能详细讲一下怎么转tensorrt模型吗?

view改flatten或者view的第一个参数强制转换为int类型

from ultra-light-fast-generic-face-detector-1mb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.