triple-Mu / YOLOv8-TensorRT

YOLOv8 using TensorRT accelerate !
MIT License
1.39k stars 240 forks source link

onnx to trt error #60

Closed dadada-123 closed 1 year ago

dadada-123 commented 1 year ago

&&&& RUNNING TensorRT.trtexec [TensorRT v8205] # trt.exe --onnx=last.onnx --saveEngine=last.engine [04/06/2023-11:03:40] [I] === Model Options === [04/06/2023-11:03:40] [I] Format: ONNX [04/06/2023-11:03:40] [I] Model: last.onnx [04/06/2023-11:03:40] [I] Output: [04/06/2023-11:03:40] [I] === Build Options === [04/06/2023-11:03:40] [I] Max batch: explicit batch [04/06/2023-11:03:40] [I] Workspace: 16 MiB [04/06/2023-11:03:40] [I] minTiming: 1 [04/06/2023-11:03:40] [I] avgTiming: 8 [04/06/2023-11:03:40] [I] Precision: FP32 [04/06/2023-11:03:40] [I] Calibration: [04/06/2023-11:03:40] [I] Refit: Disabled [04/06/2023-11:03:40] [I] Sparsity: Disabled [04/06/2023-11:03:40] [I] Safe mode: Disabled [04/06/2023-11:03:40] [I] DirectIO mode: Disabled [04/06/2023-11:03:40] [I] Restricted mode: Disabled [04/06/2023-11:03:40] [I] Save engine: last.engine [04/06/2023-11:03:40] [I] Load engine: [04/06/2023-11:03:40] [I] Profiling verbosity: 0 [04/06/2023-11:03:40] [I] Tactic sources: Using default tactic sources [04/06/2023-11:03:40] [I] timingCacheMode: local [04/06/2023-11:03:40] [I] timingCacheFile: [04/06/2023-11:03:40] [I] Input(s)s format: fp32:CHW [04/06/2023-11:03:40] [I] Output(s)s format: fp32:CHW [04/06/2023-11:03:40] [I] Input build shapes: model [04/06/2023-11:03:40] [I] Input calibration shapes: model [04/06/2023-11:03:40] [I] === System Options === [04/06/2023-11:03:40] [I] Device: 0 [04/06/2023-11:03:40] [I] DLACore: [04/06/2023-11:03:40] [I] Plugins: [04/06/2023-11:03:40] [I] === Inference Options === [04/06/2023-11:03:40] [I] Batch: Explicit [04/06/2023-11:03:40] [I] Input inference shapes: model [04/06/2023-11:03:40] [I] Iterations: 10 [04/06/2023-11:03:40] [I] Duration: 3s (+ 200ms warm up) [04/06/2023-11:03:40] [I] Sleep time: 0ms [04/06/2023-11:03:40] [I] Idle time: 0ms [04/06/2023-11:03:40] [I] Streams: 1 [04/06/2023-11:03:40] [I] ExposeDMA: Disabled [04/06/2023-11:03:40] [I] Data transfers: Enabled [04/06/2023-11:03:40] [I] Spin-wait: Disabled [04/06/2023-11:03:40] [I] Multithreading: Disabled [04/06/2023-11:03:40] [I] CUDA Graph: Disabled [04/06/2023-11:03:40] [I] Separate profiling: Disabled [04/06/2023-11:03:40] [I] Time Deserialize: Disabled [04/06/2023-11:03:40] [I] Time Refit: Disabled [04/06/2023-11:03:40] [I] Skip inference: Disabled [04/06/2023-11:03:40] [I] Inputs: [04/06/2023-11:03:40] [I] === Reporting Options === [04/06/2023-11:03:40] [I] Verbose: Disabled [04/06/2023-11:03:40] [I] Averages: 10 inferences [04/06/2023-11:03:40] [I] Percentile: 99 [04/06/2023-11:03:40] [I] Dump refittable layers:Disabled [04/06/2023-11:03:40] [I] Dump output: Disabled [04/06/2023-11:03:40] [I] Profile: Disabled [04/06/2023-11:03:40] [I] Export timing to JSON file: [04/06/2023-11:03:40] [I] Export output to JSON file: [04/06/2023-11:03:40] [I] Export profile to JSON file: [04/06/2023-11:03:40] [I] [04/06/2023-11:03:41] [I] === Device Information === [04/06/2023-11:03:41] [I] Selected Device: NVIDIA GeForce RTX 2060 [04/06/2023-11:03:41] [I] Compute Capability: 7.5 [04/06/2023-11:03:41] [I] SMs: 30 [04/06/2023-11:03:41] [I] Compute Clock Rate: 1.2 GHz [04/06/2023-11:03:41] [I] Device Global Memory: 6143 MiB [04/06/2023-11:03:41] [I] Shared Memory per SM: 64 KiB [04/06/2023-11:03:41] [I] Memory Bus Width: 192 bits (ECC disabled) [04/06/2023-11:03:41] [I] Memory Clock Rate: 5.501 GHz [04/06/2023-11:03:41] [I] [04/06/2023-11:03:41] [I] TensorRT version: 8.2.5 [04/06/2023-11:03:41] [I] [TRT] [MemUsageChange] Init CUDA: CPU +431, GPU +0, now: CPU 8058, GPU 1155 (MiB) [04/06/2023-11:03:41] [I] [TRT] [MemUsageSnapshot] Begin constructing builder kernel library: CPU 8127 MiB, GPU 1155 MiB [04/06/2023-11:03:41] [I] [TRT] [MemUsageSnapshot] End constructing builder kernel library: CPU 8264 MiB, GPU 1191 MiB [04/06/2023-11:03:41] [I] Start parsing network model [04/06/2023-11:03:41] [I] [TRT] ---------------------------------------------------------------- [04/06/2023-11:03:41] [I] [TRT] Input filename: last.onnx [04/06/2023-11:03:41] [I] [TRT] ONNX IR version: 0.0.6 [04/06/2023-11:03:41] [I] [TRT] Opset version: 11 [04/06/2023-11:03:41] [I] [TRT] Producer name: pytorch [04/06/2023-11:03:41] [I] [TRT] Producer version: 1.12.0 [04/06/2023-11:03:41] [I] [TRT] Domain: [04/06/2023-11:03:41] [I] [TRT] Model version: 0 [04/06/2023-11:03:41] [I] [TRT] Doc string: [04/06/2023-11:03:41] [I] [TRT] ---------------------------------------------------------------- [04/06/2023-11:03:41] [E] [TRT] ModelImporter.cpp:773: While parsing node number 3 [Conv -> "input.4"]: [04/06/2023-11:03:41] [E] [TRT] ModelImporter.cpp:774: --- Begin node --- [04/06/2023-11:03:41] [E] [TRT] ModelImporter.cpp:775: input: "onnx::Conv_213" input: "model.0.conv.bias" input: "model.1.conv.bias" output: "input.4" name: "Conv_6" op_type: "Conv" attribute { name: "dilations" ints: 1 ints: 1 type: INTS } attribute { name: "group" i: 1 type: INT } attribute { name: "kernel_shape" ints: 3 ints: 3 type: INTS } attribute { name: "pads" ints: 1 ints: 1 ints: 1 ints: 1 type: INTS } attribute { name: "strides" ints: 2 ints: 2 type: INTS }

