teng

Results 185 comments of teng

这个可能需要给官方提issues

yolo.py -> class Detect(nn.Module):

只有在导出的时候改一下就可以了,训练时不用改使用默认的就行。

nanodet与nanodet-plus的后处理部分变了,需要自己改下后处理。yolov5是比较早的版本不知道有没有什么变化,项目的转换过程参考这个:https://github.com/cmdbug/TNN_Demo/issues/1

20210423:最新版tnn好像已经支持5维可以直接导出,不用修改导出部分但需要修改后处理部分代码(未测试)。 以下为4维方式,按这种方式可以不修改后处理部分代码。 yolov5 支持v1/v2/v3 版本,v4/v5版本好像模型有改动,未测试。 首先tnn暂时不支持5维的计算,所以在模型输出部分有5维的数据需要修改: ![image](https://user-images.githubusercontent.com/19603468/103851755-6ceaeb80-50e5-11eb-9d79-194ecd18f5d6.png) 然后导出部分: ![image](https://user-images.githubusercontent.com/19603468/103851827-9efc4d80-50e5-11eb-8742-a6f59a790c95.png) 导出 onnx 后使用 onnx-simplifier 优化一下。 再使用 https://convertmodel.com 直接 onnx -> tnn 生成模型就好了。 再用 netron 打开 .tnnproto 看下对应的输出名称,并修改 .h 文件对应的值。 ![image](https://user-images.githubusercontent.com/19603468/103852139-3b265480-50e6-11eb-8288-aa870083494e.png) ![image](https://user-images.githubusercontent.com/19603468/103852158-45e0e980-50e6-11eb-9fb4-0021d1678af0.png)...

model.model[-1].export = True 写对了嘛,导出 onnx 时不应该进入你报错的这一部分啊。即:if not srlf.training: 这个 if 是不进入的。

不需要重新训练,,按原始的训练,,只有在导出的时候改成这样就可以了。