Hello
when I run the inference command
_"sudo python tools/infer_simple.py --cfg configs/12_2017_baselines/e2e_mask_rcnn_R-101-FPN_2x.yaml --output-dir demo/output --image-ext jpg --wts https://s3-us-west-2.amazonaws.com/detectron/35861858/12_2017_baselines/e2e_mask_rcnn_R-101-FPN_2x.yaml.02_32_51.SgT4y1cO/output/train/coco_2014_train:coco_2014_valminusminival/generalized_rcnn/model_final.pkl demo"_
I am getting the following error:
_Traceback (most recent call last):
File "tools/infer_simple.py", line 40, in
from detectron.core.config import assert_and_infer_cfg
ImportError: No module named core.config_
I can see the file config.py in the subfolder core which is in detectron dir, still I am getting the error.
And there are init.py files in both detectron dir and core dir
I am unable to understand where the problem is, can anyone help me with this
thankyou
Hi @saivineethkumar, have you followed the installation instructions and run make to set up the python modules? Also, please use python2 when running the infer_simple tool (in case your python is not symlinked to python2).
thanks for the reply @ir413
I could not find lib dir in the Detectron dir, do you have any idea about that?
@saivineethkumar Did you set the PYTHONPATH environment variable so the Python interpreter could find the detectron directory ?
Hi @gadcam
yeah, I added the detectron dir path to PYTHONPATH and still the error shows up.
but when i tried to run the command import detectron.core.config in python shell, it works but when i run the infer_simple.py this error shows up.
Is there anything else that I can try to fix this?
@saivineethkumar
Do you set it to $DETECTRON_DIR/detectron or only to $DETECTRON_DIR ? Only the first one should work.
Thanks for the suggestion @gadcam . Setting the PYTHONPATH should not be required for setting up Detectron python modules. Following the installation instructions and running make should be sufficient.
@saivineethkumar: Could you please describe the exact steps you have taken? (i.e. provide the information requested in the issue template).
I could not find lib dir in the Detectron dir, do you have any idea about that?
Could you please clarify what do you mean by this?
@ir413 When you have to build it without root privileges setting the PYTHONPATH var could be mandatory, as far as I experimented at least.
But I digress and you are right : we need more information
@gadcam Permissions can be an issue when trying to install Detectron python modules into global site-packages (which can be done by running make install). This is one of the the reasons we made make default to the development mode (see make dev) which should not have these issues.
thanks @ir413 @gadcam
I added this line to my python script before importing the modules and now it is working fine
sys.path.insert(0,'path to DETECTRON_DIR')
but I dont understand why when I add the same thing to PYTHONPATH , it was showing error but now it works fine, do you guys know why is that so?
sys.path.insert is not a good way to address this issue. As mentioned above, we recommend following the installation instructions instead. Closing this now since no further information has been provided.
@saivineethkumar ,you should make clean detectron build folder,and re-make this.it could be fine for me
Most helpful comment
@gadcam Permissions can be an issue when trying to install Detectron python modules into global site-packages (which can be done by running
make install). This is one of the the reasons we mademakedefault to the development mode (seemake dev) which should not have these issues.