grimoire/mmdetection-to-tensorrt

ModuleNotFoundError: No module named 'mmdet2trt.models'; 'mmdet2trt' is not a package

Closed this issue · 2 comments

I run the mmdet2trt.py to convert .pth to .engine file, however I got following error:

Traceback (most recent call last):
  File "mmdet2trt.py", line 8, in <module>
    from mmdet2trt.models.builder import build_wraper
  File "/home/sycv/workplace/pengyuzhou/mmdetection-to-tensorrt/mmdet2trt/mmdet2trt.py", line 8, in <module>
    from mmdet2trt.models.builder import build_wraper
ModuleNotFoundError: No module named 'mmdet2trt.models'; 'mmdet2trt' is not a package

I run the script by python mmdet2trt.py --config=/home/sycv/workplace/pengyuzhou/mmdetection/configs/yolo/yolov3_d53_mstrain-608_273e_coco.py --checkpoint==/home/sycv/workplace/pengyuzhou/mmdetection-to-tensorrt/yolov3_d53_mstrain-608_273e_coco-139f5633.pth --output==/home/sycv/workplace/pengyuzhou/mmdetection-to-tensorrt/demo/

To Reproduce
Code snippet about how to reproduce the bug.

enviroment:

  • OS: [e.g. Ubuntu]
  • python_version: 3.7
  • pytorch_version: 1.6
  • cuda_version: 10.2
  • cudnn_version: 7.6.5
  • mmdetection_version: 2.5

Additional context
Add any other context about the problem here.

Please follow the readme
CLI

mmdet2trt ${CONFIG_PATH} ${CHECKPOINT_PATH} ${OUTPUT_PATH}

or python script

opt_shape_param=[
    [
        [1,3,320,320],      # min shape
        [1,3,800,1344],     # optimize shape
        [1,3,1344,1344],    # max shape
    ]
]
max_workspace_size=1<<30    # some module and tactic need large workspace.
trt_model = mmdet2trt(cfg_path, weight_path, opt_shape_param=opt_shape_param, fp16_mode=True, max_workspace_size=max_workspace_size)
torch.save(trt_model.state_dict(), save_path)

thx