首页 > 其他分享 >onnx_runtime 推理

onnx_runtime 推理

时间:2023-08-11 18:35:11浏览次数:34  
标签:sess name onnx shape output input runtime 推理

onnx_runtime 推理

import numpy as np
import onnx
import onnxruntime as rt
 
#create input data
input_data = np.ones((1, 3, 299, 299), dtype=np.float32)
#create runtime session
sess = rt.InferenceSession("inception_v3.onnx")
# get output name
input_name = sess.get_inputs()[0].name
print("input name", input_name)
output_name= sess.get_outputs()[0].name
print("output name", output_name)
output_shape = sess.get_outputs()[0].shape
print("output shape", output_shape)
#forward model
res = sess.run([output_name], {input_name: input_data})
out = np.array(res)

标签:sess,name,onnx,shape,output,input,runtime,推理
From: https://www.cnblogs.com/michaelcjl/p/17623700.html

相关文章

  • AI模型部署&推理进阶教程:使用CSK6视觉开发套件拍照并进行物体识别
    前言在已发布的《CSK6AI模型部署教程》系列文章中,我们实现了将训练的LNN模型在CSK6芯片上运行的完整流程:将一张苹果的图片提取到的特征,并打包到了固件里面,然后在固件里去将它送给thinker模型去进行推理,得出一个苹果的一个推理结果。在以往分享的示例中我们的thinker模型是打包WAS......
  • 卸载 Microsoft Edge WebView2 Runtime后无法重新安装
    报错信息:"安装失败,已为系统安装microsoftedgewebview2runtime"需要删除注册表内容(两个都需要删除才可以在进行安装)64位系统HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5} HKEY_CURRENT_USER\Softwar......
  • RuntimeError: DataLoader worker (pid 7978) is killed by signal: Aborted.
    报错信息显示pytorch的DataLoader无法正确加载。造成这个报错的原因不尽相同,但是猜测,大体上都是程序不知为何无法开启新的线程,导致线程被系统终止。当线程数设为0时正常(num_worker=0)对于我来说,发现问题出现在使用vscode调试pytorch训练代码。如果是命令行运行则没问......
  • 论文解读:《基于深度多核学习的用于识别 DNA n4 -甲基胞嘧啶位点的高阶模糊推理系统》
    Title:Adeepmultiplekernellearning-basedhigher-orderfuzzyinferencesystemforidentifyingDNAN4-methylcytosinesites期刊:InformationSciences中科院分区:一区(计算机科学技术)影像因子:8.1↓0.133文章链接:https://doi.org/10.1016/j.ins.2023.01.149Websever:Github:......
  • You are using the runtime-only build of Vue where the template compiler is not a
    使用vue-cli搭建的项目,页面自定义带template内容的组件无法渲染,控制台报错,页面不展示组件内容,代码如下:<template><divclass="hello">my-component:<my-component></my-component></div></template><script>importVuefrom"vue"......
  • TextBrewer:融合并改进了NLP和CV中的多种知识蒸馏技术、提供便捷快速的知识蒸馏框架、
    TextBrewer:融合并改进了NLP和CV中的多种知识蒸馏技术、提供便捷快速的知识蒸馏框架、提升模型的推理速度,减少内存占用TextBrewer是一个基于PyTorch的、为实现NLP中的知识蒸馏任务而设计的工具包,融合并改进了NLP和CV中的多种知识蒸馏技术,提供便捷快速的知识蒸馏框架,用于以较低的......
  • 基于Aidlux平台实现ONNX Runtime部署-水果分类-摄像头和视频
    基于Aidlux平台的人工智能开发部署全流程    第一步:连接Aidlux后,使用jupyternotebook--allow-root进行Aidlux平台联系的jupyternotebook安装配置环境:1.安装ONNX、ONNXRuntime !pipinstallonnxonnxruntime2.安装其他第三方工具包!pipinstallprotobuf=......
  • MiniRBT中文小型预训练模型:结合了全词掩码技术和两段式知识蒸馏技术,加快推理速度
    MiniRBT中文小型预训练模型:结合了全词掩码(WholeWordMasking)技术和两段式知识蒸馏(KnowledgeDistillation)技术,加快推理速度在自然语言处理领域中,预训练语言模型(Pre-trainedLanguageModels)已成为非常重要的基础技术。为了进一步促进中文信息处理的研究发展,哈工大讯飞联合实验......
  • Go Runtime功能初探
    GoRuntime功能初探旅途散记 2023-08-0407:45 发表于上海收录于合集#go44个题图来自 UnderstandCompileTime&&Runtime!ImprovingGolangPerformance(1)[1]以下内容,是对 运行时runtime的神奇用法[2] 的学习与记录目录:1.获取GOROOT环境变量2.获取GO的......
  • nvidia-docker启动容器报错 Unknown runtime specified nvidia
    使用nvidia-docker创建容器时报错:Errorresponsefromdaemon:Unknownruntimespecifiednvidia.See'dockerrun--help'.主要原因在于配置docker镜像时,daemon.json文件被修改了。只要添加对应内容即可。vim /etc/docker/daemon.json原文件:{"registry-mirr......