Giter Club home page Giter Club logo

indian-sign-language-recognition's Introduction

Indian-Sign-Language-Recognition

Sign Languages are a set of languages that use predefined actions and movements to convey a message. These languages are primarily developed to aid deaf and other verbally challenged people. They use a simultaneous and precise combination of movement of hands, orientation of hands, hand shapes etc. Different regions have different sign languages like American Sign Language, Indian Sign Language etc. We focus on Indian Sign language in this project.

Indian Sign Language (ISL) is a sign language that is predominantly used in South Asian countries. It is sometimes referred to as Indo-Pakistani Sign Language (IPSL). There are many special features present in ISL that distinguish it from other Sign Languages. Features like Number Signs, Family Relationship, use of space etc. are crucial features of ISL. Also, ISL does not have any temporal inflection.

In this project, we aim towards analyzing and recognizing various alphabets from a database of sign images. Database consists of various images with each image clicked in different light condition with different hand orientation. With such a divergent data set, we are able to train our system to good levels and thus obtain good results.

We investigate different machine learning techniques like Support Vector Machines (SVM), Logistic Regression, K-nearest neighbors (KNN) and a neural network technique Convolution Neural Networks (CNN) for detection of sign language.

Getting Started

Prerequisites

Before running this project, make sure you have following dependencies -

Now, using pip install command, include following dependencies

  • Numpy
  • Pandas
  • Sklearn
  • Scipy
  • Opencv
  • Tensorflow

Running

To run the project, perform following steps -

  1. Take the dataset folder and all the required python files and put them in the same folder.
  2. Required files are - surf_image_processing.py(Image preprocessing folder), preprocessing_surf.py (Bag of features folder), classification.py(classification folder) and visualize_submissions.py(visualization folder).
  3. Run the preprocessing_surf.py file to make the csv file of training data set.
  4. classification.py contains the code for svm, knn and many other classifiers.
  5. cnn.py contains the code for deep learning as the name suggests.

Workflow


Image Preprocessing

Segmentation:

The main objective of the segmentation phase is to remove the background and noises, leaving only the Region of Interest (ROI), which is the only useful information in the image. This is achieved via Skin Masking defining the threshold on RGB schema and then converting RGB colour space to grey scale image. Finally Canny Edge technique is employed to identify and detect the presence of sharp discontinuities in an image, thereby detecting the edges of the figure in focus.



BGR to HSV           Masked           Canny Edge


Feature Extraction:

The Speeded Up Robust Feature (SURF) technique is used to extract descriptors from the segmented hand gesture images. SURF is a novel feature extraction method which is robust against rotation, scaling, occlusion and variation in viewpoint.


Classification

The SURF descriptors extracted from each image are different in number with the same dimension (64). However, a multiclass SVM requires uniform dimensions of feature vector as its input. Bag of Features (BoF) is therefore implemented to represent the features in histogram of visual vocabulary rather than the features as proposed. The descriptors extracted are first quantized into 150 clusters using K-means clustering. Given a set of descriptors, where K-means clustering categorizes numbers of descriptors into K numbers of cluster center.

The clustered features then form the visual vocabulary where each feature corresponds to an individual sign language gesture. With the visual vocabulary, each image is represented by the frequency of occurrence of all clustered features. BoF represents each image as a histogram of features, in this case the histogram of 24 classes of sign languages gestures.

Bag of Features model

Following Steps are followed to achieve this:

  • The descriptors extracted are first clustered into 150 clusters using K-Means clustering.

  • K-means clustering technique categorizes m numbers of descriptors into x number of cluster centre.

  • The clustered features form the basis for histogram i-e each image is represented by frequency of occurrence of all clustered features.

  • BoF represents each image as a histogram of features, in our case the histogram of 24 classes of sign language is generated.

Classifiers

After obtaining the baf of features model, we are set to predict results for new raw images to test our model. Following classifiers are used :

  • Naive Bayes
  • Logistic Regression classifier
  • K-Nearest Neighbours
  • Support Vector Machines
  • Convolution Neaural Network

Results

Results can be visualized by running file visualize_submissions.py.

Accuracy without SURF



Accuracy with SURF


Credits

If there are any doubts or queries with the process, refer these posts, they are amazing -

indian-sign-language-recognition's People

Contributors

imrishabhgupta avatar vanshraj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

indian-sign-language-recognition's Issues

preprocessing_surf.py

screenshot from 2018-08-25 23-16-45
Getting this error when trying to run the code ..
All given steps have been followed.

preprocessing_surf

This is the error coming"module 'cv2.cv2' has no attribute 'xfeatures2d'"

X and Y are not defined in preprocessing_surf.py

X_train, X_test, X_val, y_train, y_test, y_val = perform_data_split(X, y, training_idxs, test_idxs, val_idxs)
Traceback (most recent call last):

