Code Monkey home page Code Monkey logo

guess-a-sketch's Introduction

Guess-a-Sketch

Build

https://jlemon.org/projects/guess-a-sketch/

A React web application where users can sketch on a canvas and have a convolutional neural network attempt to classify the drawing. Predictions are made in real-time as the user adds strokes to the canvas. The machine learning algorithm is performed client-side in the user's browser using Tensorflow.js.

Machine Learning

The web application loads a convolutional neural network which was pre-trained on a subset of Google's "Quick, Draw!" dataset. The construction and training of this network can be found at https://github.com/joeylemon/sketch-classifier. Google's dataset is provided in the form of drawing strokes instead of images. Therefore, during the training of the model, these strokes were used to generate images on-the-fly to be fed into the network. Additionally, to provide the network with even more context on stroke patterns, each individual stroke is colored differently, as seen below:

To follow the training algorithm, the web application similarly colors a user's sketches when they are sent to the network. Additionally, a few more modifications to the user's sketches are performed to follow how the "Quick, Draw!" dataset was created:

  • Align the drawing to the top-left corner, to have minimum values of 0.
  • Uniformly scale the drawing, to have a maximum value of 64 pixels.
  • Simplify all strokes using the Ramer–Douglas–Peucker algorithm (implemented with Simplify.js) with an epsilon value of 2.0.

After performing all of these modifications, the image is sent to the neural network and an array of probabilities is returned and presented to the user.

guess-a-sketch's People

Contributors

joeylemon avatar

Watchers

 avatar

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.