当前位置:网站首页>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 04:26:00 【AI视觉网奇】
转tensorrt时报错:
input: kMAX dimensions in profile 0 are [2,3,128,128] but input has static dimensions [1,3,128,128]
原因1:
onnx导出是固定的bach_size
tensorrt是动态batch_size
导致报错了。
原因2,simplify时输入了固定的batch_size,导致的报错:
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]})
解决方法:
导出onnx用动态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'}})
原因2的解决方法:
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')
边栏推荐
- 【C 练习】「atoi」模拟实现
- [.Net core] Yisha framework dynamically loads table headers
- Bram for FPGA logic resource evaluation (taking Xilinx as an example)
- Loop structure -- while loop and do while loop
- C language learning
- Click the model mode box and the other areas will not disappear except the mode box
- Codeworks 5 questions per day (average 1500) - day 21
- Poste technique | a40i les trois problèmes de logiciel de carte réseau les plus courants, analysez - les un par un pour vous
- 2035. Divide the array into two arrays and minimize the difference and half search of the array sum
- JSP页面
猜你喜欢
Classic examples of C language: 21-30 examples: insertion sort, Hill sort 1, quick sort, Hill sort 2, recursion, completion, Fibonacci sequence, common divisor and common multiple, judging the number
LeetCode:1260. Two dimensional mesh migration [one dimensional expansion + splicing]
FPGA逻辑资源评估之BRAM(以Xilinx为例)
ASTM F 814 test method for specific optical density of smoke produced by solid materials for aerospace equipment
Preparation of dihydrotanshinone I loaded albumin nanoparticles / norcantharidin albumin nanoparticles / voriconazole albumin nanoparticles
深度学习——(6)pytorch冻结某些层的参数
【transformer】ViT
Tencent im practice: low code and ultra fast instant address book
Electromagnetic field and electromagnetic wave experiment II familiar with the application of MATLAB PDETOOL in two-dimensional electromagnetic problems
MySQL (2)
随机推荐
攻防世界----favorite_number
Audience analysis and uninstall analysis have been comprehensively upgraded, and HMS core analysis service version 6.6.0 has been updated
What is the difference between the tag attribute href of a reference URL and Src?
Electromagnetic field and electromagnetic wave experiment three familiar with the application of Mathematica software in the field of electromagnetic field
Part I - Fundamentals of C language_ 7. Pointer
Liunx kills processes with the same name in batches
Résoudre l'erreur signalée: uncaught typeerror: impossible de lire les propriétés sous - jacentes (lire « installer»)
Web3流量聚合平台Starfish OS,给玩家元宇宙新范式体验
45. Record the training process of orienmask and the process of deploying Yunshi technology depth camera
蓝灯绿灯按时明灭,编程古鲁的密语
Differences among cookies, sessions, and tokens
[uncover secrets] secret of project manager's resumption with an annual salary of 1million
动作活体检测能力,构建安全可靠的支付级“刷脸”体验
电磁场与电磁波实验三 熟悉Mathematica软件在电磁场领域的应用
支持向量机(理解、推导、matlab例子)
【C 练习】宏实现交换数字二进制奇偶位
342 NLP open source datasets in Chinese and English are shared
无线定位技术实验三 基于信号强度的位置指纹定位仿真
Audience analysis and uninstall analysis have been comprehensively upgraded, and HMS core analysis service version 6.6.0 has been updated
MySQL installation prompts that the application cannot start normally (0xc000007b, how to solve it?