mmdeploy: [Bug] use trtexec to transfer engine model to report error

Checklist

  • I have searched related issues but cannot get the expected help.
  • 2. I have read the FAQ documentation but cannot get the expected help.
  • 3. The bug has not been fixed in the latest version.

Describe the bug

[03/28/2023-11:22:54] [E] Cannot find input tensor with name “images” in the network inputs! Please make sure the input tensor names are correct. [03/28/2023-11:22:54] [E] Network And Config setup failed [03/28/2023-11:22:54] [E] Building engine failed [03/28/2023-11:22:54] [E] Failed to create engine from model or file. [03/28/2023-11:22:54] [E] Engine set up failed

Reproduction

&&&& FAILED TensorRT.trtexec [TensorRT v8402] # ./trtexec --onnx=/home/panda/Pycharm/openMMlab/mmyolo/yolo_model_dir/yolov5_s_coco-c5-n7w/end2end.onnx --saveEngine=/home/panda/Pycharm/openMMlab/engine_file/yolov5_s_mmyolo.engine --workspace=10240 --plugins=/home/panda/Pycharm/openMMlab/mmdeploy/build/lib/libmmdeploy_tensorrt_ops.so --buildOnly --minShapes=images:1x3x640x640 --optShapes=images:1x3x640x640 --maxShapes=images:1x3x640x640

Environment

(openmmlab) panda@amd:~/Pycharm/openMMlab$ python mmdeploy/tools/deploy.py mmyolo/configs/deploy/detection_tensorrt_static-640x640.py mmyolo/work_train_dir/yolov5_s_coco-c5-n7w/yolov5_s-v61_syncbn_fast_8xb16-300e_images3000.py mmyolo/work_train_dir/yolov5_s_coco-c5-n7w/best_coco/bbox_mAP_epoch_194.pth mmyolo/data/work-1000/images/0433.jpg --dump-info --work-dir mmyolo/yolo_model_dir/yolov5_s_coco-c5-n7w
03/28 11:20:10 - mmengine - WARNING - Failed to get codebase, got: 'Cannot get key by value "mmyolo" of <enum \'Codebase\'>'. Then export a new codebase in Codebase MMYOLO: mmyolo
03/28 11:20:10 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:10 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:10 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:20:10 - mmengine - WARNING - The "mmyolo_tasks" registry in mmyolo did not set import location. Fallback to call `mmyolo.utils.register_all_modules` instead.
03/28 11:20:10 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:10 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:20:10 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:10 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:20:10 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:10 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:20:10 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:10 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:20:10 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:10 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:20:10 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:10 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:20:10 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:10 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:20:10 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:10 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:20:10 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:10 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:20:10 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:10 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:20:10 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:10 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:20:10 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:10 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:20:10 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:10 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:20:11 - mmengine - INFO - Start pipeline mmdeploy.apis.pytorch2onnx.torch2onnx in subprocess
03/28 11:20:11 - mmengine - WARNING - Failed to get codebase, got: 'Cannot get key by value "mmyolo" of <enum \'Codebase\'>'. Then export a new codebase in Codebase MMYOLO: mmyolo
03/28 11:20:11 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:11 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:11 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:20:11 - mmengine - WARNING - The "mmyolo_tasks" registry in mmyolo did not set import location. Fallback to call `mmyolo.utils.register_all_modules` instead.
03/28 11:20:11 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:20:11 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
Loads checkpoint by local backend from path: mmyolo/work_train_dir/yolov5_s_coco-c5-n7w/best_coco/bbox_mAP_epoch_194.pth
Switch model to deploy modality.
03/28 11:20:14 - mmengine - WARNING - DeprecationWarning: get_onnx_config will be deprecated in the future. 
03/28 11:20:14 - mmengine - INFO - Export PyTorch model to ONNX: mmyolo/yolo_model_dir/yolov5_s_coco-c5-n7w/end2end.onnx.
03/28 11:20:14 - mmengine - WARNING - Can not find torch._C._jit_pass_onnx_autograd_function_process, function rewrite will not be applied
03/28 11:20:14 - mmengine - WARNING - Can not find mmdet.models.dense_heads.DETRHead.forward_single, function rewrite will not be applied
03/28 11:20:14 - mmengine - WARNING - Can not find torch._C._jit_pass_onnx_deduplicate_initializers, function rewrite will not be applied
03/28 11:20:14 - mmengine - WARNING - Can not find mmdet.models.utils.transformer.PatchMerging.forward, function rewrite will not be applied
/home/panda/Pycharm/openMMlab/mmdeploy/mmdeploy/codebase/mmdet/models/detectors/single_stage.py:84: TracerWarning: Iterating over a tensor might cause the trace to be incorrect. Passing a tensor of different shape won't change the number of iterations executed (and might lead to errors or silently give incorrect results).
  img_shape = [int(val) for val in img_shape]
