- [Instance branch]: INPUT_ATTR
- [TENSOR INDEX: 0]
- [TENSOR NAME: input]
- [TENSOR N_DIMS: 4]
- [TENSOR DIMS: [1, 255, 255, 3, ]]
- [TENSOR N_ELEMS: 195075]
- [TENSOR SIZE: 195075]
- [TENSOR W_STRIDE: 256]
- [TENSOR SIZE_WITH_STRIDE: 195840]
- [TENSOR FORMAT: NHWC]
- [TENSOR TYPE: INT8]
- [TENSOR QNT_TYPE: AFFINE]
- [TENSOR ZP: -128]
- [TENSOR SCALE: 1]
- [Instance branch]: OUTPUT_ATTR
- [TENSOR INDEX: 0]
- [TENSOR NAME: output]
- [TENSOR N_DIMS: 4]
- [TENSOR DIMS: [1, 48, 16, 16, ]]
- [TENSOR N_ELEMS: 12288]
- [TENSOR SIZE: 12288]
- [TENSOR W_STRIDE: 0]
- [TENSOR SIZE_WITH_STRIDE: 12288]
- [TENSOR FORMAT: NCHW]
- [TENSOR TYPE: INT8]
- [TENSOR QNT_TYPE: AFFINE]
- [TENSOR ZP: 3]
- [TENSOR SCALE: 0.14404]
复制代码
特征融合模型输入为tensor, 输出为tensor,具体如下:- [Correlation branch]: INPUT_ATTR
- [TENSOR INDEX: 0]
- [TENSOR NAME: input1]
- [TENSOR N_DIMS: 4]
- [TENSOR DIMS: [1, 8, 8, 48, ]]
- [TENSOR N_ELEMS: 3072]
- [TENSOR SIZE: 3072]
- [TENSOR W_STRIDE: 8]
- [TENSOR SIZE_WITH_STRIDE: 3072]
- [TENSOR FORMAT: NHWC]
- [TENSOR TYPE: INT8]
- [TENSOR QNT_TYPE: AFFINE]
- [TENSOR ZP: -22]
- [TENSOR SCALE: 0.124435]
- [Correlation branch]: INPUT_ATTR
- [TENSOR INDEX: 1]
- [TENSOR NAME: input2]
- [TENSOR N_DIMS: 4]
- [TENSOR DIMS: [1, 16, 16, 48, ]]
- [TENSOR N_ELEMS: 12288]
- [TENSOR SIZE: 12288]
- [TENSOR W_STRIDE: 16]
- [TENSOR SIZE_WITH_STRIDE: 12288]
- [TENSOR FORMAT: NHWC]
- [TENSOR TYPE: INT8]
- [TENSOR QNT_TYPE: AFFINE]
- [TENSOR ZP: -4]
- [TENSOR SCALE: 0.189816]
- [Correlation branch]: OUTPUT_ATTR
- [TENSOR INDEX: 0]
- [TENSOR NAME: output1]
- [TENSOR N_DIMS: 4]
- [TENSOR DIMS: [1, 2, 16, 16, ]]
- [TENSOR N_ELEMS: 512]
- [TENSOR SIZE: 512]
- [TENSOR W_STRIDE: 0]
- [TENSOR SIZE_WITH_STRIDE: 4096]
- [TENSOR FORMAT: NCHW]
- [TENSOR TYPE: INT8]
- [TENSOR QNT_TYPE: AFFINE]
- [TENSOR ZP: -5]
- [TENSOR SCALE: 0.0481221]
- [Correlation branch]: OUTPUT_ATTR
- [TENSOR INDEX: 1]
- [TENSOR NAME: output2]
- [TENSOR N_DIMS: 4]
- [TENSOR DIMS: [1, 4, 16, 16, ]]
- [TENSOR N_ELEMS: 1024]
- [TENSOR SIZE: 1024]
- [TENSOR W_STRIDE: 0]
- [TENSOR SIZE_WITH_STRIDE: 4096]
- [TENSOR FORMAT: NCHW]
- [TENSOR TYPE: INT8]
- [TENSOR QNT_TYPE: AFFINE]
- [TENSOR ZP: -128]
- [TENSOR SCALE: 0.315689]
复制代码
当前我采用的编程思路为特征提取模型采用零拷贝API- attr_output_z.fmt = RKNN_TENSOR_NCHW;
- attr_output_z.type = RKNN_TENSOR_FLOAT32;
- ret = rknn_set_io_mem(ctx_z, mem_input_z, &attr_input_z);
复制代码
对于特征融合网络如下设置:- rknn_input input;
- for (int i = 0; i < io_num.n_input; i++) {
- input.index = i;
- input.type = RKNN_TENSOR_FLOAT32;
- input.size = attr_inputs[i].size * sizeof(float);
- input.fmt = RKNN_TENSOR_NCHW;
- input.pass_through = 0;
- inputs.push_back(input);
- }
复制代码
两个模型之间的数据赋值,即特征提取网络结果作为特征融合模型输入代码如下:- inputs[0].buf = mem_output_z->virt_addr;
复制代码
- E RKNN: [02:51:54.114] Meet unsupported src layout for normalize: 2
- E RKNN: [02:51:54.114] rknn_inputs_set, normalize error(-1) index=0
- E RKNN: [02:51:54.114] Meet unsupported src layout for normalize: 2
- E RKNN: [02:51:54.114] rknn_inputs_set, normalize error(-1) index=1
复制代码
请问是思路有问题,比如统一使用通用API?还是需要手动将NCHW的输入转换为NHWC,在进行操作?欢迎光临 Toybrick (https://t.rock-chips.com/) | Powered by Discuz! X3.3 |