Faster-RCNN Tensorflow No module named ‘libs.box_utils.cython_utils.cython_bbox‘ 错误解决方法
2021/10/3 23:41:52
本文主要是介绍Faster-RCNN Tensorflow No module named ‘libs.box_utils.cython_utils.cython_bbox‘ 错误解决方法,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
运行时报错:
ImportError: No module named 'libs.box_utils.cython_utils.cython_bbox' 或
ImportError: No module named 'libs.box_utils.cython_utils.cython_nms'
需要先进入 libs/box_utils/cython_utils,
运行 python setup.py build_ext --inplace,显示
Traceback (most recent call last):
File "setup.py", line 55, in <module>
CUDA = locate_cuda()
... ...
AttributeError: 'dict' object has no attribute 'iteritems'
此处需要对cuda进行一些配置,如果暂未安装cuda,可以先将55行: CUDA = locate_cuda() 注释掉,之后再运行 python setup.py build_ext --inplace,此时显示:
{'gcc': ['-Wno-cpp', '-Wno-unused-function']}
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -m64 -fPIC -fPIC -I/home/lishixiang/anaconda2/envs/py3.5/lib/python3.5/site-packages/numpy/core/include -I/home/lishixiang/anaconda2/envs/py3.5/include/python3.5m -c bbox.c -o build/temp.linux-x86_64-3.5/bbox.o -Wno-cpp -Wno-unused-function
creating build/lib.linux-x86_64-3.5
gcc -pthread -shared -L/home/lishixiang/anaconda2/envs/py3.5/lib -Wl,-rpath=/home/lishixiang/anaconda2/envs/py3.5/lib,--no-as-needed build/temp.linux-x86_64-3.5/bbox.o -L/home/lishixiang/anaconda2/envs/py3.5/lib -lpython3.5m -o build/lib.linux-x86_64-3.5/cython_bbox.cpython-35m-x86_64-linux-gnu.so
skipping 'nms.c' Cython extension (up-to-date)
building 'cython_nms' extension
{'gcc': ['-Wno-cpp', '-Wno-unused-function']}
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -m64 -fPIC -fPIC -I/home/lishixiang/anaconda2/envs/py3.5/lib/python3.5/site-packages/numpy/core/include -I/home/lishixiang/anaconda2/envs/py3.5/include/python3.5m -c nms.c -o build/temp.linux-x86_64-3.5/nms.o -Wno-cpp -Wno-unused-function
gcc -pthread -shared -L/home/lishixiang/anaconda2/envs/py3.5/lib -Wl,-rpath=/home/lishixiang/anaconda2/envs/py3.5/lib,--no-as-needed build/temp.linux-x86_64-3.5/nms.o -L/home/lishixiang/anaconda2/envs/py3.5/lib -lpython3.5m -o build/lib.linux-x86_64-3.5/cython_nms.cpython-35m-x86_64-linux-gnu.so
安装成功!
此时再运行相关程序,可以正确运行。
补充:如需运行 libs/setup.py,除了需要将第59行:CUDA = locate_cuda() 注释掉,还需要将以下的176-192行与cuda相关的内容注释掉,方能运行成功:
Extension('rotation.rbbox_overlaps', ['rotation/rbbox_overlaps_kernel.cu', 'rotation/rbbox_overlaps.pyx'], library_dirs=[CUDA['lib64']], libraries=['cudart'], language='c++', runtime_library_dirs=[CUDA['lib64']], # this syntax is specific to this build system # we're only going to use certain compiler args with nvcc and not with # gcc the implementation of this trick is in customize_compiler() below extra_compile_args={'gcc': ["-Wno-unused-function"], 'nvcc': ['-arch=sm_35', '--ptxas-options=-v', '-c', '--compiler-options', "'-fPIC'"]}, include_dirs = [numpy_include, CUDA['include']] ),
这篇关于Faster-RCNN Tensorflow No module named ‘libs.box_utils.cython_utils.cython_bbox‘ 错误解决方法的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-10-30tensorflow是什么-icode9专业技术文章分享
- 2024-10-15成功地使用本地的 NVIDIA GPU 运行 PyTorch 或 TensorFlow
- 2024-01-23供应链投毒预警 | 恶意Py包仿冒tensorflow AI框架实施后门投毒攻击
- 2024-01-19attributeerror: module 'tensorflow' has no attribute 'placeholder'
- 2024-01-19module 'tensorflow.compat.v2' has no attribute 'internal'
- 2023-07-17【2023年】第33天 Neural Networks and Deep Learning with TensorFlow
- 2023-07-10【2023年】第32天 Boosted Trees with TensorFlow 2.0(随机森林)
- 2023-07-09【2023年】第31天 Logistic Regression with TensorFlow 2.0(用TensorFlow进行逻辑回归)
- 2023-07-01【2023年】第30天 Supervised Learning with TensorFlow 2(用TensorFlow进行监督学习 2)
- 2023-06-18【2023年】第29天 Supervised Learning with TensorFlow 1(用TensorFlow进行监督学习 1)