text detection mainly based on ctpn (connectionist text proposal network). It is implemented in tensorflow. I use id card detect as an example. the origin paper can be found here. Also, the origin repo can be found in here. This repo is mainly based on faster rcnn framework, so there remains tons of useless code. I'm still working on it.
First, download the pre-trained model of VGG net and put it in data/pretrain/VGG_imagenet.npy. you can download it from google drive.
Second, prepare the training data as referred in paper, or you can download the data I prepared in here. Modify the path and gt_path in prepare_training_data/split_label.py according to your dataset. And run
cd prepare_training_data
python split_label.py
it will generate the prepared data in current folder, and then run
python ToVoc.py
to convert the prepared training data into voc format. It will generate a folder named TEXTVOC. move this folder to data/ and then run
cd ../data
ln -s TEXTVOC VOCdevkit2007
Simplely run
python ./ctpn/train_net.py
you can modify some hyper parameters in ctpn/text.yml, or just used the parameters I set.
put your images in data/demo, the results will be saved in data/results, and run
python ./ctpn/demo.py
NOTICE:
all the photos used below are collected from the internet. If it affects you, please contact me to delete them.