is a flask web app which recognizes sent image of an Arabic mathematical expression through characters' segmentation, characters recognition, and parsing them into a mathematical expression then apply an operation on it e.g (solving the roots of polynomial, integration, etc).
Expression Image | HTML Recognition Output |
---|---|
س ٢+٣*س+٢ | |
(لـو٢(٨)+ظا(٤٥))\(س ٢+√(س+٦)) |
- python >= 3.8.12
- Clone the repo
git clone [email protected]:omarshawky15/ArabicMathSolver-Server.git
- Create a virtual environment
python -m venv venv
- Activate the virtual environment
source venv/Scripts/activate
- Install the required packages
pip install -r requirements.txt
- To start the local server, run
python app.py
then upload the image to the server and see the html output. (Default operation: solving the roots of polynomial)
- To use without running the server, uncomment the
runLocal()
function inapp.py
, insert the image path, and commentapp.run()
.
The image is partitioned into multiple cropped characters by analyzing their contours using OpenCV.
Each character is recognized using our trained tensorflow model which consists of the following layers.
Layer (type) | Output Shape | Param # |
---|---|---|
(BatchNormalization) | (None, 32, 32, 1) | 4 |
(Conv2D) | (None, 32, 32, 64) | 1664 |
(Conv2D) | (None, 32, 32, 64) | 102464 |
(MaxPooling2D) | (None, 16, 16, 64) | 0 |
(Dropout) | (None, 16, 16, 64) | 0 |
(Conv2D) | (None, 16, 16, 128) | 73856 |
(Conv2D) | (None, 16, 16, 128) | 147584 |
(MaxPooling2D) | (None, 8, 8, 128) | 0 |
(Dropout) | (None, 8, 8, 128) | 0 |
(Flatten) | (None, 8192) | 0 |
(Dropout) | (None, 8192) | 0 |
(Dense) | (None, 256) | 2097408 |
(Dense) | (None, 43) | 11051 |
Symbols are parsed together to form a mathematical expression where different combinations are handled like fraction, power, square root, ..etc
The chosen operation (integration, differentiation, etc.) is applied on the mathematical expression using SymPy which is a library for symbolic mathematics. Then both the expression and the operation output are translated back to Arabic mathematical notation.
Arabic Math Solver - Android App
This application is released under GNU GPLv3 (see LICENSE).
For more details, see the graduation project book.