Coder Social home page Coder Social logo

harishb97 / im2latex-tensorflow-2 Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 7.75 MB

TensorFlow-2 implementation of Im2Latex deep learning model described in HarvardNLP paper "What You Get Is What You See: A Visual Markup Decompiler"

Python 26.37% Jupyter Notebook 73.63%
convolutional-neural-networks deep-learning encoder-decoder-model imagecaptioning recurrent-neural-networks tensorflow tensorflow2

im2latex-tensorflow-2's Introduction

Im2Latex-TensorFlow-2


TensorFlow-2 implementation of Im2Latex deep learning model for latex code generation from images of mathematical expressions described in HarvardNLP paper "What You Get Is What You See: A Visual Markup Decompiler"

What You Get Is What You See: A Visual Markup Decompiler  
Yuntian Deng, Anssi Kanervisto, and Alexander M. Rush
http://arxiv.org/pdf/1609.04938v1.pdf

This is a general-purpose, deep learning-based system to decompile an image into presentational markup. For example, we can infer the LaTeX or HTML source from a rendered image.

Training data


Source im2latex-100k dataset has been preprocessed and resized as suitable for the model. Download the data from this link and move to "images" folder before training.

Sample results


Training and evaluating the model


Step to train and evaluate the model has been given in the notebooks "im2latex_train.ipynb" and "im2latex_test.ipynb" respectively

Model Performance


BLEU score

  1. Validation dataset (10340 images): 84.44%
  2. Test dataset (9340 images): 84.30%

Validation and train perplexity

Exact match accuracy

Preferred versions:


  • Tensorflow 2.8.0
  • Numpy 1.21.6

Previous implementations:


  1. Original implementation by HarvardNLP in Torch (Lua)
  2. TensorFlow-1 implementation

im2latex-tensorflow-2's People

Contributors

harishb97 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

im2latex-tensorflow-2's Issues

logits and labels must have the same first dimension, got logits shape [20,1024] and labels shape [2780]

Hello, after I loaded the data set, the training model encountered an error, I hope to get your help, thank you.

tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found.
(0) Invalid argument: logits and labels must have the same first dimension, got logits shape [20,1024] and labels shape [2780]
[[node loss_func_1/sparse_categorical_crossentropy/SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits (defined at E:\Im2Latex-TensorFlow-2\im2latex.py:248) ]]
[[Func/cond_6/then/_1847/input/_3044/_492]]
(1) Invalid argument: logits and labels must have the same first dimension, got logits shape [20,1024] and labels shape [2780]
[[node loss_func_1/sparse_categorical_crossentropy/SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits (defined at E:\Im2Latex-TensorFlow-2\im2latex.py:248) ]]

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.