- Use CTPN (tf) to detect text regions of image
- Use CRNN (torch) to recognize text
- Use Flask to make restful api response
- Colaboratory
- CTPN
tensorflow
1.14.0cv2
3.4.3- others see requirements.txt
- CRNN
pytorch
1.1.0lmdb
0.96- others see code
- Server
Flask
1.0.2flask_cors
3.0.8werkzeug
0.14.1
- Document see readme.md
- Front-End(Android) see OCRActivity.java
- CTPN
- Clone text-detection-ctpn repo into
CTPN/
and rename it toctpn_repo/
- Download the ckpt file(from
official repo
[https://github.com/eragonruan/text-detection-ctpn] backup) from google drive or baidu yun, Unzipcheckpoints_mlt.zip
atctpn_repo/
- Build cython lib
- Clone text-detection-ctpn repo into
cd CTPN/
git clone https://github.com/eragonruan/text-detection-ctpn.git
mv text-detection-ctpn/ ctpn_repo/
cd ctpn_repo/
# download checkpoints_mlt.zip
unzip checkpoints_mlt.zip
cd utils/bbox
chmod +x make.sh
./make.sh
-
CRNN
- Download pretrained model(from chineseocr repo) from google drive, move two pth files into
CRNN/models/
- Download pretrained model(from chineseocr repo) from google drive, move two pth files into
-
Structure
. ├─assets/ ├─CRNN/ │ ├─data/ │ └─models/ ├─CTPN/ │ └─ctpn_repo/ │ ├─checkpoints_mlt/ │ ├─data/ │ │ ├─demo/ │ │ ├─readme/ │ │ ├─res/ │ │ └─res_oriented/ │ ├─main/ │ ├─nets/ │ └─utils/ │ ├─bbox/ │ ├─dataset/ │ ├─prepare/ │ ├─rpn_msr/ │ └─text_connector/ ├─Server/ │ ├─Controllers/ │ ├─Middleware/ │ ├─Models/ │ ├─Routes/ │ └─Utils/ │ └─Exception/ └─tmp/
# After build and get model data
cd CTPN_CRNN_BackEnd/
python3 listen.py # Listen 0.0.0.0:1627