Skip to content

A Rock-Paper-Scissors Pygame with a CNN Multiclass Classifier model built in Keras to recognize real-time hand gestures using OpenCV.

License

Notifications You must be signed in to change notification settings

Darlene-Naz/Rock-Paper-Scissors-OpenCV

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rock-Paper-Scissors

A Rock-Paper-Scissors Pygame with a CNN Multiclass Classifier model built in Keras to recognize real-time hand gestures using OpenCV.

Working Demo

Overview

This game simply uses your computer's camera to capture realtime gestures of your hand.

The pictures taken by the camera are processed and fed to a CNN Multi-class image classifier that determines whether the gesture corresponds to "Rock", "Paper" or "Scissors" gesture.

This CNN model is made in keras. You can download the pretrained model from here & the dataset from this drive link.

Prologue

After completing a couple of CNN courses on coursera I wanted to hone my skills by focusing on a small project. So I found 2 useful datasets and jumped straight into building my model. I didnt want to stop there... this led me to create my first pygame. I'm happy with my progress and would like to share it with you.

Getting Started

1. Clone the repository

git clone <this_repo_url>

2. Start a virtual environment eg. conda (Recommended)

conda activate <my_virtual_env>

3. Download the requirements

cd Rock-Paper-Scissors-OpenCV
pip install requirements.txt

4. Download the model

.
├───models                      # model.h5 files here
├───notebooks
│   └───.ipynb_checkpoints
├───readme_requirements
│   └───video
├───src
│   ├───components
│   │   └───__pycache__
│   └───utils
│       ├───images
│       └───__pycache__
└───tests
    ├───integration
    └───unit

5. Run the game

python src/main.py

Outputs

Round 1 Round 2 Round 3
Player-Paper Player-Scissor Player-Scissor
Round 4 Round 5 Round 6
Player-Rock Player-Scissor Player-Rock
Command Line Output

Task List

  • Create a CNN Multi-Class Classifier
  • Integrate it with OpenCV
  • Create my 1st Pygame
  • Structure Code!
  • Work more on the model
  • Fix bugs & Add comments to code

References

CNN Links :

Pygame Links :

License

License: MIT

MIT License Link

© 2020 Darlene Nazareth

About

A Rock-Paper-Scissors Pygame with a CNN Multiclass Classifier model built in Keras to recognize real-time hand gestures using OpenCV.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published