This is a tensorflow re-implementation of EAST: An Efficient and Accurate Scene Text Detector. The features are summarized blow:
- Only RBOX part is implemented.
- A fast Locality-Aware NMS in C++ provided by the paper's author.
- The pre-trained model provided achieves 80.83 F1-score on ICDAR 2015 Incidental Scene Text Detection Challenge using only training images from ICDAR 2015 and 2013. see here for the detailed results.
- Differences from original paper
- Any version of tensorflow version > 1.0 should be ok.
- sudo apt-get install python3-tk
- Models trained on ICDAR 2013 (training set) + ICDAR 2015 (training set): BaiduYun link GoogleDrive
- Resnet V1 50 provided by tensorflow slim: slim resnet v1 50
If you want to train the model, you should provide the dataset path, in the dataset path, a separate gt text file should be provided for each image and run
python multigpu_train.py --gpu_list=0 --input_size=512 --batch_size_per_gpu=8 --checkpoint_path=/content/EAST/tmp/east_icdar2015_resnet_v1_50_rbox/ --text_scale=512 --training_data_path=/content/EAST/data/sroie_train/ --geometry=RBOX --learning_rate=0.0001 --num_readers=4 --pretrained_model_path=/content/EAST/data/resnet_v1_50.ckpt
If you have more than one gpu, you can pass gpu ids to gpu_list(like --gpu_list=0,1,2,3)
Note: you should change the gt text file of icdar2015's filename to img_*.txt instead of gt_img_*.txt(or you can change the code in icdar.py), and some extra characters should be removed from the file. See the examples in training_samples/
This executable line is updated with reduced num_readers and batch_size_per_gpu, and code is running on top of pre-trained checkpoints. Update current checkpoint file path in 'checkpoint' file in east_icdar2015_resnet_v1_50_rbox folder
run
python eval.py --test_data_path=/content/EAST/tmp/images/ --gpu_list=0 --checkpoint_path=/content/EAST/east_icdar2015_resnet_v1_50_rbox/ --output_dir=/content/EAST/tmp/output/
a text file will be then written to the output path.
Test Execution on Windows/CPU environment
Open the x64 or x32 Visual Studio developer command prompt (or Native Tools Command Prompt) in Windows 10 and use the following command to generate the adaptor.pyd file: first cd into lanms folder to execute below command in command prompt,
cl adaptor.cpp ./include/clipper/clipper.cpp /I ./include /I "C:\Python36\include" /LD /Fe:adaptor.pyd /link/LIBPATH:"C:\Python36\libs"
This will generate required files for Windows execution/testing
Note please make sure you comment some code in init.py in lanms folder comment line 7 and 8
if subprocess.call(['make', '-C', BASE_DIR]) != 0: # return value
raise RuntimeError('Cannot compile lanms: {}'.format(BASE_DIR))
Here are some test examples on icdar2015, enjoy the beautiful text boxes!
- How to compile lanms on Windows ?
- See argman#120
Please let me know if you encounter any issues(my email boostczc@gmail dot com).