Comments (51)
20210423:最新版tnn好像已经支持5维可以直接导出,不用修改导出部分但需要修改后处理部分代码(未测试)。
以下为4维方式,按这种方式可以不修改后处理部分代码。
yolov5 支持v1/v2/v3 版本,v4/v5版本好像模型有改动,未测试。
首先tnn暂时不支持5维的计算,所以在模型输出部分有5维的数据需要修改:
导出 onnx 后使用 onnx-simplifier 优化一下。
再使用 https://convertmodel.com 直接 onnx -> tnn 生成模型就好了。
再用 netron 打开 .tnnproto 看下对应的输出名称,并修改 .h 文件对应的值。
然后运行,搞定!
from tnn_demo.
使用您的权重文件没有任何问题,当使用自己的自己的权重文件(通过https://convertmodel.com转换,出现了一下错误。
同样的模型,转换成ncnn后可正常运行
from tnn_demo.
首先tnn暂时不支持5维的计算,所以在模型输出部分有5维的数据需要修改:
导出onnx后使用onnx-简化器优化一下。
再使用https://convertmodel.com直接onnx - > TNN生成模型就好了。再用netron:.tnnproto看下对应的输出名称,并修改.h文件对应的值。
然后运行,搞定!
谢谢大佬的解答 ,ok了。
from tnn_demo.
大佬,加我一下QQ啊:446143919
from tnn_demo.
大佬,加我一下QQ啊:446143919
做什么?
from tnn_demo.
大佬,加我一下QQ啊:446143919
做什么?
我想以后优化再请教一下大佬,还有跟着大佬在学点MNN 呢
from tnn_demo.
刚开始学,不敢瞎带 QAQ
from tnn_demo.
刚开始学,不敢瞎带QAQ
没事的,我一个人回踩更多的坑
from tnn_demo.
Why did it report this error after I modified it like this?
"yolov5-master\utils\loss.py", line 129, in call
pxy = ps[:, :2].sigmoid() * 2. - 0.5
IndexError: too many indices for tensor of dimension 1
from tnn_demo.
首先tnn暂时不支持5维的计算,所以在模型输出部分有5维的数据需要修改:
导出 onnx 后使用 onnx-simplifier 优化一下。
再使用 https://convertmodel.com 直接 onnx -> tnn 生成模型就好了。再用 netron 打开 .tnnproto 看下对应的输出名称,并修改 .h 文件对应的值。
然后运行,搞定!
我这样修改了之后,报这个错误是为什么呢?
"yolov5-master\utils\loss.py", line 129, in call
pxy = ps[:, :2].sigmoid() * 2. - 0.5
IndexError: too many indices for tensor of dimension 1
from tnn_demo.
model.model[-1].export = True
写对了嘛,导出 onnx 时不应该进入你报错的这一部分啊。即:if not srlf.training: 这个 if 是不进入的。
from tnn_demo.
写对了嘛,导出 onnx 时不应该进入你报错的这一部分啊
训练的时候报这个错
from tnn_demo.
不需要重新训练,,按原始的训练,,只有在导出的时候改成这样就可以了。
from tnn_demo.
不需要重新训练,,按原始的训练,,只有在导出的时候改成这样就可以了。
转换成tnn模型后,检测Box对不上了,是为什么呢?
from tnn_demo.
发个图片
from tnn_demo.
from tnn_demo.
看图片有部分是对的, 是不是 .h 文件里面的 layers 对应的输出没有改?就是 output, 413, 431 这3个没有改?
from tnn_demo.
改了
from tnn_demo.
怎么改的?步骤是什么?
from tnn_demo.
在netron看的outputs
from tnn_demo.
...
from tnn_demo.
找到问题了吗?
from tnn_demo.
你觉得你的回答有提供有用的信息嘛?我打的字都比你的多。。。
from tnn_demo.
先不用自己训练的模型,使用官方的模型,按上面的说明来学习下过程是不是对的。如果结果是对的再使用自己的模型,自己的模型错了请详细说明转换过程。如果官方模型都错了再认真看说明是不是哪一步错了。
from tnn_demo.
在netron看的输出name,然后修改的layers
from tnn_demo.
修改了yolo.py的5维数组,用官方的模型yolov5s.pt转成onnx,然后再用官方的tnn convert转成tnn模型,替换掉TNN_Demo的模型,修改了layers,就这样的步骤
from tnn_demo.
onnx-simplifier 呢?
from tnn_demo.
install了,用onnx-sim转换的
from tnn_demo.
试v3版本吧,v4的没试过。
from tnn_demo.
yolov5版本吗?
from tnn_demo.
我当时使用的是yolov5的v3,最近的v4不懂有没有改什么。
from tnn_demo.
v3版本现在跑不了了
from tnn_demo.
能试下yolov5 master版本转换的tnn效果吗?
from tnn_demo.
示例中的模型就是yolov5版本的。让你试v3的版本,
https://github.com/ultralytics/yolov5/releases
v4版本激活函数改成了 nn.SiLU() ,tnn不懂支不支持。
from tnn_demo.
v3.1还是之前那样的效果,有的检查box没对上,好奇怪
from tnn_demo.
netron打开tnn的模型,看下输出的名称,并且看下 .h 文件的名称,2个图发下。
from tnn_demo.
from tnn_demo.
769对应16步长的嘛?如果不懂试下对换 769 跟 788
from tnn_demo.
还是不行
from tnn_demo.
用tnn官方这个转的:
convert onnx
docker run --volume=$(pwd):/workspace -it tnn-convert:latest python3 ./converter.py onnx2tnn
/workspace/mobilenetv3-small-c7eb32fe.onnx
-optimize
-v v3.0
-align
-input_file /workspace/in.txt
-ref_file /workspace/ref.txt
from tnn_demo.
把改过的代码的截图,onns-sim结果的截图,网址转换的截图都发下。
from tnn_demo.
from tnn_demo.
onnx-sim截图呢?网址转换的截图呢????????
from tnn_demo.
onnx-sim上面有了,我们公司不能访问这个https://convertmodel.com
from tnn_demo.
我上面说明过程说的是用netron打开 .tnnproto 文件看输出名称吧,,你打开 .onnx 文件干嘛,,,
from tnn_demo.
from tnn_demo.
哪个地方发过 onnx-sim 了???
from tnn_demo.
onnx-sim就是那个onnx截图
from tnn_demo.
你这个图上的杯子相对于图片尺寸属于大目标,而大目标刚好是"output"(32步长)这个名称的输出,不管转换过程怎么名称是不会变的,所以大目标可以正确显示。但剩下的2个名称的输出属于中小目标(一个中目标 16步长的,一个小目标 8步长的)。转换过程会随着模型的转换可能会发生变化,结果不正确很有可能是这2个值没找到,导致中小目标不能显示。但到现在你完全没有提供有效信息,回答都是:好了,转换了,不对。。。
from tnn_demo.
不是吧,没有正确显示的有键盘的
from tnn_demo.
你提供的信息只能判断到这。
from tnn_demo.
Related Issues (19)
- 您好,模型转为tnn 精度下降问题 HOT 2
- where is the code of run the yolo5's tnn model and get the bbox ? HOT 4
- 很好的工作,请问自己的训练的模型怎么修改呢? HOT 11
- yolo5的模型转换需要修改一些东西,,请问nanodet需要修改的多吗? HOT 3
- 感谢代码,安卓手机跑起来了 HOT 9
- Error when deploying nanodet HOT 5
- Details about Yolov5 HOT 4
- input_cvt_param.scale and bias HOT 15
- 大神,你好,请问一下如果我想更换其他的yolov5或nanodet模型需要做什么工作? HOT 1
- 人脸特征分布图 HOT 1
- Get OpenCL command queue failed! HOT 4
- 开启gpu后,速度变快了,但是检测不到东西了 HOT 2
- Request - update to TNN 0.3 + support face landmarks model in samples HOT 1
- yolov5s v5.0模型转换TNN后运行出错 HOT 1
- 关于yolov5转换文件 HOT 4
- 关于检测类别问题 HOT 3
- 关于出现许多额外的检测框问题 HOT 1
- fdLoadFile函数如果指定读取模式std::ios::in会报错,改为std::ios::binary会好 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tnn_demo.