[04/06/2023-11:03:42] [E] [TRT] ModelImporter.cpp:776: --- End node --- [04/06/2023-11:03:42] [E] [TRT] ModelImporter.cpp:779: ERROR: builtin_op_importers.cpp:642 In function importConv: [8] Assertion failed: (nbSpatialDims == kernelWeights.shape.nbDims - 2) && "The number of spatial dimensions and the kernel shape doesn't match up for the Conv operator." [04/06/2023-11:03:42] [E] Failed to parse onnx file [04/06/2023-11:03:42] [I] Finish parsing network model [04/06/2023-11:03:42] [E] Parsing model failed [04/06/2023-11:03:42] [E] Failed to create engine from model. [04/06/2023-11:03:42] [E] Engine set up failed &&&& FAILED TensorRT.trtexec [TensorRT v8205] # trt.exe --onnx=last.onnx --saveEngine=last.engine

triple-Mu commented 1 year ago

How do you get onnx?

dadada-123 commented 1 year ago

use your export.py . python export.py -w last.pt --sim

triple-Mu commented 1 year ago

use your export.py . python export.py -w last.pt --sim

Could you please update your tensorrt to tensorrt8.6.0?

dadada-123 commented 1 year ago

D:\software\tensorrt\TensorRT-8.6.0.12\bin>trtexec.exe --onnx=last.onnx --saveEngine=last.engine &&&& RUNNING TensorRT.trtexec [TensorRT v8600] # trtexec.exe --onnx=last.onnx --saveEngine=last.engine [04/06/2023-11:33:12] [I] === Model Options === [04/06/2023-11:33:12] [I] Format: ONNX [04/06/2023-11:33:12] [I] Model: last.onnx [04/06/2023-11:33:12] [I] Output: [04/06/2023-11:33:12] [I] === Build Options === [04/06/2023-11:33:12] [I] Max batch: explicit batch [04/06/2023-11:33:12] [I] Memory Pools: workspace: default, dlaSRAM: default, dlaLocalDRAM: default, dlaGlobalDRAM: default [04/06/2023-11:33:12] [I] minTiming: 1 [04/06/2023-11:33:12] [I] avgTiming: 8 [04/06/2023-11:33:12] [I] Precision: FP32 [04/06/2023-11:33:12] [I] LayerPrecisions: [04/06/2023-11:33:12] [I] Layer Device Types: [04/06/2023-11:33:12] [I] Calibration: [04/06/2023-11:33:12] [I] Refit: Disabled [04/06/2023-11:33:12] [I] Version Compatible: Disabled [04/06/2023-11:33:12] [I] TensorRT runtime: full [04/06/2023-11:33:12] [I] Lean DLL Path: [04/06/2023-11:33:12] [I] Tempfile Controls: { in_memory: allow, temporary: allow } [04/06/2023-11:33:12] [I] Exclude Lean Runtime: Disabled [04/06/2023-11:33:12] [I] Sparsity: Disabled [04/06/2023-11:33:12] [I] Safe mode: Disabled [04/06/2023-11:33:12] [I] DirectIO mode: Disabled [04/06/2023-11:33:12] [I] Restricted mode: Disabled [04/06/2023-11:33:12] [I] Skip inference: Disabled [04/06/2023-11:33:12] [I] Save engine: last.engine [04/06/2023-11:33:12] [I] Load engine: [04/06/2023-11:33:12] [I] Profiling verbosity: 0 [04/06/2023-11:33:12] [I] Tactic sources: Using default tactic sources [04/06/2023-11:33:12] [I] timingCacheMode: local [04/06/2023-11:33:12] [I] timingCacheFile: [04/06/2023-11:33:12] [I] Heuristic: Disabled [04/06/2023-11:33:12] [I] Preview Features: Use default preview flags. [04/06/2023-11:33:12] [I] MaxAuxStreams: -1 [04/06/2023-11:33:12] [I] BuilderOptimizationLevel: 3 [04/06/2023-11:33:12] [I] Input(s)s format: fp32:CHW [04/06/2023-11:33:12] [I] Output(s)s format: fp32:CHW [04/06/2023-11:33:12] [I] Input build shapes: model [04/06/2023-11:33:12] [I] Input calibration shapes: model [04/06/2023-11:33:12] [I] === System Options === [04/06/2023-11:33:12] [I] Device: 0 [04/06/2023-11:33:12] [I] DLACore: [04/06/2023-11:33:12] [I] Plugins: [04/06/2023-11:33:12] [I] setPluginsToSerialize: [04/06/2023-11:33:12] [I] dynamicPlugins: [04/06/2023-11:33:12] [I] ignoreParsedPluginLibs: 0 [04/06/2023-11:33:12] [I] [04/06/2023-11:33:12] [I] === Inference Options === [04/06/2023-11:33:12] [I] Batch: Explicit [04/06/2023-11:33:12] [I] Input inference shapes: model [04/06/2023-11:33:12] [I] Iterations: 10 [04/06/2023-11:33:12] [I] Duration: 3s (+ 200ms warm up) [04/06/2023-11:33:12] [I] Sleep time: 0ms [04/06/2023-11:33:12] [I] Idle time: 0ms [04/06/2023-11:33:12] [I] Inference Streams: 1 [04/06/2023-11:33:12] [I] ExposeDMA: Disabled [04/06/2023-11:33:12] [I] Data transfers: Enabled [04/06/2023-11:33:12] [I] Spin-wait: Disabled [04/06/2023-11:33:12] [I] Multithreading: Disabled [04/06/2023-11:33:12] [I] CUDA Graph: Disabled [04/06/2023-11:33:12] [I] Separate profiling: Disabled [04/06/2023-11:33:12] [I] Time Deserialize: Disabled [04/06/2023-11:33:12] [I] Time Refit: Disabled [04/06/2023-11:33:12] [I] NVTX verbosity: 0 [04/06/2023-11:33:12] [I] Persistent Cache Ratio: 0 [04/06/2023-11:33:12] [I] Inputs: [04/06/2023-11:33:12] [I] === Reporting Options === [04/06/2023-11:33:12] [I] Verbose: Disabled [04/06/2023-11:33:12] [I] Averages: 10 inferences [04/06/2023-11:33:12] [I] Percentiles: 90,95,99 [04/06/2023-11:33:12] [I] Dump refittable layers:Disabled [04/06/2023-11:33:12] [I] Dump output: Disabled [04/06/2023-11:33:12] [I] Profile: Disabled [04/06/2023-11:33:12] [I] Export timing to JSON file: [04/06/2023-11:33:12] [I] Export output to JSON file: [04/06/2023-11:33:12] [I] Export profile to JSON file: [04/06/2023-11:33:12] [I] [04/06/2023-11:33:12] [I] === Device Information === [04/06/2023-11:33:12] [I] Selected Device: NVIDIA GeForce RTX 2060 [04/06/2023-11:33:12] [I] Compute Capability: 7.5 [04/06/2023-11:33:12] [I] SMs: 30 [04/06/2023-11:33:12] [I] Device Global Memory: 6143 MiB [04/06/2023-11:33:12] [I] Shared Memory per SM: 64 KiB [04/06/2023-11:33:12] [I] Memory Bus Width: 192 bits (ECC disabled) [04/06/2023-11:33:12] [I] Application Compute Clock Rate: 1.2 GHz [04/06/2023-11:33:12] [I] Application Memory Clock Rate: 5.501 GHz [04/06/2023-11:33:12] [I] [04/06/2023-11:33:12] [I] Note: The application clock rates do not reflect the actual clock rates that the GPU is currently running at. [04/06/2023-11:33:12] [I] [04/06/2023-11:33:12] [I] TensorRT version: 8.6.0 [04/06/2023-11:33:12] [I] Loading standard plugins [04/06/2023-11:33:13] [I] [TRT] [MemUsageChange] Init CUDA: CPU +448, GPU +0, now: CPU 6855, GPU 1155 (MiB) [04/06/2023-11:33:13] [I] [TRT] [MemUsageSnapshot] Begin constructing builder kernel library: CPU 6936 MiB, GPU 1155 MiB [04/06/2023-11:33:14] [I] [TRT] [MemUsageSnapshot] End constructing builder kernel library: CPU 7068 MiB, GPU 1191 MiB [04/06/2023-11:33:14] [I] Start parsing network model. [04/06/2023-11:33:14] [I] [TRT] ---------------------------------------------------------------- [04/06/2023-11:33:14] [I] [TRT] Input filename: last.onnx [04/06/2023-11:33:14] [I] [TRT] ONNX IR version: 0.0.6 [04/06/2023-11:33:14] [I] [TRT] Opset version: 11 [04/06/2023-11:33:14] [I] [TRT] Producer name: pytorch [04/06/2023-11:33:14] [I] [TRT] Producer version: 1.12.0 [04/06/2023-11:33:14] [I] [TRT] Domain: [04/06/2023-11:33:14] [I] [TRT] Model version: 0 [04/06/2023-11:33:14] [I] [TRT] Doc string: [04/06/2023-11:33:14] [I] [TRT] ---------------------------------------------------------------- [04/06/2023-11:33:14] [E] [TRT] ModelImporter.cpp:773: While parsing node number 3 [Conv -> "input.4"]: [04/06/2023-11:33:14] [E] [TRT] ModelImporter.cpp:774: --- Begin node --- [04/06/2023-11:33:14] [E] [TRT] ModelImporter.cpp:775: input: "onnx::Conv_213" input: "model.0.conv.bias" input: "model.1.conv.bias" output: "input.4" name: "Conv_6" op_type: "Conv" attribute { name: "dilations" ints: 1 ints: 1 type: INTS } attribute { name: "group" i: 1 type: INT } attribute { name: "kernel_shape" ints: 3 ints: 3 type: INTS } attribute { name: "pads" ints: 1 ints: 1 ints: 1 ints: 1 type: INTS } attribute { name: "strides" ints: 2 ints: 2 type: INTS }

