Giter VIP home page Giter VIP logo

automark's Introduction

AutoMark

Take a picture of a "Grade-it" math worksheet and AutoMark will automatically grade it!

This project is intended as a proof-of-concept (that automatically grading math worksheets is feasable) prior to creating a website that generates worksheets and an app that grades them.

Final result

AutoMark reads a "Grade-it" QR code/form code and uses that to get the associated answer key. It then reads students' handwritten responses. It displays a color coded worksheet showing which problems the student got right and wrong.

Adapted from SnapSuduku by Prajwal

Prerequisites:

  • Python 3

    • Download from here
  • PyZBar

    • sudo apt-get install libzbar0
  • All other requirements can be installed using:

    • pip install -r requirements.txt

Running AutoMark:

git clone https://github.com/tutordelphia/AutoMark.git
cd AutoMark/AutoMark
python automark.py <path-to-input-image>

An Example Input:

Here's a image of a "Grade-it" worksheet from a smartphone:

Input Worksheet Image

The current code gives this output:

Final result

The student filled in 9 problems correctly and 5 problems incorrectly.

The program correctly marked 12 problems (8 correct in green and 4 incorrect in red).

The program marked 2 problems as unknown (with a yellow box and black text). It was unable to segment the connected digits on problem #2 and unable to read the student's handwriting on problem #10.

Algorithm

  1. Basic image preprocessing - Thresholding.
  2. Crop out the worksheet.
  3. Warp the perspective of the worksheet (to make it rectangular).
  4. Read the form code from the QR Code (using PyZBar)
  5. Get the boxes where the student entered their handwritten answers (filtering contours).
  6. Segment the handwritten digit string (this needs to be improved, currently contours are used which don't work when digits touch)
  7. Transform the segmented digits to MNIST's standards
  8. Look up the answer key from the form code.
  9. Predict the value of the handwritten digits using a pretrained model from Keras's example Convolutional Neural Network for MNIST.
  10. Display the graded result on the worksheet.

A Detailed Step-by-Step Example:

Two images are shown at some steps. The various steps perform best with different preprocessing so rather than keeping one preprocessed image, the original image is also cropped and kept.

After Preprocessing:

Preprocessing

Crop out the largest contour:

Cropped worksheet thresh

Warp perspective to a letter sized rectangle:

Warped

Crop out the cells:

Cell 1 Cell 3

Remove the borders:

Without borders 1 Without borders 2

Apply thresholding and use contours to segment digit strings

Thresh digits Thresh digits 2

Note this process will not work when digits touch (like the 2 and 3 below):

Touching digits

Segmented the digits:

Segmented 1
Segmented 2

Format the digits to match MNIST specs:

MNIST 1 MNIST 2

Final Result:

Final result


TODO:

  • Test AutoMark with a larger variety of images from different cameras.
  • Improve digit string segmentation (watershed?).
  • Implement a form code database.

Related Projects:

Grade-it: A math worksheet generator


Acknowledgements

Thank you to the creators and contributors of SnapSuduku

Thank you to octagonaltree for the mentorship and guidance.

Thank you to Chris Lowen for the feedback.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.