VDIGPKU / CBNet_caffe

Composite Backbone Network (AAAI20)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Detectron ops lib not found

yuyijie1995 opened this issue · comments

在编译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

在编译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没有试过

commented

改一行代码即可解决问题。
修改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了。

@cosimo17 感谢大佬 !