Closed gstariarch closed 11 months ago
hi, could you run visualize_model seperately with the end2end.onnx
?
from mmdeploy.apis import visualize_model
from mmdeploy.apis.utils import to_backend
backend_files = ['xxx\end2end.onnx']
visualize_model(model_config_path, deploy_config_path, backend_files, test_img_path,
args.device, backend=Backend.ONNXRUNTIME, output_file='./ort.png', show_result=True)
import argparse import logging import os import os.path as osp from functools import partial import mmengine
import torch.multiprocessing as mp from torch.multiprocessing import Process, set_start_method
from mmdeploy.apis import (create_calib_input_data, extract_model, get_predefined_partition_cfg, torch2onnx, torch2torchscript, visualize_model) from mmdeploy.apis.core import PIPELINE_MANAGER from mmdeploy.apis.utils import to_backend from mmdeploy.backend.sdk.export_info import export2SDK from mmdeploy.utils import (IR, Backend, get_backend, get_calib_filename, get_ir_config, get_partition_config, get_root_logger, load_config, target_wrapper)
from mmdeploy.apis import visualize_model from mmdeploy.apis.utils import to_backend
def main(): backend_files = ['I:\AILab\mmdeploy_model/rtmdet-cpu\end2end.onnx'] visualize_model('I:\AILab\模型部署_230921/rotated_rtmdet_s_300e_FL_dota.py', 'I:\AILab\MMDeploy\configs\mmrotate/rotated-detection_onnxruntime_dynamic.py', backend_files, 'I:\AILab\模型部署_230921/test2_922x1844.png', 'cpu', backend=Backend.ONNXRUNTIME, output_file='I:\AILab\模型部署_230921/test2_922x1844ort.png', show_result=True)
if name == 'main': main()
////////////////////////////////// (mmdeploy_fl_1.x) I:\AILab>python mmdeploy/tools/mytest.py 09/22 09:53:20 - mmengine - WARNING - Failed to search registry with scope "mmrotate" 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 "mmrotate" is a correct scope, or whether the registry is initialized. 09/22 09:53:20 - mmengine - WARNING - Failed to search registry with scope "mmrotate" in the "mmrotate_tasks" registry tree. As a workaround, the current "mmrotate_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmrotate" is a correct scope, or whether the registry is initialized. 09/22 09:53:20 - mmengine - WARNING - Failed to search registry with scope "mmrotate" 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 "mmrotate" is a correct scope, or whether the registry is initialized. 09/22 09:53:21 - mmengine - INFO - Successfully loaded onnxruntime custom ops from i:\ailab\mmdeploy\mmdeploy\lib\mmdeploy_onnxruntime_ops.dll 09/22 09:53:21 - mmengine - WARNING - "FileClient" will be deprecated in future. Please use io functions in https://mmengine.readthedocs.io/en/latest/api/fileio.html#file-io 09/22 09:53:21 - mmengine - WARNING - "HardDiskBackend" is the alias of "LocalBackend" and the former will be deprecated in future.
可以运行 但没生成标注图片
This issue is marked as stale because it has been marked as invalid or awaiting response for 7 days without any further response. It will be closed in 5 days if the stale label is not removed or if there is no further response.
This issue is closed because it has been stale for 5 days. Please open a new issue if you have similar issues or you have any new updates now.
Checklist
Describe the bug
(mmdeploy_fl_1.x) I:\AILab>python mmdeploy/tools/deploy.py ^ More? mmdeploy\configs\mmrotate\rotated-detection_onnxruntime_dynamic.py ^ More? 模型部署_230921\rotated_rtmdet_s_300e_FL_dota.py ^ More? 模型部署_230921/best_dota_mAP_epoch_368.pth ^ More? 模型部署_230921\test2_922x1844.png ^ More? --work-dir mmdeploy_model/rotrtmdet-cpu ^ More? --device cpu ^ More? --dump-info 09/21 21:51:16 - mmengine - WARNING - Failed to search registry with scope "mmrotate" 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 "mmrotate" is a correct scope, or whether the registry is initialized. 09/21 21:51:16 - mmengine - WARNING - Failed to search registry with scope "mmrotate" in the "mmrotate_tasks" registry tree. As a workaround, the current "mmrotate_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmrotate" is a correct scope, or whether the registry is initialized. 09/21 21:51:17 - mmengine - INFO - Start pipeline mmdeploy.apis.pytorch2onnx.torch2onnx in subprocess 09/21 21:51:18 - mmengine - WARNING - Failed to search registry with scope "mmrotate" 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 "mmrotate" is a correct scope, or whether the registry is initialized. 09/21 21:51:18 - mmengine - WARNING - Failed to search registry with scope "mmrotate" in the "mmrotate_tasks" registry tree. As a workaround, the current "mmrotate_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmrotate" is a correct scope, or whether the registry is initialized. Loads checkpoint by local backend from path: 模型部署_230921/best_dota_mAP_epoch_368.pth 09/21 21:51:19 - mmengine - WARNING - "FileClient" will be deprecated in future. Please use io functions in https://mmengine.readthedocs.io/en/latest/api/fileio.html#file-io 09/21 21:51:19 - mmengine - WARNING - "HardDiskBackend" is the alias of "LocalBackend" and the former will be deprecated in future. 09/21 21:51:19 - mmengine - WARNING - DeprecationWarning: get_onnx_config will be deprecated in the future. 09/21 21:51:19 - mmengine - INFO - Export PyTorch model to ONNX: mmdeploy_model/rotrtmdet-cpu\end2end.onnx. i:\ailab\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) D:\miniconda3\envs\mmdeploy_fl_1.x\lib\site-packages\torch\functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\TensorShape.cpp:3191.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] i:\ailab\mmdeploy\mmdeploy\pytorch\functions\topk.py:28: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect. k = torch.tensor(k, device=input.device, dtype=torch.long) i:\ailab\mmdeploy\mmdeploy\mmcv\ops\nms_rotated.py:40: 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! if _boxes.shape[0] == 0: D:\miniconda3\envs\mmdeploy_fl_1.x\lib\site-packages\mmcv\ops\nms.py:401: 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! if dets.shape[0] == 0: D:\miniconda3\envs\mmdeploy_fl_1.x\lib\site-packages\torch\onnx\symbolic_opset9.py:5408: UserWarning: Exporting aten::index operator of advanced indexing in opset 11 is achieved by combination of multiple ONNX operators, including Reshape, Transpose, Concat, and Gather. If indices include negative values, the exported graph will produce incorrect results. warnings.warn( i:\ailab\mmdeploy\mmdeploy\mmcv\ops\nms_rotated.py:73: FutureWarning: 'torch.onnx._patch_torch._graph_op' is deprecated in version 1.13 and will be removed in version 1.14. Please note 'g.op()' is to be removed from torch.Graph. Please open a GitHub issue if you need this functionality.. return g.op( D:\miniconda3\envs\mmdeploy_fl_1.x\lib\site-packages\torch\onnx_patch_torch.py:81: UserWarning: The shape inference of mmdeploy::NMSRotated type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. (Triggered internally at C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\torch\csrc\jit\passes\onnx\shape_type_inference.cpp:1888.) _C._jit_pass_onnx_node_shape_type_inference( D:\miniconda3\envs\mmdeploy_fl_1.x\lib\site-packages\torch\onnx\utils.py:687: UserWarning: The shape inference of mmdeploy::NMSRotated type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. (Triggered internally at C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\torch\csrc\jit\passes\onnx\shape_type_inference.cpp:1888.) _C._jit_pass_onnx_graph_shape_type_inference( D:\miniconda3\envs\mmdeploy_fl_1.x\lib\site-packages\torch\onnx\utils.py:1178: UserWarning: The shape inference of mmdeploy::NMSRotated type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. (Triggered internally at C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\torch\csrc\jit\passes\onnx\shape_type_inference.cpp:1888.) _C._jit_pass_onnx_graph_shape_type_inference( 09/21 21:51:28 - mmengine - INFO - Execute onnx optimize passes. 09/21 21:51:29 - mmengine - INFO - Finish pipeline mmdeploy.apis.pytorch2onnx.torch2onnx 09/21 21:51:29 - mmengine - INFO - Start pipeline mmdeploy.apis.utils.utils.to_backend in main process 09/21 21:51:29 - mmengine - INFO - Finish pipeline mmdeploy.apis.utils.utils.to_backend 09/21 21:51:29 - mmengine - INFO - visualize onnxruntime model start. 09/21 21:51:31 - mmengine - WARNING - Failed to search registry with scope "mmrotate" 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 "mmrotate" is a correct scope, or whether the registry is initialized. 09/21 21:51:31 - mmengine - WARNING - Failed to search registry with scope "mmrotate" in the "mmrotate_tasks" registry tree. As a workaround, the current "mmrotate_tasks" registry in "mmdeploy" is used to build instance. This may cause unexpected failure when running the built modules. Please check whether "mmrotate" is a correct scope, or whether the registry is initialized. 09/21 21:51:31 - mmengine - WARNING - Failed to search registry with scope "mmrotate" 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 "mmrotate" is a correct scope, or whether the registry is initialized. 09/21 21:51:31 - mmengine - INFO - Successfully loaded onnxruntime custom ops from i:\ailab\mmdeploy\mmdeploy\lib\mmdeploy_onnxruntime_ops.dll 09/21 21:51:32 - mmengine - WARNING - "FileClient" will be deprecated in future. Please use io functions in https://mmengine.readthedocs.io/en/latest/api/fileio.html#file-io 09/21 21:51:32 - mmengine - WARNING - "HardDiskBackend" is the alias of "LocalBackend" and the former will be deprecated in future. 09/21 21:51:32 - mmengine - ERROR - mmdeploy/tools/deploy.py - create_process - 82 - visualize onnxruntime model failed.
Reproduction
(mmdeploy_fl_1.x) I:\AILab>python mmdeploy/tools/deploy.py ^ More? mmdeploy\configs\mmrotate\rotated-detection_onnxruntime_dynamic.py ^ More? 模型部署_230921\rotated_rtmdet_s_300e_FL_dota.py ^ More? 模型部署_230921/best_dota_mAP_epoch_368.pth ^ More? 模型部署_230921\test2_922x1844.png ^ More? --work-dir mmdeploy_model/rotrtmdet-cpu ^ More? --device cpu ^ More? --dump-info
Environment
Error traceback
No response