EAST: An Efficient and Accurate Scene Text Detector
Introduction
This is a Pytorch re-implementation of EAST: An Efficient and Accurate Scene Text Detector. The features are summarized blow:
- Only RBOX part is implemented.
- Incidental Scene Text Detection Challenge using only training images from ICDAR 2015 and 2013.
- Differences from original paper
- Use Mobilenet-v2 / ResNet-50
- Use dice loss (optimize IoU of segmentation) rather than balanced cross entropy
- Use linear learning rate decay rather than staged learning rate decay
- Every parameter is written in
config.py
, you should change it before you run this project - The pre-trained model byprovided achieves ( Mobilenet-v2-75.05, ResNet-50-81.32) F1-score on ICDAR 2015
- Speed on 720p (resolution of 1280x720) images:
- Graphic card: GTX 1080 Ti
- Network fprop: ~15 ms/~50 ms
- NMS (C++): ~6ms/~6ms
- Overall: ~43 fps/~16 fps
Thanks for the code of authors (@argman) and (@songdejia), thank for the help of my partner Wei Baolei, Yang Yirong, Liu Hao, Wang Wei and Ma Yuting.
Contents
Installation
- Any version of pytorch version > 0.4.1 should be ok.
- Other librarys are instructed in
requirements.txt
.
Download
This project provide some files for train, test and compute hmean BaiduYun link, keyword is 593p:
- backbone_net:
The folder contains pretrained backbone net of Mobilenet-v2 / ResNet-50 which should put into
.\tmp\backbone_net
- pretrain-model-EAST:
The folder contains pretrained Model of EAST which should put into
.\tmp
, you should also change filesmodel.py
andtrain.py
- train-dataset-ICDAR15,13:
The folder contains train dataset of ICDAR15,13 which should put into
.\dataset\train
- test-dataset-ICDAR15:
The folder contains test dataset of ICDAR15 which should put into
.\dataset\test
- test-groudtruth-ICDAR15:
The folder contains groundtruth labels of test dataset ICDAR15 which should put into
.\dataset\test_compute_hmean
Train
If you want to train the model, you should change config.py
parameter.
train_data_path
is the path of train dataset, put train dataset in this folder.- Depending on your hardware configuration, set parameters of
train_batch_size_per_gpu
num_workers
gpu_ids
andgpu
. - Of course you should specify the pre-training model of backbone_net in
pretrained_basemodel_path
andpretrained
. - If you want to resume the model of EAST, you should specify the path of
checkpoint
andresume
. - On the other hand, you could also adjust the setting of other overparameters, such learning rate, weight decay, decay_steps and so on.
- Then run
python train.py
Note: you should change the train and test datasets format same as provided in this project, which the gt text files have same names as image files. In this project, only .jpg
format image files is accepted. Of course, you can change the code of project.
Test
If you want to test the model, you should also change config.py
parameter.
test_img_path
is the path of test dataset, put test dataset in this folder.res_img_path
is the path of result which will saved result of images files and txt files.- You should also specify the pretrained model in
checkpoint
. - Then run
python eval.py
Demo
If you only want to test some demos, you downloaded the pre-trained model provided in this project and change config.py
- Put demo images in
.\demo\test_img
, and specify the path oftest_img_path
andres_img_path
, you will find result in.\demo\result_img
- You should also specify the pretrained model in
checkpoint
. - Then run
python eval.py
Compute-hmean
- Put groudtruth of
gt.zip
in.\dataset\test_compute_hmean
- Change parameter of
config.py
, specify the path ofcompute_hmean_path
- Then run
python compute_hmean.py
Note: The result will show in the screen, also record in .\dataset\test_compute_hmean\log_epoch_hmean.txt
Examples
Here are some test examples on icdar2015, enjoy the beautiful text boxes by mobilenet-v2 EAST!
Please let me know if you encounter any issues(my email zhangmingliang2018@ia.ac.cn).