{"id":14970765,"url":"https://github.com/kasim95/ocr_math_expressions","last_synced_at":"2025-10-18T17:57:21.524Z","repository":{"id":67676818,"uuid":"222786538","full_name":"kasim95/OCR_Math_Expressions","owner":"kasim95","description":"A Deep Learning pipeline to recognize mathematical expressions from images","archived":false,"fork":false,"pushed_at":"2020-05-08T21:09:10.000Z","size":398686,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T14:58:15.534Z","etag":null,"topics":["keras","mathematics","optical-character-recognition","python","python3","tensorflow","tensorflow-models"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kasim95.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-19T20:46:14.000Z","updated_at":"2025-02-15T14:51:30.000Z","dependencies_parsed_at":"2023-02-27T08:31:21.446Z","dependency_job_id":null,"html_url":"https://github.com/kasim95/OCR_Math_Expressions","commit_stats":{"total_commits":38,"total_committers":1,"mean_commits":38.0,"dds":0.0,"last_synced_commit":"aaf3107dec4454fa9c7528d418739a17ca429874"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasim95%2FOCR_Math_Expressions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasim95%2FOCR_Math_Expressions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasim95%2FOCR_Math_Expressions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasim95%2FOCR_Math_Expressions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kasim95","download_url":"https://codeload.github.com/kasim95/OCR_Math_Expressions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252769140,"owners_count":21801373,"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":["keras","mathematics","optical-character-recognition","python","python3","tensorflow","tensorflow-models"],"created_at":"2024-09-24T13:44:06.697Z","updated_at":"2025-10-18T17:57:21.424Z","avatar_url":"https://github.com/kasim95.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Optical Character Recognition for Handwritten Mathematical Expressions\n\n[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](LICENSE)\n\n## Introduction\nThe aim of this repo is to recognize handwritten mathematical expression present in image using Deep Learning\n\nThe Project is divided into three tasks:\n* Character Localization\n    \n    Localizes characters present in the image with bounding box\n    \n* Character Classification\n\n    Identifies the class of character present in the bounding box\n\n* Syntactic Analysis\n\n    Verifies the collection of symbols predicted by previous two tasks if it represents a mathematical image and generates MathML representation of it.\n    \n---\n## Quick Start\n1. Clone repo and download saved weights\n2. Run this command to identify the mathematical expression from image *exp0030.png* \n```shell script\npython3 evaluate.py -m \"trained_models/model3.h5\"  -i \"datasets/object_detection/evaluate/exp0030.png\"\n```\n\nExample image for characters in expression located with Bounding boxes\n![Object Detection](plots/Object_Detection_bboxes.png)\n\nMathML Output:\n```xml\n\u003cmath xmlns=\"http://www.w3.org/1998/Math/MathML\"\u003e\n    \u003cmrow\u003e\n        \u003cmi\u003eZ\u003c/mi\u003e\n        \u003cmo\u003e=\u003c/mo\u003e\n        \u003cmi\u003eX\u003c/mi\u003e\n        \u003cmo\u003e+\u003c/mo\u003e\n        \u003cmi\u003eY\u003c/mi\u003e\n    \u003c/mrow\u003e\n\u003c/math\u003e\n\n```\n\n---\n\n## Training\n\nConvolutional Neural Networks and Dense Networks are trained in *Classification_task.ipynb*\n\nObject Detection Models are trained in their respective submodules\n\n---\n## Submodules\n* [keras-yolo3](https://github.com/kasim95/keras-yolo3/tree/ocr_math) \n    (*ocr_math*)\n    \n    \u003e YOLOv3 implementation in Keras\u003cbr\u003eUsed to train Tiny-YOLOv3 model on object_detection dataset\n\n* [models](https://github.com/kasim95/models/tree/tf112)\n    (*tf112*)\n\n    \u003e Tensorflow Object Detection API\u003cbr\u003eUsed to train Faster-RCNN with Resnet-50 model on object_detection dataset\n\n---\n\n## Project Structure:\n\nDirectories\n* **datasets/**          : Contains datasets for Object Detection and Character Classification\n* **plots/**             : Contains plots generated by notebooks and scripts\n*  **Report/**           : Contains Project Report\n* **processed_data/**    : Contains labels and other processed stuff from Dataset_Preprocessing.ipynb\n* **syntactical_analysis** : \n* **trained_models/**    : Contains saved models weights for CNNs and ANNs\n\nNotebooks\n* **Dataset_Preprocessing** : Notebook containing code to combine screen dataset, combine with custom images and generate train-test splits\n* **OD_Character_Segmentation.ipynb** : Notebook demonstrating Character Localization using Contour Search\n* **OD_Faster-RCNN.ipynb** : Notebook demonstrating Character Localization using Faster-RCNN with Resnet50 model\n* **OD_yolov3.ipynb** : Notebook demonstrating Character Localization using Tiny YOLOv3 model\n* **Optical_Character_Recognition** : Notebook demonstrating the complete Project Pipeline\n\nPython scripts\n* **evaluate.py** : Python file used to evaluate math expression/s from a single image or multiple images using Project Pipeline\n* **utils.py** : Python file containing Helper functions\n\n---\n## Issues\nAt the moment, parser rules are set for binary operators only. This limits the scope of the Project to supported operators.\n\nSupported operators in mathematical expression:\n * =\n * \u0026plus;\n * \u0026minus;\n * /\n * \u0026div;\n * \u0026ast;\n * \u0026times;\n * \u0026percnt;\n \n---\n\n## Note\nThis Project has been tested in the following environment:\n* Python 3.6.9\n* Tensorflow 1.12.3\n* Keras 2.2.4\n* OpenCV 3.4.2.16\n* Numpy 1.17.4\n* Pandas 0.25.3","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkasim95%2Focr_math_expressions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkasim95%2Focr_math_expressions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkasim95%2Focr_math_expressions/lists"}