OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Models

Latex Ocr

Latex Ocr is an open-source project that trains and evaluates a deep-learning model to recognize mathematical formulas in images and convert them to LaTeX. It includes scripts for generating formula images from LaTeX text, training and evaluating predictions, and visualizing attention. The described model uses a CNN encoder, an LSTM decoder, attention and beam search.

Independent OpenViST project profile, based on linked sources.

Latex Ocr — Train and evaluate the small formula dataset
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when you need a self-managed code workflow for experimenting with mathematical formula image recognition, including generating training data from LaTeX source.

Who it is for

  • Developers building or adapting mathematical formula OCR workflows.
  • Researchers or practitioners training and evaluating formula-recognition models.
  • Users who can install and work with the documented Python and image-rendering dependencies.

Documented uses

  • Generate formula images and matching text data from LaTeX formulas.
  • Train a model to map formula images to LaTeX sequences.
  • Evaluate predicted formula text and formula images.
  • Visualize training progress and attention during prediction.
Before you choose

Requirements & limits

The public repository identifies an Apache-2.0 license. Setup instructions are provided for Linux and Mac.

  • The documented environment specifies Python 3.5 and TensorFlow 1.12.2, along with LaTeX, Ghostscript and ImageMagick.
  • The full generated dataset contains more than 70,000 formula images and is estimated to take two to three hours to generate.
  • The model's vocabulary constrains which characters and tokens it can predict.
  • The README gives a small 100-sample dataset workflow as well as a full-data workflow.
  • The repository provides scripts and setup instructions rather than describing a hosted OCR service.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Train and evaluate the small formula dataset

Generate a small formula-image dataset, train the model, and evaluate its formula text and image predictions.

Before you start

  • Python 3.5 and TensorFlow 1.12.2
  • LaTeX, Ghostscript and ImageMagick
  • The repository's Python dependencies; Linux or Mac setup instructions are provided

Steps

  1. Set up the environment using the README's Linux or Mac instructions.

  2. Generate the small dataset with the command below or the command below.

    Documented command
    python build.py
    Documented command
    python build.py --data=configs/data_small.json --vocab=configs/vocab_small.json
  3. Train with the command below or the documented small-dataset configuration and output arguments.

    Documented command
    python train.py
  4. Evaluate predicted formulas with the command below and formula images with the command below; use --results=results/small/ for the specified output directory.

    Documented command
    python evaluate_txt.py
    Documented command
    python evaluate_img.py

Expected outcome

The workflow produces trained-model results and evaluation of predicted formula text and images.

Guide limitations

  • The small dataset is described as containing 100 samples; the README says generating its formula images takes about two minutes.
  • Predicted formulas are constrained by the generated vocabulary.
  • The README documents an older Python and TensorFlow environment; this guide does not verify execution or compatibility.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
10 November 2026
Original website title
LinXueyuanStdio/LaTeX_OCR · Official homepage title · retained in its source language

Related options

LaTeX_OCR_PRO — The README links to this as an enhanced edition of the project.