本文将介绍text-detection-ctpn在win10上的run demo
环境信息如下:
windows10,
anaconda python3.5,
tensorflow1.14,
vs2015
1、代码下载并重命名为text-detection-ctpn-win10:
git clone https://github.com/eragonruan/text-detection-ctpn.git
2、将utils\bbox\nms.pyx文件中25行的"np.int_t " 修改为 "np.intp_t"
不然会报错:" ValueError: Buffer dtype mismatch, expected 'int_t' but got 'long long' " in step 6.
3、进入目录utils\bbox,执行如下命令,更新两个c文件
cython bbox.pyx
cython nms.pyx
4、将setup.py修改为以下内容
from distutils.core import setup
import numpy as np
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("nms.pyx"),include_dirs=[numpy_include])
5、执行如下命令,生成pyd文件。
python setup.py install
执行成功后会在当前目录生成一个build目录,将build\lib.win-amd64-3.5\bbox目录下两个Pyd文件复制到当前目录。
6、Run demo
下载训练好的模型文件ckpt:https://pan.baidu.com/s/1BNHt_9fiqRPGmEXPaxaFXw
将ckpt复制进text-detection-ctpn-win10/checkpoints_mlt目录
cd text-detection-ctpn
python ./main/demo.py
训练日志如下
7、run train
a、删除checkpoints_mlt目录底下文件
b、修改train.py
16 行,DEFINE_integer 改为DEFINE_float
18 行,4改为1
23 行,True改成False
75 行,改为0.6
c、将utils\dataset/data_provider.py 81 行,true改成false。
d、将vgg16模型存入text-detection-ctpn-win10/data目录
e、将数据集存入text-detection-ctpn-win10/data/dataset
f、执行如下命令开训练
cd text-detection-ctpn-win10
python main/train.py
训练过程会打印类似日志
win10版本在此:https://github.com/tryrus/text-detection-ctpn-win10