Skip to content

ScribbleSolver is a web based ML model, leveraging CNNs and OCR to translate and solve handwritten mathematical equations with a high accuracy of 98.27%. It demonstrates the effective application of ML in resolving intricate real-world problems.

mohamzamir/ScribbleSolver-Equation-Solver-Model

Repository files navigation

ScribbleSolver

Project Overview

The ScribbleSolver is a web based machine learning model that combines Convolutional Neural Networks (CNNs) and Optical Character Recognition (OCR) technology to recognize and interpret handwritten mathematical equations. This project has resulted in a model that accurately identifies digits and mathematical symbols from handwritten input, effectively translating these into solvable equations.

Our model is highly accurate with a measured accuracy of 98.27%, and a minimized loss function of 0.656%. This showcases the successful application of machine learning techniques to solve complex, real-world problems.

Dependencies

Flask==2.1.1
gunicorn==20.1.0
pybase64
Pillow
requires.io
numpy
sympy
opencv-python-headless
regex
tensorflow
keras

Keep in mind:

A. Scribble:

1. Scribble any one variable equation on the drawing board.
2. Note: The model is trained only on "x", so make sure to use "x" only. It can be trained on more variables but to improve efficiency and simplicity we used x.
3. Make sure there is space between each number so that it recognises easily.
4. Equations should be in the format of "ax²+bx+c=0". Make sure to include "=0" or "=anything" at the end.
5. Cannot handle negative power.
6. Press the solve equation button and wait for few seconds for the roots.

B. Enter:

 1. Enter the equation in the input field.
2. Equations should be in the format of "ax^2 + bx + c = 0". Make sure to include "=0" or "=anything" at the end.
3. Can handle negative power.
4. Press the solve equation button and wait for few seconds for the roots.

C. The digits are not recognisable when they overlap each other's space.

Screenshot 2023-07-17 at 5 29 43 AM
D. The digits are recognisable when they are in their own space.

Screenshot 2023-07-17 at 5 29 43 AM

How to use?

Scribble:

  1. Scribble eqution on the drawing pad.
Screenshot 2023-07-17 at 5 29 43 AM
  1. Press solve equation button to solve.
Screenshot 2023-07-17 at 5 30 00 AM

Enter:

  1. Enter an equation in the input field.
Screenshot 2023-07-17 at 5 31 00 AM
  1. Press solve equation button to solve.
Screenshot 2023-07-17 at 5 31 17 AM

Error:

  1. Any wrong input or invalid equations are rejected.
    a. Scribble: Screenshot 2023-07-17 at 5 31 35 AM b. Enter: Screenshot 2023-07-17 at 5 31 50 AM

Installation

Clone the repo

git clone https://github.com/mohamzamir/ScribbleSolver

Model

The model uses a combination of Convolutional Neural Networks (CNNs) for feature extraction from the image inputs, and Optical Character Recognition (OCR) technology for converting the detected features into understandable symbols.

Our CNN architecture consists of a series of convolutional, max pooling, and dense layers, with a final softmax layer for multi-class classification of the different digits and mathematical symbols.

The OCR technology then translates these classified features into a form that can be used to generate a solvable equation.

Performance

Our model achieved an accuracy of 98.27%, with a minimized loss function of 0.656%. This level of performance demonstrates that our model is highly effective at recognizing and interpreting handwritten mathematical equations.

Future Work

We are planning to extend this model to recognize more complex mathematical symbols and to work on larger and more complex equations. Feedback and contributions are always welcome.

License

Copyright [2023] [Amir Hamza]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at:

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

ScribbleSolver is a web based ML model, leveraging CNNs and OCR to translate and solve handwritten mathematical equations with a high accuracy of 98.27%. It demonstrates the effective application of ML in resolving intricate real-world problems.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published