Tianxiaomo / pytorch-YOLOv4

PyTorch ,ONNX and TensorRT implementation of YOLOv4
Apache License 2.0
4.46k stars 1.49k forks source link

[TRT] ModelImporter.cpp:735: Failed to parse ONNX model from file: ./yolov4_1_3_416_416_static.onnx #493

Closed beybars1 closed 2 years ago

beybars1 commented 2 years ago

Hi all.

I am trying to run this command:

/usr/src/tensorrt/bin/trtexec --onnx=./yolov4_1_3_416_416_static.onnx --explicitBatch --saveEngine=trt_yolov4.engine --workspace=2048 --fp16

To get the TensorRT engine file for YOLOv4 model. But I get this error message:

$ /usr/src/tensorrt/bin/trtexec --onnx=./yolov4_1_3_416_416_static.onnx --explicitBatch --saveEngine=trt_yolov4.engine --workspace=2048 --fp16
&&&& RUNNING TensorRT.trtexec [TensorRT v8201] # /usr/src/tensorrt/bin/trtexec --onnx=./yolov4_1_3_416_416_static.onnx --explicitBatch --saveEngine=trt_yolov4.engine --workspace=2048 --fp16
[12/07/2021-23:53:57] [W] --explicitBatch flag has been deprecated and has no effect!
[12/07/2021-23:53:57] [W] Explicit batch dim is automatically enabled if input model is ONNX or if dynamic shapes are provided when the engine is built.
[12/07/2021-23:53:57] [I] === Model Options ===
[12/07/2021-23:53:57] [I] Format: ONNX
[12/07/2021-23:53:57] [I] Model: ./yolov4_1_3_416_416_static.onnx
[12/07/2021-23:53:57] [I] Output:
[12/07/2021-23:53:57] [I] === Build Options ===
[12/07/2021-23:53:57] [I] Max batch: explicit batch
[12/07/2021-23:53:57] [I] Workspace: 2048 MiB
[12/07/2021-23:53:57] [I] minTiming: 1
[12/07/2021-23:53:57] [I] avgTiming: 8
[12/07/2021-23:53:57] [I] Precision: FP32+FP16
[12/07/2021-23:53:57] [I] Calibration: 
[12/07/2021-23:53:57] [I] Refit: Disabled
[12/07/2021-23:53:57] [I] Sparsity: Disabled
[12/07/2021-23:53:57] [I] Safe mode: Disabled
[12/07/2021-23:53:57] [I] DirectIO mode: Disabled
[12/07/2021-23:53:57] [I] Restricted mode: Disabled
[12/07/2021-23:53:57] [I] Save engine: trt_yolov4.engine
[12/07/2021-23:53:57] [I] Load engine: 
[12/07/2021-23:53:57] [I] Profiling verbosity: 0
[12/07/2021-23:53:57] [I] Tactic sources: Using default tactic sources
[12/07/2021-23:53:57] [I] timingCacheMode: local
[12/07/2021-23:53:57] [I] timingCacheFile: 
[12/07/2021-23:53:57] [I] Input(s)s format: fp32:CHW
[12/07/2021-23:53:57] [I] Output(s)s format: fp32:CHW
[12/07/2021-23:53:57] [I] Input build shapes: model
[12/07/2021-23:53:57] [I] Input calibration shapes: model
[12/07/2021-23:53:57] [I] === System Options ===
[12/07/2021-23:53:57] [I] Device: 0
[12/07/2021-23:53:57] [I] DLACore: 
[12/07/2021-23:53:57] [I] Plugins:
[12/07/2021-23:53:57] [I] === Inference Options ===
[12/07/2021-23:53:57] [I] Batch: Explicit
[12/07/2021-23:53:57] [I] Input inference shapes: model
[12/07/2021-23:53:57] [I] Iterations: 10
[12/07/2021-23:53:57] [I] Duration: 3s (+ 200ms warm up)
[12/07/2021-23:53:57] [I] Sleep time: 0ms
[12/07/2021-23:53:57] [I] Idle time: 0ms
[12/07/2021-23:53:57] [I] Streams: 1
[12/07/2021-23:53:57] [I] ExposeDMA: Disabled
[12/07/2021-23:53:57] [I] Data transfers: Enabled
[12/07/2021-23:53:57] [I] Spin-wait: Disabled
[12/07/2021-23:53:57] [I] Multithreading: Disabled
[12/07/2021-23:53:57] [I] CUDA Graph: Disabled
[12/07/2021-23:53:57] [I] Separate profiling: Disabled
[12/07/2021-23:53:57] [I] Time Deserialize: Disabled
[12/07/2021-23:53:57] [I] Time Refit: Disabled
[12/07/2021-23:53:57] [I] Skip inference: Disabled
[12/07/2021-23:53:57] [I] Inputs:
[12/07/2021-23:53:57] [I] === Reporting Options ===
[12/07/2021-23:53:57] [I] Verbose: Disabled
[12/07/2021-23:53:57] [I] Averages: 10 inferences
[12/07/2021-23:53:57] [I] Percentile: 99
[12/07/2021-23:53:57] [I] Dump refittable layers:Disabled
[12/07/2021-23:53:57] [I] Dump output: Disabled
[12/07/2021-23:53:57] [I] Profile: Disabled
[12/07/2021-23:53:57] [I] Export timing to JSON file: 
[12/07/2021-23:53:57] [I] Export output to JSON file: 
[12/07/2021-23:53:57] [I] Export profile to JSON file: 
[12/07/2021-23:53:57] [I] 
[12/07/2021-23:53:57] [I] === Device Information ===
[12/07/2021-23:53:57] [I] Selected Device: NVIDIA GeForce RTX 2080 Ti
[12/07/2021-23:53:57] [I] Compute Capability: 7.5
[12/07/2021-23:53:57] [I] SMs: 68
[12/07/2021-23:53:57] [I] Compute Clock Rate: 1.65 GHz
[12/07/2021-23:53:57] [I] Device Global Memory: 11016 MiB
[12/07/2021-23:53:57] [I] Shared Memory per SM: 64 KiB
[12/07/2021-23:53:57] [I] Memory Bus Width: 352 bits (ECC disabled)
[12/07/2021-23:53:57] [I] Memory Clock Rate: 7 GHz
[12/07/2021-23:53:57] [I] 
[12/07/2021-23:53:57] [I] TensorRT version: 8.2.1
[12/07/2021-23:53:57] [I] [TRT] [MemUsageChange] Init CUDA: CPU +323, GPU +0, now: CPU 335, GPU 795 (MiB)
[12/07/2021-23:53:57] [I] [TRT] [MemUsageSnapshot] Begin constructing builder kernel library: CPU 335 MiB, GPU 795 MiB
[12/07/2021-23:53:57] [I] [TRT] [MemUsageSnapshot] End constructing builder kernel library: CPU 469 MiB, GPU 829 MiB
[12/07/2021-23:53:57] [I] Start parsing network model
Could not open file ./yolov4_1_3_416_416_static.onnx
Could not open file ./yolov4_1_3_416_416_static.onnx
[12/07/2021-23:53:57] [E] [TRT] ModelImporter.cpp:735: Failed to parse ONNX model from file: ./yolov4_1_3_416_416_static.onnx
[12/07/2021-23:53:57] [E] Failed to parse onnx file
[12/07/2021-23:53:57] [I] Finish parsing network model
[12/07/2021-23:53:57] [E] Parsing model failed
[12/07/2021-23:53:57] [E] Failed to create engine from model.
[12/07/2021-23:53:57] [E] Engine set up failed
&&&& FAILED TensorRT.trtexec [TensorRT v8201] # /usr/src/tensorrt/bin/trtexec --onnx=./yolov4_1_3_416_416_static.onnx --explicitBatch --saveEngine=trt_yolov4.engine --workspace=2048 --fp16

My setup: Linux Ubuntu 18.04 RTX2080TI CUDA: 11.5 cuDNN: 8.3.1 TensorRT: 8.2.1.8 PyTorch: 1.4.0 onnx: 1.10.2

Any help will be appreciated!

Thanks!

wujianfei5201314 commented 5 months ago

May I ask whether the problem has been resolved?