Skip to content

A simple game in which Stone defeats Scissor, Scissor defeats Paper and Paper defeats Stone.

Notifications You must be signed in to change notification settings

aryan7781/Stone-Paper-Scissor

Repository files navigation

Stone-Paper-Scissors

Introduction

Let’s begin with recalling the classic game of “Stone Paper Scissors”. usually played between two people, in which each player simultaneously forms one of three patterns amongst the stone, paper, or scissors with the hands. This project is a web application, in which users can play the game with the computer using the webcam. So, there is a need to build a classifier that takes images of hands as inputs and gives the user’s expected to move as output. .

The fundamental rules of Rock, Paper, Scissors apply:
-> Scissors are defeated by Rock.
-> Paper gets cut by scissors.
-> Rock gets covered by paper.

Web App Sample Image

Sample

For the project, there is a need to build a classifier that takes images of hands as inputs and gives the user’s expected to move as output. Mediapipe is a library by Google that provides solutions for the recognition of key hand points. We use the library to gather Hand Landmarks for the three patterns that have meaning to the project i.e., Stone, Paper, and Scissors. The Hand Landmark Model in Mediapipe allows us to collect precise key points for 21 hand-knuckle coordinates on x and y axes inside the detected hand region.

Dataset- 15 thousand samples each for the patterns: “Stone”, “Paper”, and “Scissors” were collected, and used to construct a Machine Learning Model to classify new images(that has a hand representing one of the above patterns) into its respective class. These samples were used to build a machine learning model for the classification.

ML Model- After making required transformations in the dataset, in order to make the training smooth, and increase the expected accuracy of the model, a few fundamental Machine Learning Models like K-Nearest Neighbors, Support Vector Classifier, Random Forests Classifier, and Extreme Gradient Boosting were trained over the dataset, and their evaluation metrics were compared.

Evaluation Of Models-
-> We need a model, with high accuracy (of course, accuracy is almost always our first priority when it comes to building machine learning models).
-> The prediction time for our model, on a given dataset should be as low as possible. This is because the model has to be used to make real-time predictions on live videos of someone playing our game.

Chosen Model-
The pipeline that was chosen for classification in our project-
Pipeline(steps=[
   ('transformer', Update_and_drop()),
   ('scaler', StandardScaler()),
   ('clf', XGBClassifier(
     learning_rate=0.5,
     max_depth=5,
     n_estimators=250))])

About

A simple game in which Stone defeats Scissor, Scissor defeats Paper and Paper defeats Stone.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •