rockchip-linux / rknpu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YOLOv5 为什么output设置成自动量化后输出size不对?

013292 opened this issue · comments

commented

rknn_query从模型获得的信息:

input tensors:
index=0 name=x.1_0 n_dims=4 dims=[1 3 640 640] n_elems=1228800 size=1228800 fmt=0 type=3 qnt_type=2 fl=0 zp=0 scale=1.000000
output tensors:
index=0 name=permute_at_1747_221_out0_223 n_dims=5 dims=[3 80 80 11] n_elems=211200 size=211200 fmt=0 type=3 qnt_type=2 fl=-29 zp=227 scale=0.598226
index=1 name=permute_at_1770_230_out0_224 n_dims=5 dims=[3 40 40 11] n_elems=52800 size=52800 fmt=0 type=3 qnt_type=2 fl=-72 zp=184 scale=0.588694
index=2 name=permute_at_1793_239_out0_225 n_dims=5 dims=[3 20 20 11] n_elems=13200 size=13200 fmt=0 type=3 qnt_type=2 fl=-60 zp=196 scale=1.220445

设置输出自动量化:

    // set output
    outputs = new rknn_output [io_num.n_output];
    memset(outputs, 0, sizeof(outputs));
    for (int i = 0; i < io_num.n_output; i++)
    {
        outputs[i].want_float = 1;
    }

之后

cout << outputs[0].size << endl;
cout << outputs[1].size << endl;
cout << outputs[2].size << endl;

结果输出

844800
1163544915
5394255

如果输出float32的数据,第一个844800是可以理解,但后面两个是怎么回事?
另外,如果outputs[i].want_float = 1;的话就会出现Segmentation fault (core dumped)报错,是因为非量化输出不支持.size参数吗?
谢谢