Anaconda中安装Cascade RCNN(Detectron)的若干问题
安装参考https://github.com/zhaoweicai/Detectron-Cascade-RCNN/blob/master/INSTALL.md
1、对于在 python detectron/tests/test_spatial_narrow_as_op.py 时出现 AssertionError: Detectron ops lib not found; make sure that your Caffe2 version includes Detectron module
detectron/utils/env.py中第65行左右的:
ops_path = os.path.join(prefix, 'lib/libcaffe2_detectron_ops_gpu.so')
在conda的envs文件夹中搜索这个so,将整个get_detectron_ops_lib()的函数内容替换为 return "/home/wit/anaconda3/envs/xxx/lib/python2.7/site-packages/torch/lib/libcaffe2_detectron_ops_gpu.so"。
2、对于上述测试时出现
Detectron-Cascade-RCNN$ python detectron/tests/test_spatial_narrow_as_op.py
[E init_intrinsics_check.cc:43] CPU feature avx is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.
terminate called after throwing an instance of 'c10::Error'
what(): device_index >= 0 && device_index < num_gpus ASSERT FAILED at /opt/conda/conda-bld/pytorch-nightly_1553749764951/work/c10/cuda/CUDAStream.cpp:265, please report a bug to PyTorch. (check_gpu at /opt/conda/conda-bld/pytorch-nightly_1553749764951/work/c10/cuda/CUDAStream.cpp:265)
frame #0: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x45 (0x7fac18e21895 in /home/wit/anaconda3/envs/cascade/lib/python2.7/site-packages/caffe2/python/../../torch/lib/libc10.so)
frame #1: c10::cuda::getCurrentCUDAStream(short) + 0x380 (0x7fac192be5e0 in /home/wit/anaconda3/envs/cascade/lib/python2.7/site-packages/caffe2/python/../../torch/lib/libc10_cuda.so)
frame #2: <unknown function> + 0xe0824 (0x7fac429bb824 in /home/wit/anaconda3/envs/cascade/lib/python2.7/site-packages/caffe2/python/caffe2_pybind11_state_gpu.so)
frame #3: <unknown function> + 0xe0b58 (0x7fac429bbb58 in /home/wit/anaconda3/envs/cascade/lib/python2.7/site-packages/caffe2/python/caffe2_pybind11_state_gpu.so)
frame #4: <unknown function> + 0xe3bcd (0x7fac429bebcd in /home/wit/anaconda3/envs/cascade/lib/python2.7/site-packages/caffe2/python/caffe2_pybind11_state_gpu.so)
frame #5: <unknown function> + 0xe5b88 (0x7fac429c0b88 in /home/wit/anaconda3/envs/cascade/lib/python2.7/site-packages/caffe2/python/caffe2_pybind11_state_gpu.so)
frame #6: <unknown function> + 0x4e7b7 (0x7fac429297b7 in /home/wit/anaconda3/envs/cascade/lib/python2.7/site-packages/caffe2/python/caffe2_pybind11_state_gpu.so)
frame #7: <unknown function> + 0x8b898 (0x7fac42966898 in /home/wit/anaconda3/envs/cascade/lib/python2.7/site-packages/caffe2/python/caffe2_pybind11_state_gpu.so)
<omitting python frames>
Aborted (core dumped)
conda install pytorch torchvision cudatoolkit=9.0 -c pytorch
目前通过测试的匹配版本是torch1.1.0