当前位置:网站首页>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)
边栏推荐
- 绕任意轴旋转矩阵推导
- Creo 9.0二维草图的诊断:着色封闭环
- Deep integration of OPC UA and IEC61499 (1)
- SolidEdge ST8安装教程
- Prometheus监控Harbor(二进制版)
- 【杂项】如何将指定字体装入电脑然后能在Office软件里使用该字体?
- corn表达式 具体详解与案例
- 通过whl安装第三方包
- MPLS Comprehensive Experiment
- CAS: 178744-28-0, mPEG-DSPE, DSPE-mPEG, methoxy-polyethylene glycol-phosphatidylethanolamine supply
猜你喜欢

The Chinese Valentine's Day event is romantically launched, don't let the Internet slow down and miss the dark time

Unity intercepts 3D images and the implementation of picture-in-picture PIP

The Beijing E-sports Metaverse Forum was successfully held

小身材有大作用——光模块基础知识(一)

详谈RDMA技术原理和三种实现方式

免费的公共WiFi不要乱连,遭中间人攻击了吧?

ping数据包中的进程号

jav一键生成数据库文档

Prometheus监控Harbor(二进制版)

通过whl安装第三方包
随机推荐
[Miscellaneous] How to install the specified font into the computer and then use the font in the Office software?
【LeetCode】最长回文子序列(动态规划)
The super perfect layout has shortcut keys and background replacement
跨域的学习
【杂项】通过Excel为字符串产生条码
Redis persistence method
代码重构:面向单元测试
简单了解下 TCP,学习握手和挥手以及各种状态到底是怎么样的
The world's first mass production, with the most fixed points!How does this AVP Tier1 lead?
汉字风格迁移---结合本地和全局特征学习的中文字体迁移
P1996 约瑟夫问题
20年将投资美国约2000亿美元,三星电子财大气粗的样子真好看
Three.js入门详解
[2022强网杯] polydiv和gamemaster
Creo 9.0在草图环境中创建坐标系
电子邮件安全或面临新威胁!
Jmeter-参数化
响应式织梦模板餐饮酒店类网站
JS获得URL超链接的参数值
sqlnet.ora文件与连接认证方式的小测试