← Open Source
eragonruan

text-detection-ctpn

text detection mainly based on ctpn model in tensorflow, id card detect, connectionist text proposal network.

Model DevelopmentClassical MLPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
3.43k
Stars
1.31k
Forks
+1
This week
1
Contributors
Created 2017-09-20 · Updated 2026-10-13 · #7955 today
Top developers

eragonruan/text-detection-ctpn is ranked 7,955 with 3,428 stars.

Same-category comparison

eragonruan/text-detection-ctpn is ranked 7,955 among these 8 peers; clab/dynet is ranked 7,954.

Same-category comparison
NameRankMetrics
ShangtongZhang/DeepRL7,938
Language:
Python
Stars:
3,456
Forks:
694
Description:
Modularized Implementation of Deep RL Algorithms in PyTorch.
facebookresearch/PyTorch-BigGraph7,942
Language:
Python
Stars:
3,453
Forks:
453
Description:
Generate embeddings from large-scale graph-structured data.
tensorflow/adanet7,943
Language:
Jupyter Notebook
Stars:
3,453
Forks:
522
Description:
Fast and flexible AutoML with learning guarantees.
clab/dynet7,954
Language:
C++
Stars:
3,430
Forks:
701
Description:
DyNet: The Dynamic Neural Network Toolkit.
argilla-io/distilabel7,957
Language:
Python
Stars:
3,421
Forks:
263
Description:
Distilabel is a framework for synthetic data and AI feedback for engineers who need fast, reliable and scalable pipelines based on verified research papers.
chaofengc/IQA-PyTorch7,958
Language:
Python
Stars:
3,419
Forks:
260
pytorch/ELF7,963
Language:
C++
Stars:
3,409
Forks:
571
Description:
ELF: a platform for game research with AlphaGoZero/AlphaZero reimplementation.
minimaxir/gpt-2-simple7,967
Language:
Python
Stars:
3,404
Forks:
664
Description:
Python package to easily retrain OpenAI's GPT-2 text-generating model on new texts.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModel Development
SubcategoryClassical ML
KeywordsOCR
Stars3,428
Forks1,307
Contributors1
Created date2017-09-20
Updated date2026-10-13
Stars in 1 day0
Stars in 7 days1
Rank7,955
Previous rank8,057
Rank change102
7-day stars rank9,188
Previous 7-day stars rank9,252
7-day stars rank change64
Total stars rank3,998
Previous total stars rank3,992
Total stars rank change-6
CountryChina
README summary

text-detection-ctpn text detection mainly based on ctpn (connectionist text proposal network). I use id card detect as an example to demonstrate the results, but it should be noticing that this model can be used in almost every horizontal scene text detection task. Also, the origin repo in caffe can be found in here. For more detail about the paper and code, see this blog. If you got any questions, check the issue first, if the problem persists, open

a new issue. *** roadmap [x] freeze the graph for convenient inference [x] pure python, cython nms and cuda nms [x] loss function as referred in paper [x] oriented text connector [x] BLSTM *** demo for a quick demo,you don't have to build the library, simpely use demo_pb. pb in data/ put your images in data/demo, the results will be saved in data/results, and run demo in the root *** parameters there are some parameters you may need to

modify according to your requirement, you can find them in ctpn/text. yml USE_GPU_NMS # whether to use nms implemented in cuda or not DETECT_MODE # H represents horizontal mode, O represents oriented mode, default is H checkpoints_path # the model I provided is in checkpoints/, if you train the model by yourself,it will be saved in output/ *** training setup requirements: python2. 24, opencv-python, easydict,(recommend to install Anaconda) if you do not have a gpu device

,follow here to setup if you have a gpu device, build the library by prepare data First, download the pre-trained model of VGG net and put it in data/pretrain/VGG_imagenet. you can download it from google drive or baidu yun. Second, prepare the training data as referred in paper, or you can download the data I prepared from google drive or baidu yun. Or you can prepare your own data according to the following steps. Modify the

path and gt_path in prepare_training_data/split_label. And run it will generate the prepared data in current folder, and then run to convert the prepared training data into voc format. It will generate a folder named TEXTVOC. move this folder to data/ and then run train Simplely run you can modify some hyper parameters in ctpn/text. The model I provided in checkpoints is trained on GTX1070 for 50k iters. If you are using cuda nms, it

takes about 0. *** some results all the photos used below are collected from the internet. If it affects you, please contact me to delete them. *** oriented text connector oriented text connector has been implemented, i's working, but still need futher improvement. left figure is the result for DETECT_MODE H, right figure for DETECT_MODE O ***

Frequently asked questions

How many stars and forks are recorded?

eragonruan/text-detection-ctpn has 3,428 stars and 1,307 forks.

What is the repository rank?

eragonruan/text-detection-ctpn is ranked 7,955.

What language and category are recorded?

eragonruan/text-detection-ctpn has 3,428 stars, uses Python and belongs to Model Development.

Which repository is closest in rank?

eragonruan/text-detection-ctpn is compared with clab/dynet, ranked 7,954 with 3,430 stars.

README

text-detection-ctpn

text detection mainly based on ctpn (connectionist text proposal network). It is implemented in tensorflow. I use id card detect as an example to demonstrate the results, but it should be noticing that this model can be used in almost every horizontal scene text detection task. The origin paper can be found here. Also, the origin repo in caffe can be found in here. For more detail about the paper and code, see this blog. If you got any questions, check the issue first, if the problem persists, open a new issue.


roadmap

  • [x] freeze the graph for convenient inference
  • [x] pure python, cython nms and cuda nms
  • [x] loss function as referred in paper
  • [x] oriented text connector
  • [x] BLSTM

demo

  • for a quick demo,you don't have to build the library, simpely use demo_pb.py for inference.
  • first, git clone git@github.com:eragonruan/text-detection-ctpn.git --depth=1
  • then, download the pb file from release
  • put ctpn.pb in data/
  • put your images in data/demo, the results will be saved in data/results, and run demo in the root
python ./ctpn/demo_pb.py

parameters

there are some parameters you may need to modify according to your requirement, you can find them in ctpn/text.yml

  • USE_GPU_NMS # whether to use nms implemented in cuda or not
  • DETECT_MODE # H represents horizontal mode, O represents oriented mode, default is H
  • checkpoints_path # the model I provided is in checkpoints/, if you train the model by yourself,it will be saved in output/

training

setup

  • requirements: python2.7, tensorflow1.3, cython0.24, opencv-python, easydict,(recommend to install Anaconda)
  • if you do not have a gpu device,follow here to setup
  • if you have a gpu device, build the library by
cd lib/utils
chmod +x make.sh
./make.sh

prepare data

  • 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 or baidu yun.
  • Second, prepare the training data as referred in paper, or you can download the data I prepared from google drive or baidu yun. Or you can prepare your own data according to the following steps.
  • Modify the path and gt_path in prepare_training_data/split_label.py according to your dataset. And run
cd lib/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

train

Simplely run

python ./ctpn/train_net.py
  • you can modify some hyper parameters in ctpn/text.yml, or just used the parameters I set.
  • The model I provided in checkpoints is trained on GTX1070 for 50k iters.
  • If you are using cuda nms, it takes about 0.2s per iter. So it will takes about 2.5 hours to finished 50k iterations.

some results

NOTICE: all the photos used below are collected from the internet. If it affects you, please contact me to delete them.


oriented text connector

  • oriented text connector has been implemented, i's working, but still need futher improvement.
  • left figure is the result for DETECT_MODE H, right figure for DETECT_MODE O

Nearby in the ranking
Similar items