BTTR
Official implementation for ICDAR 2021 best poster paper "Handwritten Mathematical Expression Recognition with Bidirectionally Trained Transformer"
Install / Use
/learn @Green-Wood/BTTRREADME
Handwritten Mathematical Expression Recognition with Bidirectionally Trained Transformer
</div>Description
Convert offline handwritten mathematical expression to LaTeX sequence using bidirectionally trained transformer.
How to run
First, install dependencies
# clone project
git clone https://github.com/Green-Wood/BTTR
# install project
cd BTTR
conda create -y -n bttr python=3.7
conda activate bttr
conda install --yes -c pytorch pytorch=1.7.0 torchvision cudatoolkit=<your-cuda-version>
pip install -e .
Next, navigate to any file and run it. It may take 6~7 hours to converge on 4 gpus using ddp.
# module folder
cd BTTR
# train bttr model using 4 gpus and ddp
python train.py --config config.yaml
For single gpu user, you may change the config.yaml file to
gpus: 1
# gpus: 4
# accelerator: ddp
Imports
This project is setup as a package which means you can now easily import any file into any other file like so:
from bttr.datamodule import CROHMEDatamodule
from bttr import LitBTTR
from pytorch_lightning import Trainer
# model
model = LitBTTR()
# data
dm = CROHMEDatamodule(test_year=test_year)
# train
trainer = Trainer()
trainer.fit(model, datamodule=dm)
# test using the best model!
trainer.test(datamodule=dm)
Note
Metrics used in validation is not accurate.
For more accurate metrics:
- use
test.pyto generate result.zip - download and install crohmelib, lgeval, and tex2symlg tool.
- convert tex file to symLg file using
tex2symlgcommand - evaluate two folder using
evaluatecommand
Citation
@article{zhao2021handwritten,
title={Handwritten Mathematical Expression Recognition with Bidirectionally Trained Transformer},
author={Zhao, Wenqi and Gao, Liangcai and Yan, Zuoyu and Peng, Shuai and Du, Lin and Zhang, Ziyin},
journal={arXiv preprint arXiv:2105.02412},
year={2021}
}
@inproceedings{Zhao2021HandwrittenME,
title={Handwritten Mathematical Expression Recognition with Bidirectionally Trained Transformer},
author={Wenqi Zhao and Liangcai Gao and Zuoyu Yan and Shuai Peng and Lin Du and Ziyin Zhang},
booktitle={ICDAR},
year={2021}
}
Related Skills
YC-Killer
2.7kA library of enterprise-grade AI agents designed to democratize artificial intelligence and provide free, open-source alternatives to overvalued Y Combinator startups. If you are excited about democratizing AI access & AI agents, please star ⭐️ this repository and use the link in the readme to join our open source AI research team.
best-practices-researcher
The most comprehensive Claude Code skills registry | Web Search: https://skills-registry-web.vercel.app
groundhog
400Groundhog's primary purpose is to teach people how Cursor and all these other coding agents work under the hood. If you understand how these coding assistants work from first principles, then you can drive these tools harder (or perhaps make your own!).
last30days-skill
19.1kAI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
