当前位置:网站首页>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)
边栏推荐
猜你喜欢
随机推荐
XSLT – 服务器端概述
End-to-End Lane Marker Detection via Row-wise Classification
Creo9.0 绘制中心线
Creo 9.0在草图环境中创建坐标系
响应式织梦模板餐饮酒店类网站
图论-虚拟节点分层建图
Creo 9.0创建几何点
ros mavros stereo读取rosbag并记录IMU和图片到文件夹
Creo 9.0二维草图的诊断:着色封闭环
汉字风格迁移---结合本地和全局特征学习的中文字体迁移
Use tf.image.resize() and tf.image.resize_with_pad() to resize images
响应式织梦模板除尘器类网站
伦敦银最新均线分析系统怎么操作?
智能管理PoE交换机
vscode插件设置——Golang开发环境配置
做项目一定用得到的NLP资源【分类版】
rsync 基础用法
用两个栈模拟队列
简单了解下 TCP,学习握手和挥手以及各种状态到底是怎么样的
Graph-node:创建一个新的subgraph