[04/06/2023-11:33:14] [E] [TRT] ModelImporter.cpp:776: --- End node --- [04/06/2023-11:33:14] [E] [TRT] ModelImporter.cpp:779: ERROR: builtin_op_importers.cpp:642 In function importConv: [8] Assertion failed: (nbSpatialDims == kernelWeights.shape.nbDims - 2) && "The number of spatial dimensions and the kernel shape doesn't match up for the Conv operator." [04/06/2023-11:33:14] [E] Failed to parse onnx file [04/06/2023-11:33:14] [I] Finished parsing network model. Parse time: 0.0168854 [04/06/2023-11:33:14] [E] Parsing model failed [04/06/2023-11:33:14] [E] Failed to create engine from model or file. [04/06/2023-11:33:14] [E] Engine set up failed &&&& FAILED TensorRT.trtexec [TensorRT v8600] # trtexec.exe --onnx=last.onnx --saveEngine=last.engine

same problem

triple-Mu commented 1 year ago

D:\software\tensorrt\TensorRT-8.6.0.12\bin>trtexec.exe --onnx=last.onnx --saveEngine=last.engine &&&& RUNNING TensorRT.trtexec [TensorRT v8600] # trtexec.exe --onnx=last.onnx --saveEngine=last.engine [04/06/2023-11:33:12] [I] === Model Options === [04/06/2023-11:33:12] [I] Format: ONNX [04/06/2023-11:33:12] [I] Model: last.onnx [04/06/2023-11:33:12] [I] Output: [04/06/2023-11:33:12] [I] === Build Options === [04/06/2023-11:33:12] [I] Max batch: explicit batch [04/06/2023-11:33:12] [I] Memory Pools: workspace: default, dlaSRAM: default, dlaLocalDRAM: default, dlaGlobalDRAM: default [04/06/2023-11:33:12] [I] minTiming: 1 [04/06/2023-11:33:12] [I] avgTiming: 8 [04/06/2023-11:33:12] [I] Precision: FP32 [04/06/2023-11:33:12] [I] LayerPrecisions: [04/06/2023-11:33:12] [I] Layer Device Types: [04/06/2023-11:33:12] [I] Calibration: [04/06/2023-11:33:12] [I] Refit: Disabled [04/06/2023-11:33:12] [I] Version Compatible: Disabled [04/06/2023-11:33:12] [I] TensorRT runtime: full [04/06/2023-11:33:12] [I] Lean DLL Path: [04/06/2023-11:33:12] [I] Tempfile Controls: { in_memory: allow, temporary: allow } [04/06/2023-11:33:12] [I] Exclude Lean Runtime: Disabled [04/06/2023-11:33:12] [I] Sparsity: Disabled [04/06/2023-11:33:12] [I] Safe mode: Disabled [04/06/2023-11:33:12] [I] DirectIO mode: Disabled [04/06/2023-11:33:12] [I] Restricted mode: Disabled [04/06/2023-11:33:12] [I] Skip inference: Disabled [04/06/2023-11:33:12] [I] Save engine: last.engine [04/06/2023-11:33:12] [I] Load engine: [04/06/2023-11:33:12] [I] Profiling verbosity: 0 [04/06/2023-11:33:12] [I] Tactic sources: Using default tactic sources [04/06/2023-11:33:12] [I] timingCacheMode: local [04/06/2023-11:33:12] [I] timingCacheFile: [04/06/2023-11:33:12] [I] Heuristic: Disabled [04/06/2023-11:33:12] [I] Preview Features: Use default preview flags. [04/06/2023-11:33:12] [I] MaxAuxStreams: -1 [04/06/2023-11:33:12] [I] BuilderOptimizationLevel: 3 [04/06/2023-11:33:12] [I] Input(s)s format: fp32:CHW [04/06/2023-11:33:12] [I] Output(s)s format: fp32:CHW [04/06/2023-11:33:12] [I] Input build shapes: model [04/06/2023-11:33:12] [I] Input calibration shapes: model [04/06/2023-11:33:12] [I] === System Options === [04/06/2023-11:33:12] [I] Device: 0 [04/06/2023-11:33:12] [I] DLACore: [04/06/2023-11:33:12] [I] Plugins: [04/06/2023-11:33:12] [I] setPluginsToSerialize: [04/06/2023-11:33:12] [I] dynamicPlugins: [04/06/2023-11:33:12] [I] ignoreParsedPluginLibs: 0 [04/06/2023-11:33:12] [I] [04/06/2023-11:33:12] [I] === Inference Options === [04/06/2023-11:33:12] [I] Batch: Explicit [04/06/2023-11:33:12] [I] Input inference shapes: model [04/06/2023-11:33:12] [I] Iterations: 10 [04/06/2023-11:33:12] [I] Duration: 3s (+ 200ms warm up) [04/06/2023-11:33:12] [I] Sleep time: 0ms [04/06/2023-11:33:12] [I] Idle time: 0ms [04/06/2023-11:33:12] [I] Inference Streams: 1 [04/06/2023-11:33:12] [I] ExposeDMA: Disabled [04/06/2023-11:33:12] [I] Data transfers: Enabled [04/06/2023-11:33:12] [I] Spin-wait: Disabled [04/06/2023-11:33:12] [I] Multithreading: Disabled [04/06/2023-11:33:12] [I] CUDA Graph: Disabled [04/06/2023-11:33:12] [I] Separate profiling: Disabled [04/06/2023-11:33:12] [I] Time Deserialize: Disabled [04/06/2023-11:33:12] [I] Time Refit: Disabled [04/06/2023-11:33:12] [I] NVTX verbosity: 0 [04/06/2023-11:33:12] [I] Persistent Cache Ratio: 0 [04/06/2023-11:33:12] [I] Inputs: [04/06/2023-11:33:12] [I] === Reporting Options === [04/06/2023-11:33:12] [I] Verbose: Disabled [04/06/2023-11:33:12] [I] Averages: 10 inferences [04/06/2023-11:33:12] [I] Percentiles: 90,95,99 [04/06/2023-11:33:12] [I] Dump refittable layers:Disabled [04/06/2023-11:33:12] [I] Dump output: Disabled [04/06/2023-11:33:12] [I] Profile: Disabled [04/06/2023-11:33:12] [I] Export timing to JSON file: [04/06/2023-11:33:12] [I] Export output to JSON file: [04/06/2023-11:33:12] [I] Export profile to JSON file: [04/06/2023-11:33:12] [I] [04/06/2023-11:33:12] [I] === Device Information === [04/06/2023-11:33:12] [I] Selected Device: NVIDIA GeForce RTX 2060 [04/06/2023-11:33:12] [I] Compute Capability: 7.5 [04/06/2023-11:33:12] [I] SMs: 30 [04/06/2023-11:33:12] [I] Device Global Memory: 6143 MiB [04/06/2023-11:33:12] [I] Shared Memory per SM: 64 KiB [04/06/2023-11:33:12] [I] Memory Bus Width: 192 bits (ECC disabled) [04/06/2023-11:33:12] [I] Application Compute Clock Rate: 1.2 GHz [04/06/2023-11:33:12] [I] Application Memory Clock Rate: 5.501 GHz [04/06/2023-11:33:12] [I] [04/06/2023-11:33:12] [I] Note: The application clock rates do not reflect the actual clock rates that the GPU is currently running at. [04/06/2023-11:33:12] [I] [04/06/2023-11:33:12] [I] TensorRT version: 8.6.0 [04/06/2023-11:33:12] [I] Loading standard plugins [04/06/2023-11:33:13] [I] [TRT] [MemUsageChange] Init CUDA: CPU +448, GPU +0, now: CPU 6855, GPU 1155 (MiB) [04/06/2023-11:33:13] [I] [TRT] [MemUsageSnapshot] Begin constructing builder kernel library: CPU 6936 MiB, GPU 1155 MiB [04/06/2023-11:33:14] [I] [TRT] [MemUsageSnapshot] End constructing builder kernel library: CPU 7068 MiB, GPU 1191 MiB [04/06/2023-11:33:14] [I] Start parsing network model. [04/06/2023-11:33:14] [I] [TRT] ---------------------------------------------------------------- [04/06/2023-11:33:14] [I] [TRT] Input filename: last.onnx [04/06/2023-11:33:14] [I] [TRT] ONNX IR version: 0.0.6 [04/06/2023-11:33:14] [I] [TRT] Opset version: 11 [04/06/2023-11:33:14] [I] [TRT] Producer name: pytorch [04/06/2023-11:33:14] [I] [TRT] Producer version: 1.12.0 [04/06/2023-11:33:14] [I] [TRT] Domain: [04/06/2023-11:33:14] [I] [TRT] Model version: 0 [04/06/2023-11:33:14] [I] [TRT] Doc string: [04/06/2023-11:33:14] [I] [TRT] ---------------------------------------------------------------- [04/06/2023-11:33:14] [E] [TRT] ModelImporter.cpp:773: While parsing node number 3 [Conv -> "input.4"]: [04/06/2023-11:33:14] [E] [TRT] ModelImporter.cpp:774: --- Begin node --- [04/06/2023-11:33:14] [E] [TRT] ModelImporter.cpp:775: input: "onnx::Conv_213" input: "model.0.conv.bias" input: "model.1.conv.bias" output: "input.4" name: "Conv_6" op_type: "Conv" attribute { name: "dilations" ints: 1 ints: 1 type: INTS } attribute { name: "group" i: 1 type: INT } attribute { name: "kernel_shape" ints: 3 ints: 3 type: INTS } attribute { name: "pads" ints: 1 ints: 1 ints: 1 ints: 1 type: INTS } attribute { name: "strides" ints: 2 ints: 2 type: INTS }