/home/panda/Pycharm/openMMlab/mmdeploy/mmdeploy/codebase/mmdet/models/detectors/single_stage.py:84: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  img_shape = [int(val) for val in img_shape]
/home/panda/Pycharm/openMMlab/mmdeploy/mmdeploy/core/optimizers/function_marker.py:160: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  ys_shape = tuple(int(s) for s in ys.shape)
/home/panda/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmyolo/models/task_modules/coders/yolov5_bbox_coder.py:35: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  assert pred_bboxes.size(-1) == priors.size(-1) == 4
/home/panda/Pycharm/openMMlab/mmdeploy/mmdeploy/mmcv/ops/nms.py:451: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  int(scores.shape[-1]),
/home/panda/Pycharm/openMMlab/mmdeploy/mmdeploy/mmcv/ops/nms.py:148: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  out_boxes = min(num_boxes, after_topk)
WARNING: The shape inference of mmdeploy::TRTBatchedNMS type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function.
WARNING: The shape inference of mmdeploy::TRTBatchedNMS type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function.
WARNING: The shape inference of mmdeploy::TRTBatchedNMS type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function.
WARNING: The shape inference of mmdeploy::TRTBatchedNMS type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function.
WARNING: The shape inference of mmdeploy::TRTBatchedNMS type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function.
WARNING: The shape inference of mmdeploy::TRTBatchedNMS type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function.
03/28 11:20:16 - mmengine - INFO - Execute onnx optimize passes.
03/28 11:20:17 - mmengine - INFO - Finish pipeline mmdeploy.apis.pytorch2onnx.torch2onnx
03/28 11:20:18 - mmengine - INFO - Start pipeline mmdeploy.apis.utils.utils.to_backend in subprocess
03/28 11:20:18 - mmengine - INFO - Successfully loaded tensorrt plugins from /home/panda/Pycharm/openMMlab/mmdeploy/mmdeploy/lib/libmmdeploy_tensorrt_ops.so
[03/28/2023-11:20:18] [TRT] [I] [MemUsageChange] Init CUDA: CPU +329, GPU +0, now: CPU 409, GPU 690 (MiB)
[03/28/2023-11:20:19] [TRT] [I] [MemUsageChange] Init builder kernel library: CPU +327, GPU +104, now: CPU 755, GPU 794 (MiB)
[03/28/2023-11:20:19] [TRT] [I] ----------------------------------------------------------------
[03/28/2023-11:20:19] [TRT] [I] Input filename:   mmyolo/yolo_model_dir/yolov5_s_coco-c5-n7w/end2end.onnx
[03/28/2023-11:20:19] [TRT] [I] ONNX IR version:  0.0.7
[03/28/2023-11:20:19] [TRT] [I] Opset version:    11
[03/28/2023-11:20:19] [TRT] [I] Producer name:    pytorch
[03/28/2023-11:20:19] [TRT] [I] Producer version: 1.10
[03/28/2023-11:20:19] [TRT] [I] Domain:           
[03/28/2023-11:20:19] [TRT] [I] Model version:    0
[03/28/2023-11:20:19] [TRT] [I] Doc string:       
[03/28/2023-11:20:19] [TRT] [I] ----------------------------------------------------------------
[03/28/2023-11:20:19] [TRT] [W] onnx2trt_utils.cpp:369: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
[03/28/2023-11:20:19] [TRT] [W] onnx2trt_utils.cpp:395: One or more weights outside the range of INT32 was clamped
[03/28/2023-11:20:19] [TRT] [I] No importer registered for op: TRTBatchedNMS. Attempting to import as plugin.
[03/28/2023-11:20:19] [TRT] [I] Searching for plugin: TRTBatchedNMS, plugin_version: 1, plugin_namespace: 
[03/28/2023-11:20:19] [TRT] [I] Successfully created plugin: TRTBatchedNMS
[03/28/2023-11:20:19] [TRT] [I] [MemUsageChange] Init cuBLAS/cuBLASLt: CPU +747, GPU +318, now: CPU 1534, GPU 1112 (MiB)
[03/28/2023-11:20:20] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +618, GPU +268, now: CPU 2152, GPU 1380 (MiB)
[03/28/2023-11:20:20] [TRT] [W] TensorRT was linked against cuDNN 8.4.1 but loaded cuDNN 8.2.1
[03/28/2023-11:20:20] [TRT] [I] Local timing cache in use. Profiling results in this builder pass will not be stored.
[03/28/2023-11:20:37] [TRT] [I] Some tactics do not have sufficient workspace memory to run. Increasing workspace size will enable more tactics, please check verbose output for requested sizes.
[03/28/2023-11:21:16] [TRT] [I] Detected 1 inputs and 2 output network tensors.
[03/28/2023-11:21:18] [TRT] [I] Total Host Persistent Memory: 121648
[03/28/2023-11:21:18] [TRT] [I] Total Device Persistent Memory: 154112
[03/28/2023-11:21:18] [TRT] [I] Total Scratch Memory: 8225280
[03/28/2023-11:21:18] [TRT] [I] [MemUsageStats] Peak memory usage of TRT CPU/GPU memory allocators: CPU 7 MiB, GPU 561 MiB
[03/28/2023-11:21:18] [TRT] [I] [BlockAssignment] Algorithm ShiftNTopDown took 11.5582ms to assign 8 blocks to 149 nodes requiring 35683328 bytes.
[03/28/2023-11:21:18] [TRT] [I] Total Activation Memory: 35683328
[03/28/2023-11:21:18] [TRT] [I] [MemUsageChange] Init cuBLAS/cuBLASLt: CPU +0, GPU +8, now: CPU 5648, GPU 3206 (MiB)
[03/28/2023-11:21:18] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +1, GPU +8, now: CPU 5649, GPU 3214 (MiB)
[03/28/2023-11:21:18] [TRT] [W] TensorRT was linked against cuDNN 8.4.1 but loaded cuDNN 8.2.1
[03/28/2023-11:21:18] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in building engine: CPU +3, GPU +30, now: CPU 3, GPU 30 (MiB)
[03/28/2023-11:21:18] [TRT] [W] The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1.
[03/28/2023-11:21:18] [TRT] [W] The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1.
03/28 11:21:18 - mmengine - INFO - Finish pipeline mmdeploy.apis.utils.utils.to_backend
03/28 11:21:19 - mmengine - INFO - visualize tensorrt model start.
03/28 11:21:19 - mmengine - WARNING - Failed to get codebase, got: 'Cannot get key by value "mmyolo" of <enum \'Codebase\'>'. Then export a new codebase in Codebase MMYOLO: mmyolo
03/28 11:21:20 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:21:20 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:21:20 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:21:20 - mmengine - WARNING - The "mmyolo_tasks" registry in mmyolo did not set import location. Fallback to call `mmyolo.utils.register_all_modules` instead.
03/28 11:21:20 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:21:20 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:21:20 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "backend_detectors" registry tree. As a workaround, the current "backend_detectors" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:21:20 - mmengine - INFO - Successfully loaded tensorrt plugins from /home/panda/Pycharm/openMMlab/mmdeploy/mmdeploy/lib/libmmdeploy_tensorrt_ops.so
03/28 11:21:20 - mmengine - INFO - Successfully loaded tensorrt plugins from /home/panda/Pycharm/openMMlab/mmdeploy/mmdeploy/lib/libmmdeploy_tensorrt_ops.so
[03/28/2023-11:21:21] [TRT] [W] TensorRT was linked against cuDNN 8.4.1 but loaded cuDNN 8.2.1
[03/28/2023-11:21:21] [TRT] [W] TensorRT was linked against cuDNN 8.4.1 but loaded cuDNN 8.2.1
03/28 11:21:24 - mmengine - INFO - visualize tensorrt model success.
03/28 11:21:24 - mmengine - INFO - visualize pytorch model start.
03/28 11:21:25 - mmengine - WARNING - Failed to get codebase, got: 'Cannot get key by value "mmyolo" of <enum \'Codebase\'>'. Then export a new codebase in Codebase MMYOLO: mmyolo
03/28 11:21:25 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:21:25 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:21:25 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
03/28 11:21:25 - mmengine - WARNING - The "mmyolo_tasks" registry in mmyolo did not set import location. Fallback to call `mmyolo.utils.register_all_modules` instead.
03/28 11:21:25 - mmengine - WARNING - Import mmdeploy.codebase.mmyolo.deploy failedPlease check whether the module is the custom module.No module named 'mmdeploy.codebase.mmyolo'
03/28 11:21:25 - mmengine - WARNING - Failed to search registry with scope "mmyolo" in the "Codebases" registry tree. As a workaround, the current "Codebases" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmyolo" is a correct scope, or whether the registry is initialized.
Loads checkpoint by local backend from path: mmyolo/work_train_dir/yolov5_s_coco-c5-n7w/best_coco/bbox_mAP_epoch_194.pth
Switch model to deploy modality.
03/28 11:21:29 - mmengine - INFO - visualize pytorch model success.
03/28 11:21:29 - mmengine - INFO - All process success.

