当前位置:网站首页>The problem of disorganized data output by mnn model
The problem of disorganized data output by mnn model
2022-08-03 23:53:00 【Master Luwen】
I have used Ali's for the past two daysMNN:
https://github.com/alibaba/MNN
还挺好用的,Just do not know withopenclHow to use the backend enginePython API调用
I encountered a small hole,The output data is so disorganized:
而不是这样的:
反复debug,发现:
It turns out that the output of the model cannot be directly getData()
output_tensor = interpreter.getSessionOutput(session) # 获得模型的输出
tmp_output = MNN.Tensor((1, 2, 224, 224), # Temporary variable used for output
MNN.Halide_Type_Float,
np.ones([1, 2, 224, 224]).astype(np.float32),
MNN.Tensor_DimensionType_Caffe)
output_tensor.copyToHostTensor(tmp_output) # Give the output of the model to tmp_output 变量
x = tmp_output.getNumpyData()[0] # 获取 numpy 格式的数据
这段代码没啥问题,But put the last line:
x = tmp_output.getNumpyData()[0] # 获取 numpy 格式的数据
替换为:
x = output_tensor.getNumpyData()[0] # 获取 numpy 格式的数据
It becomes a mess of data,It may be that there is a problem with the data first and then the column??
他俩都是 MNN.Tensor 的数据类型
所以我感觉,MNN模型输出的Tensor,Convert to the corresponding format firstMNN.Tensor_DimensionType_Caffe,才能打印出来
In other words, this step is to convert the data format:
tmp_output = MNN.Tensor((1, 2, 224, 224), # Temporary variable used for output
MNN.Halide_Type_Float,
np.ones([1, 2, 224, 224]).astype(np.float32),
MNN.Tensor_DimensionType_Caffe)
边栏推荐
猜你喜欢

A simple understanding of TCP, learn how to shake hands, wave hands and various states

智能管理PoE交换机

【OpenCV图像处理】 图像拼接技术

Salesforce's China business may see new changes, rumors may be closing

Shell编程之循环语句与函数

FastDFS 一文读懂

3D Semantic Segmentation - 2DPASS
![2022-08-03:以下go语言代码输出什么?A:2;B:3;C:1;D:0。 package main import “fmt“ func main() { slice := []i](/img/a9/6de3c2bae92d09b13b1c36e01f86c2.png)
2022-08-03:以下go语言代码输出什么?A:2;B:3;C:1;D:0。 package main import “fmt“ func main() { slice := []i

Redis persistence method

图论-虚拟节点分层建图
随机推荐
【并发编程】ReentrantLock的lockInterruptibly()方法源码分析
(PC+WAP)织梦模板不锈钢类网站
用两个栈模拟队列
Jmeter-断言
SRE运维解密-什么是SRE:DevOps模型的具体实践!
OpenCV 图像拼接
绕任意轴旋转矩阵推导
智能座舱的「交互设计」大战
Creo 9.0在草图环境中创建坐标系
Why Flutter Flutter of tutorials is the best choice for business?
密码学基础以及完整加密通讯过程解析
我的祖国
代码重构:面向单元测试
MCS-51单片机,定时1分钟,汇编程序
curl使用指南
internship:编写excel表的上传方法(导入)
"Miscellaneous" barcode by Excel as a string
做项目一定用得到的NLP资源【分类版】
查看CUDA、pytorch等的版本号
七夕?new一个对象