ModuleNotFoundError Solutions
Today I encountered a very strange thing. When I tried to use the mmdetection toolkit
This is what I entered:
$ python tools/test.py configs/faster_rcnn_r50_fpn_1x.py checkpoints/faster_rcnn_r50_fpn_1x_20181010-3d1b3351.pth modeltest
And this is how it reported the error:
Traceback (most recent call last):
File "tools/test.py", line 13, in <module>
from tools.fuse_conv_bn import fuse_module
ModuleNotFoundError Solutions: No module named 'tools'
I was really depressed. Why would this be an error???
Clearly PyCharm told me it was working fine!???

I was so frustrated
You guys check this out, here’s the import line
from tools.fuse_conv_bn import fuse_module
After a night of deep thinking, I finally realized that it’s because tools wasn’t added to the runtime environment.. Okay, I’m an idiot
So I added one line
import sys
sys.path.append("E:\\code\\python_code\\mmdetection")
Magically it worked!!!
Indeed, when you encounter a bug, don’t panic. First stay calm and drink a cup of tea.
