当前位置:网站首页>input: kMAX dimensions in profile 0 are [2,3,128,128] but input has static dimensions [1,3,128,128]
input: kMAX dimensions in profile 0 are [2,3,128,128] but input has static dimensions [1,3,128,128]
2022-07-21 19:43:00 【AI vision netqi】
turn tensorrt Times wrong :
input: kMAX dimensions in profile 0 are [2,3,128,128] but input has static dimensions [1,3,128,128]
reason 1:
onnx Export is fixed bach_size
tensorrt It's dynamic batch_size
Led to the wrong report .
reason 2,simplify Fixed batch_size, The resulting misstatement :
onnx_model = onnx.load("model2.onnx") # load onnx model
output_path = 'skip_simp.onnx'
model_simp, check = simplify(onnx_model, input_shapes={'input': [1, 4, 128, 128]})
resolvent :
export onnx Use dynamic batch_size:
data = torch.randn(1, 4, 128, 128)#.cuda()
model.eval()
torch.onnx.export(model, data, "model2.onnx", export_params=True, opset_version=11, do_constant_folding=True, # whether to execute constant folding for optimization
input_names=['input'], # the model's input names
output_names=['output'], dynamic_axes={'input': {0: 'batch_size'}, 'output': {0: 'batch_size'}})
# output_names=['output'], dynamic_axes={'input': {0: 'batch_size', 2: 'in_width', 3: 'int_height'}, 'output': {0: 'batch_size', 2: 'out_width', 3: 'out_height'}})
reason 2 Solutions for :
onnx_model = onnx.load("model2.onnx") # load onnx model
output_path = 'skip_simp2.onnx'
model_simp, check = simplify(onnx_model, dynamic_input_shape=True)
# model_simp, check = simplify(onnx_model)
assert check, "Simplified ONNX model could not be validated"
onnx.save(model_simp, output_path)
print('finished exporting onnx')
边栏推荐
- 深度学习——(4)VGG16 图像分类
- Attack and defense world ----- lottery
- JS异步发展史和async await原理初探
- Loop structure: while and do while structures
- What is the difference between the tag attribute href of a reference URL and Src?
- 26. GD32F103C8T6入门教程--正交编码器的使用
- Attack and defense world ----- favorite_ number
- Lombok简化开发
- 动作活体检测能力,构建安全可靠的支付级“刷脸”体验
- Poste technique | a40i les trois problèmes de logiciel de carte réseau les plus courants, analysez - les un par un pour vous
猜你喜欢
Technical post | the three most common network card software problems of a40i are analyzed for you one by one
Stop learning! These five programming languages are about to die out
Wireless location technology experiment II TDOA least square location method
Web3流量聚合平台Starfish OS,给玩家元宇宙新范式体验
【transformer】ViT
信号处理系统综合设计-最小阶数的IIR数字高通滤波器
序列模型(一)- 循环序列模型
Verilog grammar basics HDL bits training 03
Integrated design of signal processing system - minimum order IIR digital high pass filter
动作活体检测能力,构建安全可靠的支付级“刷脸”体验
随机推荐
笔试强训第20天
ECCV 2022 开源 | 给1万帧视频做目标分割
Audience analysis and uninstall analysis have been comprehensively upgraded, and HMS core analysis service version 6.6.0 has been updated
读书笔记:《次第花开》
Attack and defense world ----- favorite_ number
引用URL的标签属性href与src的区别是什么?
Assertion failed: inputs.at(2).is_weights
维密萎靡,曾经“性感”现在真的“凉了”!
Bram for FPGA logic resource evaluation (taking Xilinx as an example)
【transformer】ViT
ENS阅读笔记
[uncover secrets] secret of project manager's resumption with an annual salary of 1million
PWM output experiment
Insert sort code
TikTok怎么开启社交电商?
Poste technique | a40i les trois problèmes de logiciel de carte réseau les plus courants, analysez - les un par un pour vous
元素类型为 “resultMap“ 的内容必须匹配 “(constructor?,id*,result*,association*,collection*,discriminato?)“
笔试强训第18天
Attack and defense world ----- lottery
sort内部实现原理