-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TX2 设备部署方法 已解决 我尝试在TX2设备上部署YOLOV8项目,但是TX2上的tensorrt,转换模型时会报告不支持int64的错误,有什么方法可以转换为int32呢? #15
Comments
@lyb36524 For TensorRT8.4.2.4, there will not be this error. |
对在x86上,使用TensorRT只会有警告,不会停止并且可以得到文件。但是在TX2上最高版本只有TensorRT8.2.1,完不成转换,我尝试在x86,转换得到模型,但是在TX2上推理会报错,引擎版本不一致,我尝试了好多TensorRT的版本,以及对应的8.2.1,依然有这个问题,所以我好像必须在TX2上完成转换? |
@lyb36524 for Tensorrt8.2, you can reference the following step:
|
谢谢你的回复,但是我在X86平台上,使用不同的TensorRT,版本都可以,完成转换。 nvidia@ubuntu:~/TensorRT-Alpha-main/yolov8/build$ ./app_yolov8 --model=../../data/yolov8/yolov8n.trt --size=640 --batch_size=1 --img=../../data/6406407.jpg --show --savePath 所以,我在想是不是必须在TX2,上完成onnxx到trt的转换,所以有什么方法可以将,onnx转为INT32的格式?或者其他导出trt的方法? |
@lyb36524 According to your error message, suggestions:
|
是的,但是我好像绕不开,TX2上的ARM平台的TensorRT8.2.1,如果我在其他平台编译了app_yolov8,在TX2上就依然无法运行。 |
@lyb36524 Why do you copy trt files between different devices? This is forbidden by TensorRT! #15 (comment) |
因为,我在TX2平台上无法,完成onnx到trt 文件 的转换,他会提示: [02/28/2023-12:49:19] [E] [TRT] ModelImporter.cpp:779: ERROR: builtin_op_importers.cpp:3352 In function importRange: 我不知道还有什么方法,能完成 trt文件的转换,或者怎么修改ONNX文件,实现trt文件的转换?谢谢 |
|
在你哪里,onnx拷贝到TX2可以完成转换?我这里ONNX拷贝到TX2,不能完成转换,会出现: |
@lyb36524 上面指令试过?batch=1。另外,yolov8可能有个bug,batch=4导出onnx还是1 |
试过,我一开始就是按照,这个步骤,在TX2上操作的: 直到我遇到了这个问题: |
@lyb36524 不应该,有两个兄弟反馈在TX2跑通了,加企鹅732369616 |
太感谢了,我现在要出去一下,我先加您QQ |
问题成功解决,感谢飞哥大力援助,以下是,解决方法: |
除此之外,TX2设备拷贝数据需要简单修改下,参考:#16 (comment) |
把作者逼的最后说中文了😄,感谢,我也碰到类似问题 |
@Phoenix8215 可以直接提新的issue |
@Phoenix8215 如图在yolo.cpp中,将0改为1,最下方代码注释。 |
问题成功解决,感谢飞哥大力援助,以下是,解决方法:
TX2 系统版本,jetpak4.6
关键步骤:
1.在PC or TX2导出静态onnx.
2.在TX2上,用TRT8.2编译onnx,得到trt文件.
注意:
然后编译tensorrt-alpha代码时所用的Tensorrt版本,要与trt转换时的一致。
关键命令:
1.在PC 或者 TX2导出静态onnx,注意这里与其他X86 ubuntu 上的转换命令不一致:
yolo mode=export model=yolov8n.pt format=onnx batch=1
2.将onnx文件拷贝到,TX2上,并在TX2上运行以下命令编译trt文件:
../../TensorRT-8.2.1.8/bin/trtexec --onnx=yolov8n.onnx --saveEngine=yolov8n.trt --buildOnly
TX2的trtexec可执行文件目录在:
/usr/src/tensorrt/bin
注意自行更改命令的目录
3.运行测试:
./app_yolov8 --model=../../data/yolov8/yolov8n.trt --size=640 --batch_size=1 --img=../../data/6406407.jpg --show
我尝试在TX2设备上部署YOLOV8项目,但是TX2上的tensorrt,转换模型时会报告不支持int64的错误,有什么方法可以转换为int32呢?
或者正确转换出模型呢?
`nvidia@ubuntu:~/TensorRT-Alpha-main/data/yolov8$ ./trtexec --onnx=yolov8n.onnx --saveEngine=yolov8n.trt --buildOnly --minShapes=images:1x3x640x640 --optShapes=images:4x3x640x640 --maxShapes=images:8x3x640x640
&&&& RUNNING TensorRT.trtexec [TensorRT v8201] # ./trtexec --onnx=yolov8n.onnx --saveEngine=yolov8n.trt --buildOnly --minShapes=images:1x3x640x640 --optShapes=images:4x3x640x640 --maxShapes=images:8x3x640x640
[02/28/2023-01:55:01] [I] === Model Options ===
[02/28/2023-01:55:01] [I] Format: ONNX
[02/28/2023-01:55:01] [I] Model: yolov8n.onnx
[02/28/2023-01:55:01] [I] Output:
[02/28/2023-01:55:01] [I] === Build Options ===
[02/28/2023-01:55:01] [I] Max batch: explicit batch
[02/28/2023-01:55:01] [I] Workspace: 16 MiB
[02/28/2023-01:55:01] [I] minTiming: 1
[02/28/2023-01:55:01] [I] avgTiming: 8
[02/28/2023-01:55:01] [I] Precision: FP32
[02/28/2023-01:55:01] [I] Calibration:
[02/28/2023-01:55:01] [I] Refit: Disabled
[02/28/2023-01:55:01] [I] Sparsity: Disabled
[02/28/2023-01:55:01] [I] Safe mode: Disabled
[02/28/2023-01:55:01] [I] DirectIO mode: Disabled
[02/28/2023-01:55:01] [I] Restricted mode: Disabled
[02/28/2023-01:55:01] [I] Save engine: yolov8n.trt
[02/28/2023-01:55:01] [I] Load engine:
[02/28/2023-01:55:01] [I] Profiling verbosity: 0
[02/28/2023-01:55:01] [I] Tactic sources: Using default tactic sources
[02/28/2023-01:55:01] [I] timingCacheMode: local
[02/28/2023-01:55:01] [I] timingCacheFile:
[02/28/2023-01:55:01] [I] Input(s)s format: fp32:CHW
[02/28/2023-01:55:01] [I] Output(s)s format: fp32:CHW
[02/28/2023-01:55:01] [I] Input build shape: images=1x3x640x640+4x3x640x640+8x3x640x640
[02/28/2023-01:55:01] [I] Input calibration shapes: model
[02/28/2023-01:55:01] [I] === System Options ===
[02/28/2023-01:55:01] [I] Device: 0
[02/28/2023-01:55:01] [I] DLACore:
[02/28/2023-01:55:01] [I] Plugins:
[02/28/2023-01:55:01] [I] === Inference Options ===
[02/28/2023-01:55:01] [I] Batch: Explicit
[02/28/2023-01:55:01] [I] Input inference shape: images=4x3x640x640
[02/28/2023-01:55:01] [I] Iterations: 10
[02/28/2023-01:55:01] [I] Duration: 3s (+ 200ms warm up)
[02/28/2023-01:55:01] [I] Sleep time: 0ms
[02/28/2023-01:55:01] [I] Idle time: 0ms
[02/28/2023-01:55:01] [I] Streams: 1
[02/28/2023-01:55:01] [I] ExposeDMA: Disabled
[02/28/2023-01:55:01] [I] Data transfers: Enabled
[02/28/2023-01:55:01] [I] Spin-wait: Disabled
[02/28/2023-01:55:01] [I] Multithreading: Disabled
[02/28/2023-01:55:01] [I] CUDA Graph: Disabled
[02/28/2023-01:55:01] [I] Separate profiling: Disabled
[02/28/2023-01:55:01] [I] Time Deserialize: Disabled
[02/28/2023-01:55:01] [I] Time Refit: Disabled
[02/28/2023-01:55:01] [I] Skip inference: Enabled
[02/28/2023-01:55:01] [I] Inputs:
[02/28/2023-01:55:01] [I] === Reporting Options ===
[02/28/2023-01:55:01] [I] Verbose: Disabled
[02/28/2023-01:55:01] [I] Averages: 10 inferences
[02/28/2023-01:55:01] [I] Percentile: 99
[02/28/2023-01:55:01] [I] Dump refittable layers:Disabled
[02/28/2023-01:55:01] [I] Dump output: Disabled
[02/28/2023-01:55:01] [I] Profile: Disabled
[02/28/2023-01:55:01] [I] Export timing to JSON file:
[02/28/2023-01:55:01] [I] Export output to JSON file:
[02/28/2023-01:55:01] [I] Export profile to JSON file:
[02/28/2023-01:55:01] [I]
[02/28/2023-01:55:01] [I] === Device Information ===
[02/28/2023-01:55:01] [I] Selected Device: NVIDIA Tegra X2
[02/28/2023-01:55:01] [I] Compute Capability: 6.2
[02/28/2023-01:55:01] [I] SMs: 2
[02/28/2023-01:55:01] [I] Compute Clock Rate: 1.3 GHz
[02/28/2023-01:55:01] [I] Device Global Memory: 7850 MiB
[02/28/2023-01:55:01] [I] Shared Memory per SM: 64 KiB
[02/28/2023-01:55:01] [I] Memory Bus Width: 128 bits (ECC disabled)
[02/28/2023-01:55:01] [I] Memory Clock Rate: 1.3 GHz
[02/28/2023-01:55:01] [I]
[02/28/2023-01:55:01] [I] TensorRT version: 8.2.1
[02/28/2023-01:55:03] [I] [TRT] [MemUsageChange] Init CUDA: CPU +266, GPU +0, now: CPU 285, GPU 6703 (MiB)
[02/28/2023-01:55:03] [I] [TRT] [MemUsageSnapshot] Begin constructing builder kernel library: CPU 285 MiB, GPU 6704 MiB
[02/28/2023-01:55:03] [I] [TRT] [MemUsageSnapshot] End constructing builder kernel library: CPU 314 MiB, GPU 6732 MiB
[02/28/2023-01:55:03] [I] Start parsing network model
[02/28/2023-01:55:03] [I] [TRT] ----------------------------------------------------------------
[02/28/2023-01:55:03] [I] [TRT] Input filename: yolov8n.onnx
[02/28/2023-01:55:03] [I] [TRT] ONNX IR version: 0.0.8
[02/28/2023-01:55:03] [I] [TRT] Opset version: 17
[02/28/2023-01:55:03] [I] [TRT] Producer name: pytorch
[02/28/2023-01:55:03] [I] [TRT] Producer version: 1.13.1
[02/28/2023-01:55:03] [I] [TRT] Domain:
[02/28/2023-01:55:03] [I] [TRT] Model version: 0
[02/28/2023-01:55:03] [I] [TRT] Doc string:
[02/28/2023-01:55:03] [I] [TRT] ----------------------------------------------------------------
[02/28/2023-01:55:03] [W] [TRT] onnx2trt_utils.cpp:366: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
[02/28/2023-01:55:04] [E] [TRT] ModelImporter.cpp:773: While parsing node number 239 [Range -> "/model.22/Range_output_0"]:
[02/28/2023-01:55:04] [E] [TRT] ModelImporter.cpp:774: --- Begin node ---
[02/28/2023-01:55:04] [E] [TRT] ModelImporter.cpp:775: input: "/model.22/Constant_8_output_0"
input: "/model.22/Cast_output_0"
input: "/model.22/Constant_9_output_0"
output: "/model.22/Range_output_0"
name: "/model.22/Range"
op_type: "Range"
[02/28/2023-01:55:04] [E] [TRT] ModelImporter.cpp:776: --- End node ---
[02/28/2023-01:55:04] [E] [TRT] ModelImporter.cpp:779: ERROR: builtin_op_importers.cpp:3352 In function importRange:
[8] Assertion failed: inputs.at(0).isInt32() && "For range operator with dynamic inputs, this version of TensorRT only supports INT32!"
[02/28/2023-01:55:04] [E] Failed to parse onnx file
[02/28/2023-01:55:04] [I] Finish parsing network model
[02/28/2023-01:55:04] [E] Parsing model failed
[02/28/2023-01:55:04] [E] Failed to create engine from model.
[02/28/2023-01:55:04] [E] Engine set up failed
&&&& FAILED TensorRT.trtexec [TensorRT v8201] # ./trtexec --onnx=yolov8n.onnx --saveEngine=yolov8n.trt --buildOnly --minShapes=images:1x3x640x640 --optShapes=images:4x3x640x640 --maxShapes=images:8x3x640x640
nvidia@ubuntu:~/TensorRT-Alpha-main/data/yolov8$
`
我还尝试了这个方法,但是没什么作用,依然有int64的节点:
https://blog.csdn.net/dou3516/article/details/124577344
The text was updated successfully, but these errors were encountered: