This project is a simple machine learning model which recognizes handwritten equations from an image and solve it.
We have made a program to recognize a handwritten equation solver using Machine Learning. We have made a model which can recognize a handwritten equation from an image and then solve it. What kind of equation? Our model can recognize and solve basic and not-so-basic numerical expressions like 2+4 and 2*4+20/5, equations of one variable up to degree 2. This model works on the CNN architecture and has been made using various python libraries like TensorFlow, sympy, OpenCV etc
The working of the model is divided into two parts:
• Recognition of the Equation
• Solving the Equation
Recognition of Equation:
After the image input is fed into the model, it identifies the digits and draws contours around them. After that, it recognizes the digit or math symbols present in that contour.
Solving the Equation:
After the Recognition is done the system checks for a variable in the equation. If it recognizes a variable in the equation, it solves the equation for that variable, otherwise, it interprets the equation as a numeric expression and solves it.
There are two files; model.ipynb and main.ipynb containing the model and equation solver respectively.
To run the program open main.ipynb and first write the image path containing the equation in the following code:
img = cv2.imread('write your path here',cv2.IMREAD_GRAYSCALE)
Now run the program to get the final output.
This file contains the main program of our equation solver including the trained model
This file contains the definition of the model, training of the model and testing of the model.