今天碰到一件十分奇怪的的事情。当我尝试着使用mmdetection的工具包时

我是这样输入的:

$ python tools/test.py configs/faster_rcnn_r50_fpn_1x.py checkpoints/faster_rcnn_r50_fpn_1x_20181010-3d1b3351.pth modeltest

而他是这样报错的:

Traceback (most recent call last):
  File "tools/test.py", line 13, in <module>
    from tools.fuse_conv_bn import fuse_module
ModuleNotFoundError: No module named 'tools'

我真的太郁闷了,为什么这会有错??

明明pycharm告诉我它好得很啊!???

img

我拓麻真的是馹嘞勾勒

你们来品品哈,这是import行

from tools.fuse_conv_bn import fuse_module

我我我经过了一晚上的冥思苦想之后终于恍然大悟,原来是因为tools没有加到运行环境里。。好吧(╯▽╰)我是莎笔

于是。我加了一句

import sys
sys.path.append("E:\\code\\python_code\\mmdetection")

神奇地搞定了哈哈哈!!

果然遇到bug不要慌,先冷静冷静喝杯茶。

img