{"id":18305301,"url":"https://github.com/guillaumegenthial/im2latex","last_synced_at":"2025-04-06T00:09:13.146Z","repository":{"id":37743314,"uuid":"103790639","full_name":"guillaumegenthial/im2latex","owner":"guillaumegenthial","description":"Image to LaTeX (Seq2seq + Attention with Beam Search) - Tensorflow","archived":false,"fork":false,"pushed_at":"2020-08-19T07:51:03.000Z","size":3933,"stargazers_count":461,"open_issues_count":10,"forks_count":129,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-29T23:09:10.152Z","etag":null,"topics":["attention-seq2seq","beam-search","im2latex","imagecaptioning","seq2seq","seq2seq-attn","show-and-tell","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guillaumegenthial.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-16T23:38:58.000Z","updated_at":"2025-03-15T06:48:29.000Z","dependencies_parsed_at":"2022-07-12T16:44:29.240Z","dependency_job_id":null,"html_url":"https://github.com/guillaumegenthial/im2latex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guillaumegenthial%2Fim2latex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guillaumegenthial%2Fim2latex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guillaumegenthial%2Fim2latex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guillaumegenthial%2Fim2latex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guillaumegenthial","download_url":"https://codeload.github.com/guillaumegenthial/im2latex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247415967,"owners_count":20935387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["attention-seq2seq","beam-search","im2latex","imagecaptioning","seq2seq","seq2seq-attn","show-and-tell","tensorflow"],"created_at":"2024-11-05T15:33:48.032Z","updated_at":"2025-04-06T00:09:13.126Z","avatar_url":"https://github.com/guillaumegenthial.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Im2Latex\n\nSeq2Seq model with Attention + Beam Search for Image to LaTeX, similar to [Show, Attend and Tell](https://arxiv.org/abs/1502.03044) and [Harvard's paper and dataset](http://lstm.seas.harvard.edu/latex/).\n\nCheck the [blog post](https://guillaumegenthial.github.io/image-to-latex.html).\n\n## Install\n\nInstall pdflatex (latex to pdf) and ghostsript + [magick](https://www.imagemagick.org/script/install-source.php\n) (pdf to png) on Linux\n\n\n```\nmake install-linux\n```\n\n(takes a while ~ 10 min, installs from source)\n\nOn Mac, assuming you already have a LaTeX distribution installed, you should have pdflatex and ghostscript installed, so you just need to install magick. You can try\n\n```\nmake install-mac\n```\n\n## Getting Started\n\nWe provide a small dataset just to check the pipeline. To build the images, train the model and evaluate\n\n```\nmake small\n```\n\nYou should observe that the model starts to produce reasonable patterns of LaTeX after a few minutes.\n\n\n## Data\n\nWe provide the pre-processed formulas from [Harvard](https://zenodo.org/record/56198#.V2p0KTXT6eA) but you'll need to produce the images from those formulas (a few hours on a laptop).\n\n```\nmake build\n```\n\nAlternatively, you can download the [prebuilt dataset from Harvard](https://zenodo.org/record/56198#.V2p0KTXT6eA) and use their preprocessing scripts found [here](https://github.com/harvardnlp/im2markup)\n\n\n## Training on the full dataset\n\nIf you already did `make build` you can just train and evaluate the model with the following commands\n\n```\nmake train\nmake eval\n```\n\nOr, to build the images from the formulas, train the model and evaluate, run\n\n```\nmake full\n```\n\n\n## Details\n\n1. Build the images from the formulas, write the matching file and extract the vocabulary. __Run only once__ for a dataset\n```\npython build.py --data=configs/data.json --vocab=configs/vocab.json\n```\n\n2. Train\n```\npython train.py --data=configs/data.json --vocab=configs/vocab.json --training=configs/training.json --model=configs/model.json --output=results/full/\n```\n\n3. Evaluate the text metrics\n```\npython evaluate_txt.py --results=results/full/\n```\n\n4. Evaluate the image metrics\n```\npython evaluate_img.py --results=results/full/\n```\n\n(To get more information on the arguments, run)\n\n```\npython file.py --help\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguillaumegenthial%2Fim2latex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguillaumegenthial%2Fim2latex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguillaumegenthial%2Fim2latex/lists"}