ctpn:Run demo.py on windows with cpu successfully!

10 篇文章 0 订阅
10 篇文章 1 订阅
my environment is:
windows10 ,
python3.6 ,
tensorflow1.3 ,
vs2015(ps:vs2013 not support python3.6 when compile)

step 1:make some change
change "np.int_t " to "np.intp_t" in line 25 of the file lib\utils\cython_nms.pyx
otherwise appear " ValueError: Buffer dtype mismatch, expected 'int_t' but got 'long long' " in step 6.

step 2:updata c file
execute:cd your_dir\text-detection-ctpn-master\lib\utils
execute:cython bbox.pyx
execute:cython cython_nms.pyx

step 3:builf setup file as setup_new.py
import numpy as np
from distutils.core import setup
from Cython.Build import cythonize
from distutils.extension import Extension
numpy_include = np.get_include()
setup(ext_modules=cythonize("bbox.pyx"),include_dirs=[numpy_include])
setup(ext_modules=cythonize("cython_nms.pyx"),include_dirs=[numpy_include])

step 4:build .pyd file
execute:python setup_new.py install
copy bbox.cp36-win_amd64.pyd and cython_nms.cp36-win_amd64.pyd to your_dir\text-detection-ctpn-master\lib\utils

step 5:make some change
(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;
(4) Comment out the line "from . import gpu_nms" in the file \lib\utils_init.py;
(5) change "base_name = image_name.split('/')[-1]" to "base_name = image_name.split('\')[-1]" in line 24 of the file ctpn\demo.py

step 6:run demo
execute:cd your_dir\text-detection-ctpn-master
execute:python ./ctpn/demo.py
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值