
AI模型部署
文章平均质量分 65
liguiyuan112
这个作者很懒,什么都没留下…
展开
-
使用onnxruntime-gpu 模型推理
更新onnxruntime版本,使用onnxruntime-gpu版本来推理原创 2022-08-09 16:04:09 · 13790 阅读 · 9 评论 -
python使用ctypes调用第三方库时出现undefined symbol分析
今天在用python 调用c++库文件时出现了一个错误,这里主要记录一下解决问题的思路。 1.出现错误在使用python 中使用中调用第三方so库时import ctypescpp = ctypes.CDLL('./detector.so')出现如下错误:Traceback (most recent call last):File “detection.py”, line 143, in face_detection(image_path)File “detection.p原创 2021-07-30 16:10:42 · 8794 阅读 · 0 评论 -
在onnx推理onnxruntime出现警告问题解决
在用onnx进行推理模型时出现以下的警告:[W:onnxruntime:, graph.cc:1074 Graph] Initializer res_5_block1_conv_dw_relu_gamma appears in graph inputs and will not be treated as constant value/weight. This may prevent some of the graph optimizations, like const folding. Move .原创 2021-05-19 13:57:17 · 6582 阅读 · 3 评论 -
TensorRT模型推理内存泄露问题解决
问题描述:在使用tensorRT部署模型时,发现随着客户端不断地请求服务,显存会持续的增长,当超过显卡内存时就会出现申请不到显存而报错的情况。经过分析是我在tensorrt模型前向推理是造成的问题,在代码里:trt_engine_path = './model/resnet50.trt'trt_runtime = trt.Runtime(TRT_LOGGER)engine = load_engine(trt_runtime, trt_engine_path)context = engi原创 2020-12-22 14:20:54 · 5137 阅读 · 7 评论 -
Flask部署TensorRT问题解决(pycuda._driver.LogicError: explicit_context_dependent failed)
问题描述:今天使用Flask搭建服务端进行模型推理,在使用TensorRT进行推理模型时出现如下错误:line 39, in allocate_buffers stream = cuda.Stream() # pycuda 操作缓冲区pycuda._driver.LogicError: explicit_context_dependent failed: invalid device context - no currently active context?网上查了,说是...原创 2020-12-14 14:55:01 · 2069 阅读 · 2 评论 -
Ubuntu18.04安装tensorRT来部署模型
安装tensorRT(1)查看自己的cuda和cudnn版本cuda:cat /usr/local/cuda/version.txtcat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2(2)安装pycudapip3 install pycuda -i https://mirrors.aliyun.com/pypi/simple这里注意不要使用sudo来安装,要不然可能会出现找不到cuda.h文件的错误。-i ..原创 2020-12-01 17:39:49 · 5209 阅读 · 0 评论 -
mxnet模型转onnx模型
1.安装mxnet开发环境这里我安装的是gpu的版本,直接使用命令安装即可:sudo pip3 install mxnet-cu100也可以在安装的时候用 -i https://mirrors.aliyun.com/pypi/simple指定阿里源,安装速度会快很多。2.模型转换代码import numpy as npimport mxnet as mxfrom mxnet.contrib import onnx as onnx_mxnetsym = './model..原创 2020-12-03 14:45:09 · 3009 阅读 · 1 评论 -
pytorch模型转TensorRT模型部署
pytorch训练的模型用Tensor模型部署我们在部署AI模型时可以有多种选择,使用的是cpu还是gpu,部署框架直接使用pytorch,也可以选择tensorRT,会加速模型推理。这里主要讲的是pytorch模型怎么用tensorRT来部署,先来总结一下我们常用的部署方案。常用部署方案:cpu: pytorch->onnx->onnxruntimegpu: pytorch->onnx->onnx2trt->tensorRTarm: pytorch.原创 2020-12-03 14:26:03 · 9469 阅读 · 13 评论