[04/06/2023-11:33:14] [E] [TRT] ModelImporter.cpp:776: --- End node --- [04/06/2023-11:33:14] [E] [TRT] ModelImporter.cpp:779: ERROR: builtin_op_importers.cpp:642 In function importConv: [8] Assertion failed: (nbSpatialDims == kernelWeights.shape.nbDims - 2) && "The number of spatial dimensions and the kernel shape doesn't match up for the Conv operator." [04/06/2023-11:33:14] [E] Failed to parse onnx file [04/06/2023-11:33:14] [I] Finished parsing network model. Parse time: 0.0168854 [04/06/2023-11:33:14] [E] Parsing model failed [04/06/2023-11:33:14] [E] Failed to create engine from model or file. [04/06/2023-11:33:14] [E] Engine set up failed &&&& FAILED TensorRT.trtexec [TensorRT v8600] # trtexec.exe --onnx=last.onnx --saveEngine=last.engine

same problem

Ok could you please git me your onnx model. My email: gpu@163.com

dadada-123 commented 1 year ago

sorry ,when i want to give onnx model ,i found the model size only 419kb image What caused it

triple-Mu commented 1 year ago

Could you please update your tensorrt to tensorrt8.6.0?

Show me your export detail log please.

dadada-123 commented 1 year ago

