当前位置:网站首页>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)
边栏推荐
猜你喜欢
OpenCV 图像拼接
Why Flutter Flutter of tutorials is the best choice for business?
Salesforce的中国区业务可能出现新变化,传言可能正在关闭
FPGA按键消抖+蜂鸣器
Graph-node:创建一个新的subgraph
The super perfect layout has shortcut keys and background replacement
单例模式使用饿汉式和懒汉式创建一定安全?很多人不知
RSS feeds WeChat public - feed43 asain
End-to-End Lane Marker Detection via Row-wise Classification
MPLS Comprehensive Experiment
随机推荐
我的祖国
corn表达式 具体详解与案例
2021年数据泄露成本报告解读
Scala基础【正则表达式、框架式开发原则】
leetcode/子串中不能有重复字符的最长子串
Unity2021 releases WebGL fog effect disappearing problem
超级完美版布局有快捷键,有背景置换
Unity 截取3D图像 与 画中画PIP的实现
Salesforce's China business may see new changes, rumors may be closing
[Miscellaneous] How to install the specified font into the computer and then use the font in the Office software?
JS获得URL超链接的参数值
C语言实验十五 文件
初始 List 接口
密码学基础以及完整加密通讯过程解析
View the version number of CUDA, pytorch, etc.
跨域的学习
关于mnn模型输出的数据杂乱无章问题
Read FastDFS in one article
【并发编程】ReentrantLock的lockInterruptibly()方法源码分析
IELTS essay writing template