前言
我在Jetson Orin NX上想用trtexec把.onnx文件转化为.trt文件然后用TensorRT加速,结果它报错了内容如下:
[09/21/2023-16:16:26] [I] TensorRT version: 8.5.2
[09/21/2023-16:16:26] [I] [TRT] [MemUsageChange] Init CUDA: CPU +220, GPU +0, now: CPU 249, GPU 4104 (MiB)
[09/21/2023-16:16:29] [I] [TRT] [MemUsageChange] Init builder kernel library: CPU +302, GPU +300, now: CPU 574, GPU 4423 (MiB)
[09/21/2023-16:16:29] [I] Start parsing network model
Could not open file ~/ti_unet/ti_model.onnx
Could not open file ~/ti_unet/ti_model_trt.onnx
[09/21/2023-16:16:29] [E] [TRT] ModelImporter.cpp:688: Failed to parse ONNX model from file: ~/ti_unet/resnet18.onnx
[09/21/2023-16:16:29] [E] Failed to parse onnx file
[09/21/2023-16:16:29] [I] Finish parsing network model
[09/21/2023-16:16:29] [E] Parsing model failed
[09/21/2023-16:16:29] [E] Failed to create engine from model or file.
[09/21/2023-16:16:29] [E] Engine set up failed
显示无法打开文件
解决方法
要使用绝对路径,不要用~
.\trtexec --onnx=\home\jetson\ti_model\ti_model.onnx --saveEngine=\home\jetson\ti_model\ti_model_trt.trt