Closed likecv closed 1 year ago
Please check your environment.
MMDeploy master or tag v0.xx is target to original openmmlab algorithm repo and MMDeploy dev-1.x and tag v1.xx is target to newly openmmlab algorithm repo.
Since you installed mmengine, I doubt you are using newly openmmlab algorithm repo, so you should use MMDeploy dev-1.x branch or tag v1.xx
Please check your environment.
MMDeploy master or tag v0.xx is target to original openmmlab algorithm repo and MMDeploy dev-1.x and tag v1.xx is target to newly openmmlab algorithm repo.
Since you installed mmengine, I doubt you are using newly openmmlab algorithm repo, so you should use MMDeploy dev-1.x branch or tag v1.xx
mmdeploy/tools/torch2onnx.py, hello, Do you have README.md for torch2onnx
python3 mmdeploy/tools/pytorch2onnx.py home/mmdetection/ssdlite_mobilenetv2_scratch_600e_coco.py home/mmdetection/ssdlite_mobilenetv2_scratch_600e_coco_20210629_110627-974d9307.pth --output-file=onnx/ssdlite_mobilenetv2.onnx --shape 320 python3: can't open file 'mmdeploy/tools/pytorch2onnx.py': [Errno 2] No such file or directory (mmdet)@/home/MMLab$ python3 mmdeploy/tools/torch2onnx.py \
home/mmdetection/ssdlite_mobilenetv2_scratch_600e_coco.py \ home/mmdetection/ssdlite_mobilenetv2_scratch_600e_coco_20210629_110627-974d9307.pth \ --output-file=onnx/ssdlite_mobilenetv2.onnx \ --shape 320 Traceback (most recent call last): File "mmdeploy/tools/torch2onnx.py", line 7, in
from mmdeploy.apis import (extract_model, get_predefined_partition_cfg, File "/home/MMLab/mmdeploy/mmdeploy/init.py", line 4, in from mmdeploy.utils import get_root_logger File "/home/MMLab/mmdeploy/mmdeploy/utils/init.py", line 18, in from .config_utils import (cfg_apply_marks, get_backend, File "/home/MMLab/mmdeploy/mmdeploy/utils/config_utils.py", line 10, in def load_config(*args) -> List[mmcv.Config]: AttributeError: module 'mmcv' has no attribute 'Config'
pip list: mmcv 2.0.0 mmcv-full 1.2.4 mmdet 3.0.0rc5 mmengine 0.7.0 mmpycocotools 12.0.3
You installed the wrong version of mmdeploy. You should use dev-1.x branch of mmdeploy or tag wtih v1.xxx
As I said, mmdeploy master support old openmmlab algorithm branch and dev-1.x branch support openmmlab newly branch.
The master branch of config_utils.py (see your error log)
The dev-1.x branch of config_utils.py
python mmdeploy/tools/deploy.py mmdeploy/configs/mmdet/detection/detection_tensorrt_dynamic-320x320-1344x1344.py mmdetection/configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth mmdetection/demo/demo.jpg --work-dir mmdeploy_model/faster-rcnn --device cpu --dump-info
Traceback (most recent call last):
File "mmdeploy/tools/deploy.py", line 16, in
The official samples:https://github.com/open-mmlab/mmdeploy/blob/v1.0.0rc3/docs/zh_cn/get_started.md
The official samples are not working, and the environment is configured according to the official settings
--recursive
不是必须的git clone -b dev-1.x --recursive https://github.com/open-mmlab/mmdeploy.git
git clone -b 3.x https://github.com/open-mmlab/mmdetection.git cd mmdetection mim install -v -e . cd ..
wget -P checkpoints https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth
python mmdeploy/tools/deploy.py \ mmdeploy/configs/mmdet/detection/detection_tensorrt_dynamic-320x320-1344x1344.py \ mmdetection/configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py \ checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth \ mmdetection/demo/demo.jpg \ --work-dir mmdeploy_model/faster-rcnn \ --device cuda \ --dump-info
AttributeError: module 'onnx' has no attribute 'ModelProto'
The reason is the process import a wrong onnx module. I have no clue what caused it for now.
Could you print the result of python tools/check_env.py
python tools/check_env.py
Traceback (most recent call last):
File "tools/check_env.py", line 4, in
The line4 of tools/check_env.py in dev-1.x branch is from mmengine.utils import get_git_hash
, not 'mmcv.utils'
https://github.com/open-mmlab/mmdeploy/blob/dev-1.x/tools/check_env.py#L1-L4
And mmcv-full is for old openmmlab algorithm repos.
I think you'd better remove the mmdeploy conda environment, create a new one and reinstall everything.
Converting to an onnx model cannot be visualized using the netron tool. Note: The onnx model cannot be loaded. What happens
I can't reproduce your problem with mmdetection/configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py
.
python mmdeploy/tools/deploy.py mmdeploy/configs/mmdet/detection/detection_onnxruntime_static.py mmdetection/configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth mmdetection/demo/demo.jpg --work-dir mmdeploy_model/faster-rcnn --device cpu --dump-info
hello,Could you please give this a try and see if the resulting model can be visualized using Netron tools
I have tried.
Can the converted model be visualized using Netron tools
I can't reproduce your problem with mmdetection/configs/faster_rcnn/faster-rcnn_r50_fpn_1x_coco.py.
Yes, I can visualize the onnx model with netron.
Checklist
Describe the bug
(mmdet)@:/home/**/MMLab$ python mmdeploy/tools/deploy.py mmdeploy/configs/mmdet/detection/detection_onnxruntime_static.py mmdetection/ssdlite_mobilenetv2-scratch_8xb24-600e_coco.py mmdetection/ssdlite_mobilenetv2_scratch_600e_coco_20210629_110627-974d9307.pth mmdetection/demo/demo.jpg --work-dir onnx/SSD_MbV3 --device cpu --dump-info Traceback (most recent call last): File "mmdeploy/tools/deploy.py", line 15, in
from mmdeploy.apis import (create_calib_input_data, extract_model,
File "/home/lk/MMLab/mmdeploy/mmdeploy/init.py", line 4, in
from mmdeploy.utils import get_root_logger
File "/home/lk/MMLab/mmdeploy/mmdeploy/utils/init.py", line 18, in
from .config_utils import (cfg_apply_marks, get_backend,
File "/home/lk/MMLab/mmdeploy/mmdeploy/utils/config_utils.py", line 10, in
def load_config( args) -> List[mmcv.Config]:
AttributeError: module 'mmcv' has no attribute 'Config'
Reproduction
(mmdet)@:/home/**/MMLab$ python mmdeploy/tools/deploy.py mmdeploy/configs/mmdet/detection/detection_onnxruntime_static.py mmdetection/ssdlite_mobilenetv2-scratch_8xb24-600e_coco.py mmdetection/ssdlite_mobilenetv2_scratch_600e_coco_20210629_110627-974d9307.pth mmdetection/demo/demo.jpg --work-dir onnx/SSD_MbV3 --device cpu --dump-info Traceback (most recent call last): File "mmdeploy/tools/deploy.py", line 15, in
from mmdeploy.apis import (create_calib_input_data, extract_model,
File "/home/lk/MMLab/mmdeploy/mmdeploy/init.py", line 4, in
from mmdeploy.utils import get_root_logger
File "/home/lk/MMLab/mmdeploy/mmdeploy/utils/init.py", line 18, in
from .config_utils import (cfg_apply_marks, get_backend,
File "/home/lk/MMLab/mmdeploy/mmdeploy/utils/config_utils.py", line 10, in
def load_config( args) -> List[mmcv.Config]:
AttributeError: module 'mmcv' has no attribute 'Config'
Environment
Error traceback