image

triple-Mu commented 1 year ago

image

It seems work well. Maybe cause by ByteIO api. You can try replace it by real path.

dadada-123 commented 1 year ago

sorry, could you tell me how to replace it by real path

triple-Mu commented 1 year ago
f = 'result.onnx'

torch.onnx.export(
    model,
    fake_input,
    f,
    opset_version=args.opset,
    input_names=['images'],
    output_names=['num_dets', 'bboxes', 'scores', 'labels'])

onnx_model = onnx.load(f)
onnx.checker.check_model(onnx_model)
shapes = [b, 1, b, args.topk, 4, b, args.topk, b, args.topk]
for i in onnx_model.graph.output:
    for j in i.type.tensor_type.shape.dim:
        j.dim_param = str(shapes.pop(0))
if args.sim:
    try:
        onnx_model, check = onnxsim.simplify(onnx_model)
        assert check, 'assert check failed'
    except Exception as e:
        print(f'Simplifier failure: {e}')
onnx.save(onnx_model, f)
dadada-123 commented 1 year ago

I found a strange phenomenon,the onnx model size change to 101076kb and then change to 1323kb image image

dadada-123 commented 1 year ago

image

dadada-123 commented 1 year ago

when i delete onnx.save(onnx_model, f) the onnx model work well

triple-Mu commented 1 year ago

when i delete onnx.save(onnx_model, f) the onnx model work well

Great. It may cause by io in windows. BTW, does tensorrt work well?

dadada-123 commented 1 year ago

Not well, still exists one object with two labels,is there any way to solve it

triple-Mu commented 1 year ago

Not well, still exists one object with two labels,is there any way to solve it

Suggest using tensorrt ngc docker in windows.

triple-Mu commented 1 year ago

closed, feel free to reopen it if you have further questions. Thanks!