编译CTPN遇到的问题总结

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq8057656qq/article/details/86512349

本地环境:

mac os 10.14

python 3.6

tensorflow 1.12.0

问题一:仅用cpu版本,lib/utils/setup.py 如下,执行报找不到bbox.c,我用的是pycharm,运行时需要把workdirctory设置

到utils目录下,如图:

from Cython.Build import cythonize
import numpy as np
from distutils.core import setup
from distutils.extension import Extension

try:
    numpy_include = np.get_include()
except AttributeError:
    numpy_include = np.get_numpy_include()
ext_modules = [
    Extension(
        'bbox',
        sources=['bbox.c'],
        include_dirs = [numpy_include]
    ),
    Extension(
        'cython_nms',
        sources=['cython_nms.c'],
    )
]
setup(
    ext_modules=ext_modules
)

问题2:AttributeError: 'NoneType' object has no attribute 'model_checkpoint_path'  

解决方法:在https://github.com/eragonruan/text-detection-ctpn/releases里下载checkpoints压缩文件,并解压到xxx/text-detection-ctpn-master目录下

问题3:运行demo.py时

OMP: Error #15: Initializing libiomp5.dylib, but found libiomp5.dylib already initialized.
OMP: Hint: This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous...

解决办法:

在demo.py 中添加 

import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'

 

问题4:KeyError: b'TEST'

解决办法:

/lib/rpn_msr/rpn_msr/proposal_layer_tf.py

53行添加代码:

cfg_key = cfg_key.decode("utf-8")

添加后如:

cfg_key = cfg_key.decode("utf-8")
    pre_nms_topN  = cfg[cfg_key].RPN_PRE_NMS_TOP_N #12000,在做nms之前,最多保留的候选box数目
    post_nms_topN = cfg[cfg_key].RPN_POST_NMS_TOP_N #2000,做完nms之后,最多保留的box的数目
    nms_thresh    = cfg[cfg_key].RPN_NMS_THRESH #nms用参数,阈值是0.7
    min_size      = cfg[cfg_key].RPN_MIN_SIZE #候选box的最小尺寸,目前是16,高宽均要大于16

至此没有再碰到问题了,成功跑通了demo,可以自己捣鼓了...成功截图如下:

展开阅读全文

没有更多推荐了,返回首页