VDIGPKU / CBNet_caffe

Composite Backbone Network (AAAI20)
Apache License 2.0
408 stars 78 forks source link

Detectron ops lib not found #10

Closed yuyijie1995 closed 5 years ago

yuyijie1995 commented 5 years ago

在编译Detectron官方代码完后运行python2 detectron/tests/test_spatial_narrow_as_op.py测试时 正常通过,但编译完您的代码后,运行测试代码就会报错

Traceback (most recent call last):
  File "detectron/tests/test_spatial_narrow_as_op.py", line 88, in <module>
    c2_utils.import_detectron_ops()
  File "/home/wrc/CBNet/detectron/utils/c2.py", line 43, in import_detectron_ops
    detectron_ops_lib = envu.get_detectron_ops_lib()
  File "/home/wrc/CBNet/detectron/utils/env.py", line 71, in get_detectron_ops_lib
    ('Detectron ops lib not found; make sure that your Caffe2 '
AssertionError: Detectron ops lib not found; make sure that your Caffe2 version includes Detectron module

请问下是不是这个代码只能使用源码编译的方法安装的caffe2

PKUbahuangliuhe commented 5 years ago

在编译Detectron官方代码完后运行python2 detectron/tests/test_spatial_narrow_as_op.py测试时 正常通过,但编译完您的代码后,运行测试代码就会报错

Traceback (most recent call last):
  File "detectron/tests/test_spatial_narrow_as_op.py", line 88, in <module>
    c2_utils.import_detectron_ops()
  File "/home/wrc/CBNet/detectron/utils/c2.py", line 43, in import_detectron_ops
    detectron_ops_lib = envu.get_detectron_ops_lib()
  File "/home/wrc/CBNet/detectron/utils/env.py", line 71, in get_detectron_ops_lib
    ('Detectron ops lib not found; make sure that your Caffe2 '
AssertionError: Detectron ops lib not found; make sure that your Caffe2 version includes Detectron module

请问下是不是这个代码只能使用源码编译的方法安装的caffe2

我是源码编译安装的,conda没有试过

cosimo17 commented 5 years ago

改一行代码即可解决问题。 修改detectron/utils/env.py的第63行 prefixes = [_CMAKE_INSTALL_PREFIX, sys.prefix, sys.exec_prefix] + sys.path + ["/home/.conda/envs/detectron/lib/python2.7/site-packages/torch/"] 把后面的这个路径改成你自己的就OK了。

yuyijie1995 commented 5 years ago

@cosimo17 感谢大佬 !