File "", line 1, in
X_train, X_test, X_val, y_train, y_test, y_val = perform_data_split(X, y, training_idxs, test_idxs, val_idxs)

NameError: name 'X' is not defined

@imRishabhGupta I couldn't find where you defined X and y in this program

Missing CSV files

submission_cnn.csv and submission_knn.csv files are missing. Let me know !!! I grave need.

Help

Shubhams-MacBook-Pro:sign1 shubhamsonkesriya$ python3 preprocessing_surf.py
Train-test-val split: 0 training rows, 0 test rows, 0 validation rows
0 descriptors before clustering
Using clustering model MiniBatchKMeans(batch_size=100, compute_labels=True, init='k-means++',
init_size=None, max_iter=100, max_no_improvement=10,
n_clusters=150, n_init=3, random_state=None,
reassignment_ratio=0.01, tol=0.0, verbose=0)...
Clustering on training set to get codebook of 150 words
Traceback (most recent call last):
File "preprocessing_surf.py", line 203, in
X, cluster_model = cluster_features(img_descs, training_idxs, MiniBatchKMeans(n_clusters=150))
File "preprocessing_surf.py", line 119, in cluster_features
cluster_model.fit(all_train_descriptors)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/sklearn/cluster/_kmeans.py", line 1509, in fit
dtype=[np.float64, np.float32])
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/sklearn/utils/validation.py", line 556, in check_array
"if it contains a single sample.".format(array))
ValueError: Expected 2D array, got 1D array instead:
array=[].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.

Train40 and Train60 (.csv)

There is no code written to generate train40 or train60 in preprocessing_surf.py but those files are read in classification.py
Need some more clarity in Readme

query

does it recognize sign language in real-time?

Python 3

Can anyone comment on how to run this using python 3.x?

Dataset link is down

Hi
The link to the dataset that you have provided in your readme seems to be down. Can you please update it?

ValueError: a must be non-empty

runfile('C:/Users/anu/Downloads/Indian-Sign-Language-Recognition-master/Indian-Sign-Language-Recognition-master/Bag of Features/preprocessing_surf.py', wdir='C:/Users/anu/Downloads/Indian-Sign-Language-Recognition-master/Indian-Sign-Language-Recognition-master/Bag of Features')
Reloaded modules: surf_image_processing
Traceback (most recent call last):

File "", line 1, in
runfile('C:/Users/anu/Downloads/Indian-Sign-Language-Recognition-master/Indian-Sign-Language-Recognition-master/Bag of Features/preprocessing_surf.py', wdir='C:/Users/anu/Downloads/Indian-Sign-Language-Recognition-master/Indian-Sign-Language-Recognition-master/Bag of Features')

File "C:\Users\anu\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 668, in runfile
execfile(filename, namespace)

File "C:\Users\anu\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/anu/Downloads/Indian-Sign-Language-Recognition-master/Indian-Sign-Language-Recognition-master/Bag of Features/preprocessing_surf.py", line 201, in
training_idxs, test_idxs, val_idxs = train_test_val_split_idxs(len(img_descs), 0.4, 0.0)

File "C:/Users/anu/Downloads/Indian-Sign-Language-Recognition-master/Indian-Sign-Language-Recognition-master/Bag of Features/preprocessing_surf.py", line 67, in train_test_val_split_idxs
test_idxs = np.random.choice(row_range, size=no_test_rows, replace=False)

File "mtrand.pyx", line 1126, in mtrand.RandomState.choice

ValueError: a must be non-empty

preprocessing_surf.py Value Error: Expected 2D array, got 1D array instead

sklearn\cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
C:\Users\bipin\Anaconda3\lib\site-packages\sklearn\grid_search.py:42: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. This module will be removed in 0.20.
DeprecationWarning)
Train-test-val split: 0 training rows, 0 test rows, 0 validation rows
0 descriptors before clustering
Using clustering model MiniBatchKMeans(batch_size=100, compute_labels=True, init='k-means++',
init_size=None, max_iter=100, max_no_improvement=10,
n_clusters=150, n_init=3, random_state=None,
reassignment_ratio=0.01, tol=0.0, verbose=0)...
Clustering on training set to get codebook of 150 words
Traceback (most recent call last):
File "preprocessing_surf.py", line 204, in
X, cluster_model = cluster_features(img_descs, training_idxs, MiniBatchKMeans(n_clusters=150))
File "preprocessing_surf.py", line 120, in cluster_features
cluster_model.fit(all_train_descriptors)
File "C:\Users\bipin\Anaconda3\lib\site-packages\sklearn\cluster\k_means_.py", line 1354, in fit
dtype=[np.float64, np.float32])
File "C:\Users\bipin\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 441, in check_array
"if it contains a single sample.".format(array))
ValueError: Expected 2D array, got 1D array instead:
array=[].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.

This is the error I get when I try to run preprocessing_surf.py. How do I solve this error?

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.