nncase icon indicating copy to clipboard operation
nncase copied to clipboard

编译k210所使用的定点模型时出现错误

Open YaqiChang opened this issue 2 years ago • 7 comments

Describe the bug 使自设voc数据集训练得到的pth转出onnx,且经过测试没有问题,ap也比较高。按照教程进行编译k210所使用的定点模型,测试时时出现报错 我的voc数据集是20类,我已经将文件中类别相关的地方都做了修改,但是量化后是没有结果的,也不能标出检测框

可以详细问一下量化文件是什么原理 Origin model and code If applicable, add orgin model and code to help explain your problem.

**Environment (please complete the following information):

YaqiChang avatar Apr 13 '22 08:04 YaqiChang

请提供模型和相关代码。

sunnycase avatar Apr 18 '22 02:04 sunnycase

这是我的模型,里面放的我的onnx源文件和转出的model thxx! imgs试我的voc/val也是量化的图片集 imgs.zip yoloxcyq.zip

YaqiChang avatar Apr 18 '22 07:04 YaqiChang

请问您解决了吗,我的onnx模型测试也没有问题,转成kmodel之后就检测不到目标

txx-899 avatar Apr 22 '22 10:04 txx-899

这是我的模型,里面放的我的onnx源文件和转出的model thxx! imgs试我的voc/val也是量化的图片集 imgs.zip yoloxcyq.zip

所以请问是为什么呢?这个模型的问题在哪里,还是调用nncase不能简单的这样操作?我一开始还以为是这里的reshape出现了问题,参照yolox又改动了一下,定点模型依然检测不到东西 在simulate.py中67行左右

2

YaqiChang avatar Apr 23 '22 06:04 YaqiChang

在分支0bbcf75c2f17680ab5c673e9544fc41e7e371ab2进行测试:

  1. 浮点模型
python tools/compile.py model/yolox_nano_224.onnx yolox_nano_224.kmodel --legacy
python tools/simulate.py yolox_nano_224.kmodel ~/Downloads/imgs/2.jpg

得到: Figure_1

  1. cpu定点模型
python tools/compile.py model/yolox_nano_224.onnx yolox_nano_224_quant.kmodel --imgs_dir ~/Downloads/imgs --legacy
python tools/simulate.py yolox_nano_224_quant.kmodel ~/Downloads/imgs/2.jpg

得到: Figure_2

  1. k210定点模型
python tools/compile.py model/yolox_nano_224.onnx yolox_nano_224_quant_k210.kmodel --imgs_dir ~/Downloads/imgs --legacy --target k210 --method auto_select
mv yolox_nano_224_quant_k210.kmodel k210/yolox_detect_example/yolox_nano_224.kmodel
mv 2.bin k210/yolox_detect_example/input.bin

上板出错:

--- forcing DTR inactive
--- forcing RTS inactive
--- Miniterm on /dev/cu.usbserial-1140  115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
LCD init
input data uploaded
yolox nano init success!
System start
yolox init
[..m/runtime_module.cpp:65 (shape_reg)] id < shape_regs_.size() = false (bool)
error: Result too large

--- exit ---
  1. 需要提供正确的k210端程序,我们再帮忙进一步确认

zhen8838 avatar May 13 '22 09:05 zhen8838

对 我是想问为什么会出现量化后检测不出来的情况(这只能检测出错误的一类),因为onnx的测试是没有问题的?我使用的就是compile.py。修改了类别

YaqiChang avatar May 13 '22 09:05 YaqiChang

基于nncase 1.6, cpu的量化前后没有问题, 关于k210的量化问题已经在检查了.

zhen8838 avatar May 13 '22 11:05 zhen8838

我也遇到同样的问题,请问解决了吗?

LYHTZHANGJIANG avatar Aug 09 '23 02:08 LYHTZHANGJIANG