/Table-OCR

Recognize tables from images and restore them into word.

Primary LanguageC++GNU General Public License v3.0GPL-3.0

TableRecognition

Recognize tables from images and restore them into word/crnn single character coordinates
从图像还原表格并以word形式保存/crnn单字坐标提取(解决文字跨表格单元格识别)

Demo

origin_image single_char_position
Final .docx file in word directory

Model weights

Maybe one of the best open weights of document text detection and recognition.
也许是最好的开源印刷体文档文本检测和识别权值之一
Google drive link
PSE weight
CRNN weight
Unet weight
pkl for edit distance

How to run

1. python server.py
Load the unet model to extract table lines from the input image
2. python test.py
Feed the input image
(Table line detection model is not very robust, but I will reserve the related files maybe I will update it later. 开源的表格线检测模型泛化能力不够强,暂时搁置。保留之前的代码和模型,仅作参考)

  1. Edit PSE/config/config.py, crnn/config/config.py to set use GPU/CPU and model path.
    修改PSE/config/config.py, crnn/config/config.py这两个文件配置文件,配置运行设备和模型地址
  2. python image2word.py
    Restore table use opencv & python-docx, text detection: psenet, text recognition: crnn & edit distance
    采用opencv和python-docx还原表格, 文本检测部分采用psenet, 文本识别部分采用resnet18-bilstm-ctc加编辑距离校正

Tips

Step 1 & 2 are not necessary if you have quite neat PDF images, meanwhile this project can't deal with some complex samples like tortuous and colorful receipts, I am still working on it.

To do

I am handling complex table recognition, struggling with dataset. Optimistically, there could be a radical change in weeks. If you are researching page layout and table recognition, please contact me.lizongxi1995@gmail.com

Reference and some useful projects

  1. https://github.com/chineseocr/table-ocr.git
  2. https://github.com/weidafeng/TableCell.git
  3. 腾讯表格识别方案简述
  4. OpenCV-检测并提取表格
  5. 文本检测:PSENet.pytorch
  6. 文本识别:CRNN