GithubHelp home page GithubHelp logo

a4aleem / hand-gesture-recognition-using-background-elllimination-and-convolution-neural-network Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sparshasaha/hand-gesture-recognition-using-background-elllimination-and-convolution-neural-network

1.0 1.0 0.0 201.09 MB

Hand Gesture Recognition using Convolution Neural Network built using Tensorflow, OpenCV and python

License: MIT License

Jupyter Notebook 36.84% Python 63.16%

hand-gesture-recognition-using-background-elllimination-and-convolution-neural-network's Introduction

Hand Gesture Recognition Using Background Ellimination and Convolution Neural Network

About the Project

This is a simple application of Convolution Neural Networks combined with background ellimination to detect different hand gestures. A background ellimination algorithm extracts the hand image from webcam and uses it to train as well predict the type of gesture that is. More information about the algorithm can be found below.

Requirements

  • Python3
  • Tensorflow version=1.13.1
  • TfLearn
  • Opencv headless (cv2) for python3
  • Numpy
  • Pillow (PIL)
  • Imutils

File Description

PalmTracker.py : Run this file to generate custom datasets. Go into the file and change the name of the directory and make other appropriate changes.

ResizeImages.py : Run this file after PalmTracker.py in order to resize the images so that it can be fed into the Convolution Neural Network designed using tensorflow. The network accepts 89 x 100 dimensional image.

ModelTrainer.ipynb : This is the model trainer file. Run this file if you want to retrain the model using your custom dataset.

ContinuousGesturePredictor.py : Running this file opens up your webcam and takes continuous frames of your hand image and then predicts the class of your hand gesture in realtime.

Some key architectural insights into the project

Background Ellimination Algorithm

I have used opencv for taking a running average of the background for 30 frames and then use that running average to detect the hand that has to be introduced after the background has been properly recognized.

I had found a very useful article on foreground mask by Gogul09 and i have pretty much used his code for background ellimination with a few changes in order to suit my cause.

He has written an awesome article on the problem and you can read it up here.

The Deep Convolution Neural Network

The network contains 7 hidden convolution layers with Relu as the activation function and 1 Fully connected layer.

The network is trained across 50 iterations with a batch size of 64.

I kind of saw that 50 iterations kind of trains the model well and there is no increase in validation accuracy along the lines so that should be enough.

The model achieves an accuracy of 96.6% on the validation dataset.

The ratio of training set to validation set is 1000 : 100.

How to run the RealTime prediction

Run the ContinuousGesturePredictor.py file and you will see a window named Video Feed appear on screen. Wait for a while until a window named Thresholded appears.

The next step involves pressing "s" on your keyboard in order to start the real-time prediction.

Bring your hand in the Green Box drawn inside Video Feed window in order to see the predictions. Look in demo for some visual clarity.

Demo of how things look on the go

Well now it's time for some demo.

Alt Text

hand-gesture-recognition-using-background-elllimination-and-convolution-neural-network's People

Contributors

sparshasaha avatar mohammed-emad avatar

Stargazers

Muhammad Aleem Siddiqui avatar

Watchers

James Cloos 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.