Skip to content

Rock Paper Scissors Lizard Spock in the browser with image recognition using deeplearn.js

Notifications You must be signed in to change notification settings

Dennitz/RockPaperScissorsLizardSpock.js

Repository files navigation

RockPaperScissorsPaperSpock.js

Play Rock Paper Scissors Lizard Spock against your browser.

By using a convolutional neural network, this demo can regonize which move is played. The neural network runs right in a browser, powered by deeplearn.js.

Demo

What's used?

Development

Work on the demo

yarn start

Take images for training

yarn train

This allows you to take images for training and save them in a folder per category.

If you do this multiple times (with page reloads) there will be conflicting names. To solve this use model-training/merge-dirs.py.

E.g. if you have the folders train1 and train2 each containing a folder per category, you can do:

python merge-dirs.py train2 train1

This will move all files from train2 to train1 and resolve naming conflicts.

After this you can delete train2 (which by now should not contain any files):

rm -rf train2

Train the model

The jupyter notebook model-training/rock-paper-scissors-lizard-spock.ipynb walks you through the process of training the neural net using keras. It also shows how to save the model for use with deeplearn.js.

The resulting weights can be downloaded here.

To run the notebook you need:

License

MIT