Error traceback

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 22

Most upvoted comments

Ok, I want to infer the model of mmyolo on the backend of tensorrt C++, but there has been some problems. here is my Baidu cloud link and the steps I took 链接:https://pan.baidu.com/s/1RNRDBbojSyxyuHLkeVp9NQ 提取码:5u6s 1.Use the YOLOv5s model provided by mmyolo to train my own dataset; command:python tools/train.py yolov5_s-v61_syncbn_fast_8xb16-300e_images3000.py --amp

2.Use the script provided by mmdeploy to export static and dynamic models respectively; command: python mmdeploy/tools/deploy.py mmyolo/configs/deploy/detection_tensorrt_static-640x640.py mmyolo/work_train_dir/yolov5_s_coco-c5-n7w/yolov5_s-v61_syncbn_fast_8xb16-300e_images3000.py mmyolo/work_train_dir/yolov5_s_coco-c5-n7w/best_coco/bbox_mAP_epoch_194.pth data/work-1000/images/0043.jpg --work-dir mmyolo/yolo_model_dir/yolov5_s_coco-c5-n7w --dump-info

3.Use trtexe file to convert onnx file to engine model(static) command: ./trtexec --onnx=/home/panda/Pycharm/openMMlab/mmyolo/yolo_model_dir/yolov5_s_coco-c5-n7w/end2end.onnx --saveEngine=/home/panda/Pycharm/openMMlab/engine_file/yolov5_s_mmyolo.engine --workspace=10240 --plugins=/home/panda/Pycharm/openMMlab/mmdeploy/build/lib/libmmdeploy_tensorrt_ops.so

