其他分享
首页 > 其他分享> > 运行Faster-RCNN时出现 ModuleNotFoundError: No module named ‘lib.utils.cython_bbox‘

运行Faster-RCNN时出现 ModuleNotFoundError: No module named ‘lib.utils.cython_bbox‘

作者:互联网

运行Faster-RCNN时出现 ModuleNotFoundError: No module named 'lib.utils.cython_bbox'


我跑的源码地址:https://github.com/dBeker/Faster-RCNN-TensorFlow-Python3

一、问题描述

运行Faster-RCNN时出现 ModuleNotFoundError: No module named ‘lib.utils.cython_bbox’

二、解决流程

1、修改Faster-RCNN-TensorFlow-Python3\data/coco/PythonAPI/setup.py文件:在第15行加上

,
    Extension( 'lib.utils.cython_bbox',
               sources=['../../../lib/utils/bbox.c','../../../lib/utils/bbox.pyx'],
               include_dirs = [np.get_include(), '/lib/utils'], 
               extra_compile_args=[], )

修改后如下:

ext_modules = [
    Extension(
        'pycocotools._mask',
        sources=['../common/maskApi.c', 'pycocotools/_mask.pyx'],
        include_dirs = [np.get_include(), '../common'],
        extra_compile_args=[],
    ),
    Extension( 'lib.utils.cython_bbox',
               sources=['../../../lib/utils/bbox.c','../../../lib/utils/bbox.pyx'],
               include_dirs = [np.get_include(), '/lib/utils'],
               extra_compile_args=[], )
]

2、由于没有bbox.c和blob.py文件。所以要先在Faster-RCNN-TensorFlow-Python3\lib\utils执行

python setup.py build_ext --inplace

注意:生成cython_bbox.c和cython_bbox.pyx,然后将这两个改名为bbox.c和bbox.pyx。如下图所示:
在这里插入图片描述

3、再在./data/coco/PythonAPI下面运行

 python setup.py build_ext --inplace
 python setup.py build_ext install

再运行,不再报错。亲测可用。

参考:https://blog.csdn.net/weixin_40437821/article/details/105075571

标签:cython,named,Faster,..,utils,bbox,lib,RCNN
来源: https://blog.csdn.net/mao_hui_fei/article/details/120588340