Giter VIP home page Giter VIP logo

math2latex's Introduction

Math2LaTeX

A open-source tool to convert Handwritten Math to LaTeX code!

Samples

image

image

From top to bottom: Ground truth, predicted LaTeX.

On test samples from the CRHOME 2013 handwritten digit competition:

image

image

From a tablet handwritten validation image:

image

image

Features

  • Handwriting Recognition: Uses a deep learning model trained on a large dataset of handwritten mathematical symbols and equations.
  • LaTeX Conversion: Converts recognized handwriting into LaTeX code, ready to be used in your documents.
  • Open-Source: All the details of our implementation can be found in this repository.

Installation

To get started with Math2LaTeX, you'll need to have Python 3.6+ and PyTorch 1.0+ installed. To finetune your own model, follow the instructions below to set up the dataset.

  1. Go to Kaggle's Handwritten Mathematical Expressions and download the dataset. Move archive.zip into the Math2LaTeX directory.
  2. Run the following:
conda create -n latexocr python==3.11
conda activate latexocr
pip install -r requirements.txt
bash ./setup.sh

You should see all checks passed after running setup.sh. 4. Images can be found in img_data, and image name / label pairs are in img_data/labels.csv.

Todo:

Not yet implemented:

  • RCNN + TrOCR segmentation-OCR pipeline.
  • Model distillation and quantization.
  • Rearrange code structure to a python package.

Usage

To begin, run train_TrOCR.ipynb in scripts. Scroll down to the "Validation on REAL Handwritten Digits" header to run the model on your own validation images.

Training the Model

Call python scripts/train_TrOCR.py with the --gpu flag to indicate which GPU to use. Default is 0.

Contributing

Contributions to LaTeX-OCR are welcome! Whether it's bug reports, feature requests, or new code, we appreciate all help.

math2latex's People

Contributors

wz-ml avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.