4.3.Use trtexe file to convert onnx file to engine model(dynamic) command: ./trtexec --onnx=/home/panda/Pycharm/openMMlab/mmyolo/yolo_model_dir/yolov5_s_coco-c5-n7w-dynamic/end2end.onnx --saveEngine=/home/panda/Pycharm/openMMlab/engine_file/yolov5_s_mmyolo.engine --workspace=10240 --plugins=/home/panda/Pycharm/openMMlab/mmdeploy/build/lib/libmmdeploy_tensorrt_ops.so --optShapes=input:1x3x640x640

[03/28/2023-14:22:47] [I] [TRT] Successfully created plugin: TRTBatchedNMS [03/28/2023-14:22:47] [I] Finish parsing network model [03/28/2023-14:22:47] [E] Static model does not take explicit shapes since the shape of inference tensors will be determined by the model itself [03/28/2023-14:22:47] [E] Network And Config setup failed [03/28/2023-14:22:47] [E] Building engine failed [03/28/2023-14:22:47] [E] Failed to create engine from model or file. [03/28/2023-14:22:47] [E] Engine set up failed &&&& FAILED TensorRT.trtexec [TensorRT v8402] # ./trtexec --onnx=/home/panda/Pycharm/openMMlab/mmyolo/yolo_model_dir/yolov5_s_coco-c5-n7w/end2end.onnx --saveEngine=/home/panda/Pycharm/openMMlab/engine_file/yolov5_s_mmyolo.engine --workspace=10240 --plugins=/home/panda/Pycharm/openMMlab/mmdeploy/build/lib/libmmdeploy_tensorrt_ops.so --buildOnly --optShapes=input:1x3x640x640