当前位置:网站首页>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)
边栏推荐
猜你喜欢
随机推荐
用两个栈模拟队列
浅谈我国产业园区未来的发展方向
Internship: Upload method for writing excel sheet (import)
Jar a key generation document database
curl使用指南
libnet
Creo 9.0二维草图的诊断:着色封闭环
MCS-51单片机,定时1分钟,汇编程序
MPLS综合实验
sqlnet.ora文件与连接认证方式的小测试
RSS订阅微信公众号初探-feed43
智能管理PoE交换机
详谈RDMA技术原理和三种实现方式
SRE运维解密-什么是SRE:DevOps模型的具体实践!
绕任意轴旋转矩阵推导
孙宇晨受邀参加36氪元宇宙峰会并发表主题演讲
直播系统聊天技术(八):vivo直播系统中IM消息模块的架构实践
libnet
栈的压入、弹出序列
用队列模拟实现栈








