本文主要是介绍CTPN——cpu版本使用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
源码:https://github.com/eragonruan/text-detection-ctpn
参考:https://github.com/ZhangXinNan/text-detection-ctpn/blob/zxdev_mac/gpu2cpu.md
运行GPU版本参考作者readme即可
运行cpu版本
(1) Set “USE_GPU_NMS ” in the file ./ctpn/text.yml as “False”
(2) Set the “__C.USE_GPU_NMS” in the file ./lib/fast_rcnn/config.py as “False”;
(3) Comment out the line from lib.utils.gpu_nms import gpu_nms in the file ./lib/fast_rcnn/nms_wrapper.py;
Comment out the line from . import gpu_nms in the file lib/utils/init.py.
(4) To modify and rebuild the setup.py. Modify setup.py:
from Cython.Build import cythonize
import numpy as np
from distutils.core import setup
from distutils.extension import Extensiontry: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'],include_dirs = [numpy_include])
]
setup(ext_modules=ext_modules
)
export CFLAGS=numpy_path/core/include
python setup.py build
(5) then copy .so to xxx/text-detection-ctpn-master/lib/utils
cd text-detection-ctpn-master
python demo.py
这篇关于CTPN——cpu版本使用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!