【小伟哥AI之路】mmdetection之ModuleNotFoundError: No module named 'mmdet.version'

 

在集成 mmdetection 框架时遇到这样的问题。

ModuleNotFoundError: No module named 'mmdet.version'

mmdetection 框架搭建过程很容易忽略 编译过程

root@48ea75026556:/mmdetection# python sg-pcr-client/pcr_agant_new.py 
Traceback (most recent call last):
  File "sg-pcr-client/pcr_agant_new.py", line 9, in <module>
    from pr_handler_new import PicRecHandler
  File "/home/mmxsrt/sg-pcr-client/pr_handler_new.py", line 4, in <module>
    from mmdet.apis import init_detector, inference_detector, show_result
  File "/mmdetection/mmdet/__init__.py", line 1, in <module>
    from .version import __version__, short_version
ModuleNotFoundError: No module named 'mmdet.version'
root@48ea75026556:/mmdetection# 

其实在mmdetection-master中 有个docker目录

里面很清楚的描述了搭建过程。贴上dockerfile代码

 1 ARG PYTORCH="1.1.0"
 2 ARG CUDA="10.0"
 3 ARG CUDNN="7.5"
 4 
 5 FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel
 6 
 7 RUN apt-get update && apt-get install -y libglib2.0-0 libsm6 libxrender-dev libxext6
 8 
 9 # Install mmdetection
10 RUN conda install cython -y
11 RUN git clone https://github.com/open-mmlab/mmdetection.git /mmdetection
12 WORKDIR /mmdetection
13 RUN pip install -e .

 

最后一步使我们本次解决问题的关键 安装编译

RUN pip install -e .

编译成功后

Installing collected packages: mmdet
  Found existing installation: mmdet 1.0rc0+unknown
    Uninstalling mmdet-1.0rc0+unknown:
      Successfully uninstalled mmdet-1.0rc0+unknown
  Running setup.py develop for mmdet
Successfully installed mmdet

此时表示已经完成安装和环境准备工作。可以调取模型和接下来的训练,推理,验证的过程了。

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值