栏目分类:
子分类:
返回
终身学习网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
终身学习网 > IT > 软件开发 > 后端开发 > Python

Faster-RCNN Tensorflow No module named ‘libs.box

Python 更新时间:发布时间: 百科书网 趣学号

运行时报错:

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
    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']]
),

转载请注明:文章转载自 www.051e.com
本文地址:http://www.051e.com/it/293651.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 ©2023-2025 051e.com

ICP备案号:京ICP备12030808号