尝试重用detectron
时出现导入错误成功推断
Traceback (most recent call last):
File "infer_simple.py", line 44, in <module>
import detectron.core.test_engine as infer_engine
File ".../detectron/core/test_engine.py", line 35, in <module>
from detectron.core.rpn_generator import generate_rpn_on_dataset
File ".../detectron/core/rpn_generator.py", line 42, in <module>
from detectron.datasets import task_evaluation
File ".../detectron/datasets/task_evaluation.py", line 47, in <module>
import detectron.datasets.json_dataset_evaluator as json_dataset_evaluator
File ".../detectron/datasets/json_dataset_evaluator.py", line 34, in <module>
import detectron.utils.boxes as box_utils
File ".../detectron/utils/boxes.py", line 52, in <module>
import detectron.utils.cython_nms as cython_nms
ImportError: .../detectron/utils/cython_nms.so: undefined symbol: PyFPE_jbuf
<code>conda install pytorch-nightly -c pytorch</code><br>
DETECTRON=/path/to/clone/detectron<br>
<code>git clone https://github.com/facebookresearch/detectron $DETECTRON</code><br>
<code>pip install -r $DETECTRON/requirements.txt</code><br>
<code>cd $DETECTRON && make <code>
<code>python $DETECTRON/detectron/tools/infer_simple.py</code>
Operating system: Ubuntu 16.04
Compiler version: Cmake 3.12.0
CUDA version: 9.2
cuDNN version: 9.0
NVIDIA driver version: 396.37
GPU model: Nvidia K80
PYTHONPATH: empty
python --version
> Python 2.7.15 :: Anaconda, Inc.
其他似乎相关的内容:
Caffe2
运行正常,test_spatial_narrow_as_op.py
返回“确定”
从网上发现的问题是,我的python
和anaconda
的不同版本上都有cython,numpy或opencv的不同版本。但是,如果我从numpy
中删除了opencv
或anaconda
,则caffe
不再起作用,并且如果我从原来的{{1}中删除了cython
}软件包,则cd detectron && make中的make命令失败。
我觉得如果我能告诉make使用anaconda的Cython,而不是默认的python,那应该可以。
答案 0 :(得分:0)
好,我在发布:-p
时找到了解决方案解决方案是如下修改/dectron
中的MakeFile:
# Don't use the --user flag for setup.py develop mode with virtualenv.
DEV_USER_FLAG=$(shell python -c "import sys; print('' if hasattr(sys, 'real_prefix') else '--user')")
PYTHON_EXE=/home/[username]/anaconda3/envs/[myenv]/bin/python2.7
.PHONY: default
default: dev
.PHONY: install
install:
$(PYTHON_EXE) setup.py install
.PHONY: ops
ops:
mkdir -p build && cd build && cmake .. && make -j$(shell nproc)
.PHONY: dev
dev:
$(PYTHON_EXE) setup.py develop $(DEV_USER_FLAG)
.PHONY: clean
clean:
$(PYTHON_EXE) setup.py develop --uninstall $(DEV_USER_FLAG)
rm -rf build
它将允许make命令从所需的anaconda env和相应的python
安装中使用Cython
答案 1 :(得分:0)
这是我的引用:
Traceback (most recent call last):
File "tools/tracking/greedy_tracking_from_raw_dets.py", line 8, in <module>
from vdetlib.vdet.track import greedily_track_from_raw_dets, fcn_tracker
File "./vdetlib/vdet/track.py", line 13, in <module>
from ..utils.cython_nms import track_det_nms
ImportError: ./vdetlib/utils/cython_nms.so: undefined symbol: PyFPE_jbuf
您应该:
pip install cython kivy
那就可以了!