• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

jungomi/math-formula-recognition: Math formula recognition (Images to LaTeX stri ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

jungomi/math-formula-recognition

开源软件地址(OpenSource Url):

https://github.com/jungomi/math-formula-recognition

开源编程语言(OpenSource Language):

Jupyter Notebook 99.5%

开源软件介绍(OpenSource Introduction):

Off-Line Math Formula Recognition Using Deep Neural Networks

Based on Multi-Scale Attention with Dense Encoder for Handwritten Mathematical Expression Recognition.

Requirements

All dependencies can be installed with PIP.

pip install -r requirements.txt

If you'd like to use a different installation method or another CUDA version with PyTorch (e.g. CUDA 10) follow the instructions on PyTorch - Getting Started.

Data

CROHME: Competition on Recognition of Online Handwritten Mathematical Expressions has been used. As it is an on-line handwritten dataset, it consists of InkML files, but this architecture is for off-line recognition, which means that images are used as input.

The dataset has been converted to images of size 256x256 and the ground truth has been extracted as well. The converted dataset can be found at Kaggle - crohme-png.

The data needs to be in the data/ directory and a tokens.tsv file defines the available tokens separated by tabs. Training and validation sets are defined in gt_split/train.tsv and gt_split/validation.tsv, where each line is the path to the image and its ground truth.

The training/validation split can be generated by running:

python data_tools/train_validation_split.py -i data/groundtruth_train.tsv -o data/gt_split

Note: The content of the generated images vary greatly in size. As longer expressions are limited to the same width, they will essentially use a smaller font. This makes it much more difficult to correctly predict the sequences, especially since the dataset is quite small. The primary focus was the attention mechanism, to see whether it can handle different sizes. If you want better results, the images need to be normalised.

Usage

Training

Training is done with the train.py script:

python train.py --prefix "some-name-" -n 200 -c checkpoints/example-0022.pth

The --prefix option is used to give it a name, otherwise the checkpoints are just numbered without any given name and -c is to resume from the given checkpoint, if not specified it starts fresh.

For all options see python train.py --help:

Evaluation

To evaluate a model use the evaluate.py script with the desired checkpoint and the dataset it should be tested against (can use multiple sets at once):

For example to evaluate the sets 2014 and 2016 with beam width 5:

python evaluate.py -d 2014 2016 --beam-width 5 -c checkpoints/example-0022.pth



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap