• Stars
    star
    140
  • Rank 260,514 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created about 6 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

More Repositories

1

Handwritten-Number-Recognition-With-Image-Segmentation

Handwritten Number Recognition using CNN and Character Segmentation
Jupyter Notebook
18
star
2

Self-Playing-AI-Bot-using-Evolutionary-Algorithms

A self-playing bot built with NEAT-python for Chrome T-Rex game recreated in pygame
Python
10
star
3

Genetic-Algorithm-In-Python

Genetic Algorithm Library in Python3
Python
5
star
4

Draw-And-Rotate-Conics-Centered-At-Origin

Self Plot Conic Sections without using any mathematical or plotting framework
Python
5
star
5

Highly-Flexible-Weight-Based-Keyword-Search

A module in 100% Typescript used to provide efficient client side searching. It uses weight based KeyWord Search to search across a given object
TypeScript
3
star
6

Neural-Style-Transfer-using-VGG16-Keras-in-python

Python
3
star
7

Vit_Confessions

Anonymous messaging system for VIT University students.
JavaScript
1
star
8

OpenAI-gym-cartpole-with-NEAT-and-ReinforcementLearning-Performance-Comparison

Python
1
star
9

Sentiment-Analysis-using-Custom-State-Machine

Jupyter Notebook
1
star
10

EggCollecting-Game-using-pygame

Python
1
star
11

Track_Belonging

A complete system to enable intelligent crowd based tracking of any significant object. It allows the user to find the location of the belonging in accurately as well as in a cost-effective way compared to conventional GPS based trackers.
Kotlin
1
star
12

Neural-Nets

Contains work done mainly on Neural Networks and Machine Learning as a part of my interest for Data Science. The codes are in python and uses TensorFlow for Deep learning
Jupyter Notebook
1
star