Sign Language Translation with Deep Learning
Sign Language Translation with Deep Learning
LEARNING
SUMMER INTERNSHIP
Submitted by
MEERA.D (622623243032)
ASHIKA.T (622623243006)
ARISH.S (622623243004)
MUKESH.L (622623243034)
1
BONAFIDE CERTIFICATE
2
ACKNOWLEDGMENTS
We extend our sincere thanks to all the Faculty members and Non Teaching
staff members of Computer Science and Engineering of Shreenivasa
Engineering College for great help.
.
3
ABSTRACT
Sign Languages are used for communication by the people with hearing and
speaking disabilities. Even though these languages are common within the
community, many people cannot interpret these signs. This creates a “language
barrier” thus inhibiting communication among people with hearing and speaking
disabilities and the others. It is difficult for people to learn all the different sign
languages, since there are many versions. The seemingly big learning curve and
probable infrequent encounters where sign language is used for communication
poses a big challenge for the people with hearing and speaking disabilities to be
understood. This is where a translation application from sign language is useful.
There is significant ongoing research that aims to create models based on deep
learning which are best in class for gesture recognition. The dataset for the hand
signs has been expanding ever since the research began and more and more
accurate models are being developed.
The implementation of a translation application is the main purpose of this
project. Microcontrollers and cameras are used to capture videos and process them
using convolutional and recurrent neural networks. A small dataset was created
specifically for training purposes in this project to counter the resource constraints.
The convolutional and recurrent parts of the network extract the spatial and
temporal features within the video, respectively. They finally predict the class of
the captured video frames, stored in a buffer until being passed to the network. The
predictions from the neural network, mapped to the classes, are then converted into
audio signals which are output by a speaker attached to the microcontroller. Thus
the entire pipeline allows for the people to interpret and understand the sign
language without requiring to learn the sign language itself.
4
TABLE OF CONTENTS
ABSTRACT 4
LIST OF TABLE 10
LIST OF FIGURES 11
LIST OF ABBREVIATIONS 14
1 INTRODUCTION 15
[Link] 3D-CNN 18
5
[Link] Long Short-Term Memory 18
[Link] ConvLSTM 18
2 LITERATURE REVIEW 20
3 COMPUTER VISION 23
3.1 INTRODUCTION 23
3.1.1 Applications 23
3.3 FEATURES 25
3.6 DATASET 27
4 HARDWARE DESCRIPTION 30
4.1 RASPBERRY PI 30
4.1.1 Hardware 31
6
4.1.3 Setting up Raspberry Pi 35
4.2 CAMERA 35
4.2.2 Features 36
4.3 SPEAKER 36
4.3.1 Specifications 37
5 DEEP LEARNING 38
7
5.6.1 Vanishing Gradient Problem 51
6 PROPOSED METHODOLOGY 57
6.1 CAMERA 58
7 RESULT ANALYSIS 62
8
8 CONCLUSION AND FUTURE WORK 68
8.1 CONCLUSION 68
REFERENCES 70
APPENDIX 72
9
LIST OF TABLES
1
0
LIST OF FIGURES
1
1
5.8 (d) Many to Many 51
5.9 Represents the possibility 52
of losing information due
to vanishing gradient
5.10 Long Short-Term 53
Memory
5.11 (a) Forget gate decision 55
5.11 (b) Input gate decision 55
5.11 (c) Updating the old cell 55
state into the new cell
state
5.11 (d) Output gate decision 55
5.12 Structure of a 56
ConvLSTM network
6.1 Block diagram of the 57
recognition and
translation process
6.2 The proposed neural 59
network architecture
6.3 An example of the 60
softmax function
7.1 Organization of the 62
dataset into train and test
sets
7.2 Organization of the 62
classes to be trained
7.3 Collection of videos of a 63
class
7.4 A 640 x 480 frame 63
1
2
7.5 Neural network model 65
along with the number of
parameters
7.6 Results after each epoch 65
of the training process
7.7 (a) Accuracy vs Number of 66
epochs
7.7 (b) Loss vs Number of 66
epochs
7.8 (a) Prediction for “Hello” 67
7.8 (b) Prediction for “Yes” 67
7.8 (c) Prediction for “Friend” 67
1
3
LIST OF ABBREVIATIONS
1D One Dimension
2D Two Dimension
3D Three Dimension
CNN Convolutional Neural Network
LSTM Long Short-Term Memory
TGCN Temporal Graph Convolutional Network
RELU Rectified Linear Unit
RGB Red, Green, Blue
ASL American Sign Language
CV Computer Vision
CPU Central Processing Unit
GPU Graphics Processing Unit
GPIO General Purpose Input/ Output
RAM Random Access Memory
UART Universal Asynchronous Receiver Transmitter
PC Personal Computer
SD Secure Digital
USB Universal Serial Bus
ML Machine Learning
ANN Artificial Neural Network
1
4
CHAPTER 1
INTRODUCTION
Sign languages are languages that convey meaning using visual cues with
the help of hand gestures and expressions. These languages have specific grammar
and lexicon that go along with them. They are not universal but have similarities
among them. Thus sign languages are like any other language and have to be
learnt. These languages are primarily used by people who are unable to speak or
hear. Most countries use a specific sign language such as ASL (American Sign
Language) in the USA and Canada, French Sign Language used in France and
British, Australian and New Zealand Sign Language used in their respective
countries. International Sign, formerly referred as Gestuno, is the main language
used in events involving people with hearing disabilities.
1
5
people with hearing and speaking disorders to communicate without any
expectations from the listener.
1
6
1.3.2 PASSING THE FRAMES THROUGH THE NEURAL NETWORK
The neural networks form the basis of the translation system as they perform
the classification of videos. In contrast to the 2D Convolutional Neural Networks
that can identify images based on spatial features, a model that is capable of
extracting spatial as well as temporal features is required to accommodate the
video data, essentially a collection of images. As the collection of images from a
3D array, 3D CNNs can be used. 2D Convolution and LSTM can be used in
conjunction to perform the same operation. Various other networks like Pose-based
TGCN and Multilayer Perceptrons can be used. The 2D Convolution + LSTM
model provided more accurate results for the dataset created.
1
7
[Link] 3D-CNN
In a 3D-CNN, the frames are taken as 3-dimensional arrays and then passed
onto the layers with convolution operations with 3D filters that capture spatial and
temporal features, thus ensuring the connection between frames is learned by the
model. It helps in capturing motion information that is crucial for identifying the
hand gesture. In a convolution operation on 3-dimensions, a filter is able to
traverse in 3 directions namely the width, height and channels of the respective
image. At every pixel, addition and matrix element-wise multiplication output a
single number. The output from the 3-dimensional convolutional operations are a
3D matrix, due to the fact that the filter traverses through a 3-dimensional domain.
[Link] ConvLSTM
1
8
1.3.3 CLASS PREDICTION AND AUDIO OUTPUT
The output from the neural network, which is a prediction of the word class
the hand sign belongs to, is then converted to a speech signal, which is then
outputted through a speaker. The libraries like PyAudio perform the text-to-speech
conversion efficiently and thus enabling the complete translation to work.
Chapter 2 tells about the Literature survey. Chapter 3 tells about the image
processing technology being used to make image classifications. Chapter 4 informs
about the hardware components of the project which include camera, Raspberry Pi,
and a speaker. Chapter 5 deals with deep learning architecture and algorithms used
for video classification. Chapter 6 lays out the results obtained and its significance.
Chapter 7 tells about the conclusion and future work.
1
9
CHAPTER 2
LITERATURE SURVEY
2
0
data obtained from RGB-Depth cameras which gave additional depth information.
The work on Dynamic Hand Gesture Recognition using 3D-CNN and LSTM with
FSM Context-Aware Model, done by Noorkholis Luthfil et al (2019), Sensors
(Basel), provided insight into the usage of a combination of 3-Dimensional
Convolutional Neural Networks, Long Short-Term Memory and Finite State
Machine for hand gesture recognition.
The work on An Efficient Method for Human Hand Gesture Detection and
Recognition using Deep Learning Convolutional Neural Networks, done by P.S.
Neethu et al (2020), published in Springer Nature, provided information about the
use of CNNs for image classification using segmentation filters. It provides insight
into image filtering where the hand region is segmented from the whole image
using mask images. The research on Sign Language Recognition Using Deep
Learning on Custom Processed Static Gesture Images, done by Aditya Das et al
(2018), published at the International Conference on Smart City and Emerging
Technology, provided information about the usage of Inception v3 CNN network
on static images. The work on Real-time American Sign Language Recognition
with Convolutional Neural Networks, done by Brandon Garcia et al (2016), where
the GoogLeNet architecture is used for classification of ASL dataset.
The work on Deep Learning for Sensor-based Human Activity Recognition:
Overview, Challenges and Opportunities, done by Kaixuan Chen et al (2020),
provides an overview of the activity recognition using sensor-based systems rather
than video-based systems. The research on Human Activity Recognition Using
Deep Learning: A Survey, done Zhang HB et al (2019), published on the Lecture
Notes on Data Engineering and Communications Technologies, Volume 52,
provides insights into the state of the art for human activity recognition and
compares various methods. The work on Human activity recognition using
magnetic induction-based motion signals and deep recurrent neural networks,
2
1
carried out by Negar Golestani et al (2020), provides information about
recognizing human physical activities using wireless sensor networks and magnetic
induction systems along with machine learning techniques to detect human motion.
The work on Convolutional LSTM Network: A Machine Learning Approach for
Precipitation Nowcasting done by Xingjian Shi et al (2015), published in the
NeurIPS, presented a review on the ConvLSTM network and a comparison of
performance with a Fully-Connected LSTM.
2
2
CHAPTER 3
COMPUTER VISION
3.1 INTRODUCTION
● Object Recognition
● Pose Estimation
● Motion Estimation
● Event Detection
● Learning
3.1.1 APPLICATIONS
1. The quality and produce amount for crops like wheat and rice are used to
identify the food security stability. Computer Vision applications allow
continuous and non-destructive monitoring of growth of crops and
managing requirements for nutrients.
2
3
3. CV is used in the military for figuring out enemy vehicles, soldiers, and
aids missile guidance.
Initially image processing was used to improve the quality of the lower
quality images. But, due to constraints of the computing equipment during the
early days the cost of processing was high. After the development of dedicated
2
4
hardware and powerful computers the images could be processed in real-time and
even cheaper.
3.3 FEATURES
Types of Features
1. Edges
2. Corners
3. Blobs
4. Ridges
2
5
Feature detection is a low-level operation or the first operation performed on
the matrix of images and it examines every pixel to identify the presence of the
features in the pixels. The input is smoothened by a Gaussian kernel, as a
mandatory requirement for feature detection, and feature images are calculated and
expressed as local image derivative functions. When feature detection requires
high computer resources and time, a high-level algorithm is used to continue the
flow of data to the feature detection phase, so that the algorithm searches for
features in specific regions, masking out unwanted regions. Various CV methods
use feature detection in their first step and leads to development of numerous
feature detectors. They differ based on the features detected, repeatability the
computational complexity.
2
6
applications for credit cards, reading bank deposit slips, data entry, tax forms,
check sorting, etc.
In our proposed solution, a Deep Neural Network is used for the extraction
of features from the [Link] network is trained such that the neural network
figures out the best features to extract in order to identify and classify the inputs it
is provided with. The training occurs based on the dataset provided.
3.6 DATASET
2
7
Fig. 3.1 Representation of labelled data
A set of videos were recorded for creation of the dataset, which represented four
classes representing words frequently used, expressed in the American Sign
Language and one class for identifying the absence of any meaningful gesture
2
8
being performed. The classes thus comprise the words "Hello", "Yes", "No",
"Friend" and "No Action".
The videos are split into train and test sets for performing validation of the
dataset. There are about 50 videos for each class in the train dataset and about 15
videos for each class in the test dataset. A total of about 330 videos are used for the
entire training process.
2
9
CHAPTER 4
HARDWARE DESCRIPTION
1.1 RASPBERRY PI
A 256 MB 1 No
B 512 MB 2 Yes
B+ 1 GB 4 Yes
3
0
1.1.1 Hardware
The operating system must use network time as it does not come with a
real-time clock.
3
1
Power source
SD Card
The Central processing unit is the brain of the raspberry pi board which is
responsible for carrying out the instructions of the computer through logical and
arithmetical operations. The Raspberry Pi 3 Model B uses a Broadcom BCM2837
SoC with a 1.4 GHz 64-bit quad-core ARM Cortex-A53 processor, with 512 KB
shared L2 cache. ARM11 series processor is used by the raspberry pi. The
Raspberry Pi chip is operating at 700 MHz and it will not become hot enough to
need a heatsink or special cooling.
The GPU is a specially designed chip in the raspberry pi board and that is
designed to speed up the operation of image calculations. It is also designed with a
Broadcom video-core IV and it supports OpenGL.
3
2
USB 2.0 ports are the means to connect input devices such as a mouse,
keyboard to the Raspberry pi. There is only one port on model A, two on model B,
and four on model B+. The number of ports can be increased by using an external
power USB hub switch which is available as a standard Pi accessory.
Ethernet port
The main way for communicating with additional devices is the ethernet
port. This port is used to connect the Pi to the internet.
GPIO Pins
3
3
• Gigabit Ethernet over USB 2.0 (maximum throughput of 300 Mbps)
• Extended 40-pin GPIO header
• Full-size HDMI
• 4 USB 2.0 ports
• CSI camera port
• DSI display port
• 4-pole stereo output and composite video port
• Micro SD port
• 5V/2.5A DC power input
• Power-over-Ethernet (PoE) support
• The main advantage of Raspberry Pi is its small size and relatively high
power.
• One other advantage of Raspberry Pi is that it speeds up solving problems
using hardware compared to the software implementation.
• It also makes use of parallelization.
• Lower power consumption.
● Download an ISO disk image from the [Link] site and then extract
the folder contained in the zip file to some convenient location.
3
4
• Use the Raspberry Pi imager to install the Raspbian on the SD card.
• Wait till the Raspberry Pi Imager to finish writing into the SD card.
• Insert the SD card and set it up with Raspbian into the microSD card slot on
the bottom of the Raspberry Pi.
• Turn on the USB power supply and connect it to the Raspberry Pi’s power port.
• After Raspbian has been installed, click OK. Now Raspberry Pi will restart,
and Raspbian will then boot up.
1.2 CAMERA
3
5
• Processor Speed 1.0 Hz
1.2.2 Features
• Weight of 0.5lb
1.3 SPEAKER
Grove compatible generic speakers are used for outputting audio signals. It
is appropriate for single audio signalling and sound generation. It is equipped with
a potentiometer to adjust loudness and to clear sound out of a microcontroller.
Different tones can be generated using the speaker with different input frequencies.
1.3.1 Specifications
3
6
● Length (mm) - 130
● Width (mm) - 90
● Height (mm) -6
● Mounting hole diameter(mm) - 2
● Weight (gm) - 12
● Shipment weight - 0.016 Kg
● Shipment dimensions - 9.5 × 6.8 × 1.2 cm
CHAPTER 5
3
7
DEEP LEARNING
3
8
from their own mistakes. A deep learning architecture is a multi-layer stack of
simple modules, all of which are subject to learning, and many of which compute
non-linear input-output mappings.
Linear Regression
3
9
It is a statistical method that allows us to summarize and study the
relationships between two continuous variables. The output is plotted in a graph as
dot points. Based on the points near the straight line, the final output is predicted.
Logistic Regression
Activation Function
Activation functions are the functions that decide the actual output and
therefore output of these layers as its ‘activations’. There are many types of
activation functions present.
Weights
When input data comes into a neuron, it gets multiplied by a weight value
that is assigned to this particular input. These weights start out as random values,
and as the neural network learns about the nature of input data it leads to, the
network adjusts the weights based on any errors in categorization that the previous
weights resulted in and this is mentioned as training. Once the network is trained, it
can be used for predicting the output for similar input.
Bias
Both weights and biases are the learnable parameters of the deep learning
models. It is a value-added to each layer’s output.
4
0
Forward Propagation
By propagating from the first layer (input layer) through all the
mathematical functions represented by each node, the network outputs a value.
This process is called Forward pass.
Gradient Descent
Back propagation
It depicts a neuron connected with n other neurons and thus receives n inputs
(x1,x2,…xn). This configuration is called a Perceptron. The inputs (x1,x2….) and
4
1
the weights (w1,w2….) are real numbers and can be either positive or negative.
The perceptron consists of weights, a summation processor, and an activation
function.
One particular type of deep, feedforward network that was much easier to
train and generalized much better than networks with full connectivity between
adjacent layers. This was the Convolutional Neural Network (ConvNet).
4
2
recognizing faces, etc,.. are some of the areas where CNN’s are widely used.
ConvNets are designed to process data that come in the form of multiple arrays, for
example, a color image composed of three 2D arrays containing pixel intensities in
the three color channels. Many data modalities are in the form of multiple arrays:
1D for signals and sequences, 2D for images, and 3D for video or volumetric
images.
4
3
through a regular deep network, allowing all the weights in all the filter banks to be
trained.
CNN’s image classification takes an input image, processes it, and classifies it
under various categories depending on the dataset it is being trained on. The
computer sees an image as an array of pixels and it depends on the image
resolution. Technically, Deep learning CNN models to train and test, each input
image will pass it through a series of convolution layers with filters (kernels),
pooling and fully connected layers, and a classification layer.
The convolutional layer is the first layer to extract features from an input
image. It preserves the relationship between pixels by learning image features
using small squares of input data. Convolution is the mathematical operation that
takes two inputs such as an image matrix and a filter or kernel. The image matrix
has a dimension of h x w x d and a filter of dimension as fh x fw x d. It outputs a
4
4
volume dimension of (h - f h + 1) x (w – fw + 1) x 1. The output obtained is
mentioned as a ‘feature map’. Always, the number of channels in the filter should
match the number of channels in the input image.
Strides
Stride is the number of pixels that shift over the input matrix. For example,
if the stride is 1, then the filter moves 1 pixel at a time.
Padding
Sometimes in the convolution process, output shrinks at each layer and a lot
of information is lost. Also, there is a possibility where the filter does not perfectly
fit the input image. There are two types: valid convolution and same convolution.
In “valid” convolution, no padding occurs and only keeps the valid part of the
image. In “same” convolution, padding occurs such that the output size of the
image should be the same as that of the input image.
Non-Linearity function
ReLU stands for Rectified Linear Unit for a non-linear operation. The
important usage of the ReLU function is that ConvNet should learn non-negative
linear values. The output is f(x)=max (0,x). Though there are many nonlinear
functions, ReLU’s performance is better than other functions.
4
5
Fig. 5.4 Example for ReLU function
Max Pooling
Max Pooling takes the largest element from the rectified feature map. This
type of pooling is generally used in all architectures.
Min Pooling
Min Pooling takes the smallest element from the rectified feature map in
accordance with the filter size.
Average Pooling
Average pooling returns the average of all the values from the portion of the
image covered by the kernel.
After several hidden layers, the high-level reasoning in the neural network is
done via Fully-connected layers. The fully Connected Layer involves weights,
biases, and neurons. Here, neurons in one layer are connected to neurons in another
4
6
layer. In this FC layer, the matrix is flattened into a vector form and fed to a neural
network. The below image is an example of a flattened FC layer.
The matrix is flattened into a vector form as x1, x2, x3, x4 and the output
consists of three classes such as y1, y2 and y3. Also, backpropagation is applied to
every iteration of training. Over a series of epochs, the model is able to identify the
dominant features and is classified using the SoftMax layer. This SoftMax layer is
a multi-class classifier that classifies the objects based on training datasets and
provides a confidence value.
4
7
There are many architectures used for the implementation of Convolutional
Neural Networks. Almost all the CNN architectures follow the same general design
principles for processing the input. It can be classified into Classic network
architectures and Modern architectures. Classic network architectures include
LeNet-5, AlexNet and VGG 16. Modern architectures include GoogleNet, ResNet,
etc.
Static images in sign languages are used to represent alphabets and numbers.
They are used when the user of sign language has to spell out some special words
such as names or express numbers. But when it comes to representing words, the
expressions are not static, rather they require movement of the hand, which is
captured in the form of videos. Videos are represented as a sequence of frames or
images. They are essentially 3-dimensional arrays composed of 2D images spread
over time.
4
8
A recurrent neural network is another neural network architecture where the
connections between nodes is in the form of a directed graph along a temporal
sequence. RNNs can use their internal state to process variable length sequences of
inputs. This internal state or memory enables them to take information from prior
inputs to affect the current input and output. Recurrent Neural Networks use
backpropagation through time (BPTT) algorithm to determine the gradients, which
is different from traditional backpropagation as it is specific to sequence data.
4
9
The nodes in the different layers of the neural network are combined to form a
single layer of RNN, with network parameters A, B and C.
Fig. 5.8 (a) One to One Fig. 5.8 (b) One to Many
5
0
Fig. 5.8 (c) Many to One Fig. 5.8 (d) Many to Many
RNNs have two common issues: vanishing gradient and exploding gradient.
The gradients carry information used in the RNN, and when the gradient becomes
too small, the parameter updates become insignificant. No useful gradient
information from the output end of the model is propagated to the layers near the
input of the model. Longer the sequence is, the smaller the gradient tends to
become. This makes the learning of long data sequences difficult. The models
become unable to learn on a given dataset, or prematurely converge to a
non-optimal solution.
5
1
Fig. 5.9 Represents the possibility of losing information due to vanishing
gradient
While training a neural network, if the slope tends to grow exponentially instead of
decaying, this is called an Exploding Gradient. This problem arises when large
error gradients accumulate, resulting in very large updates to the neural network
model weights during the training process.
Long training time, poor performance, and bad accuracy are the major issues in
gradient problems.
5
2
Fig 5.10 Long Short-Term Memory architecture
A common LSTM unit contains a cell, an input gate, an output gate and a
forget gate. The cell retains values over time intervals and the gates regulate the
flow of information in and out of the cell. They solve the vanishing gradient
problem faced by vanilla RNNs, because LSTM units allow gradients to flow
unchanged.
The key to LSTMs is the cell state, the horizontal line running through the top of
the diagram. It runs straight down the entire chain, with only some minor linear
interactions. It’s very easy for information to just flow along it unchanged.
The LSTMs have the ability to remove or add information to the cell state,
regulated by structures called gates. Gates allow to optionally let information
through. They are composed out of a sigmoid neural net layer and a pointwise
multiplication operation.
5
3
[Link] Forget Gate
The forget gate decides what information should be thrown away or kept.
Information from the previous hidden state and information from the current input
is passed through the sigmoid function. Values come out between 0 and 1. The
closer to 0 means to forget, and the closer to 1 means to keep.
To update the cell state, we have the input gate. First, the previous hidden
state and current input are passed into a sigmoid function. That decides which
values will be updated by transforming the values to be between 0 and 1. 0
corresponds to values being unimportant, and 1 corresponding to values being
important. The hidden state and current input are passed into the tanh function to
squish values between -1 and 1 to help regulate the network. Then the tanh output
is multiplied with the sigmoid output. The sigmoid output will decide which
information is important to keep from the tanh output.
To calculate the cell state, first, the cell state gets pointwise multiplied by the
forget vector. Values in the cell state could be dropped if it gets multiplied by
values near 0. Then we take the output from the input gate and do a pointwise
addition which updates the cell state to new values that the neural network finds
relevant. That gives a new cell state.
The output gate decides what the next hidden state should be. The hidden
state contains information on previous inputs and is also used for predictions. First,
the previous hidden state and the current input are passed into a sigmoid function.
5
4
Then the newly modified cell state is passed to the tanh function. The tanh output
is multiplied with the sigmoid output to decide what information the hidden state
should carry. The output is the hidden state. The new cell state and the new hidden
is then carried over to the next time step.
The steps taken under one LSTM cell are shown below.
Fig. 5.11 (a) Forget gate decision Fig. 5.11 (b) Input gate decision
Fig. 5.11 (c) Updating the old cell state Fig. 5.11 (d) Output gate decision
into the new cell state
ConvLSTM layers are similar to the LSTM layer, except the internal matrix
multiplications within the images are exchanged with convolution operations,
which tend to work well for image data. Although a Fully Connected LSTM layer
5
5
is powerful for handling temporal correlation, it contains too much redundancy for
spatial data. To avoid this ConvLSTMs, which possesses convolutional structures
in both input-to-state and state-to-state transitions can be used in place.
5
6
CHAPTER 6
PROPOSED METHODOLOGY
Sign Language translation is split into three stages, namely, video capturing,
prediction, and conversion of text-to-speech so that audio signals can be outputted.
The pipeline involves the usage of camera and speakers, interfaced with the
microcontroller, Raspberry Pi.
STEPS:
1. The camera interfaced with the Raspberry Pi captures the video
frame-by-frame.
2. The frames are stored in a buffer for a certain duration.
3. The frames in the buffer are then passed onto the neural network for
prediction of classes.
4. Outputting the predicted class in the form of audio signals through the
speaker using text-to-speech conversion.
5
7
6.1 CAMERA
A ConvLSTM deep neural network is used for predicting the classes from
the given input video sequence. Tensorflow library is used for performing the
neural network related operations. Other data handling libraries such as numpy and
sci-kit learn are used to aid in the training process. The input should be made
compatible with the neural network and hence the appropriate buffer is used to
store the frames. A multi-class classification is performed on the data, so as to
choose 1 from the 5 given classes. Thus, after prediction the class the video is
corresponding to can be obtained.
5
8
Fig. 6.2 The proposed neural network architecture
5
9
Batch normalization is applied after each ConvLSTM layer in order to
standardize the input to a layer for every mini-batch, thus stabilizing the learning
process and reducing the number of epochs required to train the network.
6.2.2 Dense layer
Once the ConvLSTM layers extract the spatial and temporal features within
the input, the neural network implements a flatten layer to create a 1-dimensional
array for further processing with the dense layers. The dense layer consists of
neurons that are interconnected to all the input and output neurons. This dense
layer allows the extracted features to be used in the prediction of classes. The
hidden layer contains 128 neurons and they are used with dropout to avoid the
problem of overfitting. Finally, these neurons are connected to 5 output neurons
representing the classes contained in the data. Since multi-class classification is
used, the output layer uses a SoftMax function as activation and the class with the
highest probability is chosen as the correct class.
6
0
6.3 AUDIO OUTPUT
Once the neural network predicts the class of the video sequence the class
text is converted into sound signal. This is attained with the help of the
Python-Text-To-Speech library. The audio is outputted through the speaker
connected as a peripheral device to the microcontroller.
The engine object of the pyttsx3 library is used to set the rate, volume and
voice of the instance running. This helps to customize our output corresponding to
the situation. The analog output is attained using the 3.5mm audio jack.
Once the audio is outputted, the buffer is released and new frames are
collected and stored in the buffer. This process continues on, thus enabling
translation of the signs performed.
6
1
CHAPTER 7
RESULT ANALYSIS
Sign language translation, with the advancement in hardware and algorithms
to be run on those powerful hardware, could eliminate the gap between the
differently-abled and others. A portable device that is able to translate sign
language would help the people with hearing and speaking difficulties, in various
social and work environments.
This chapter deals with the results obtained at the various stages of the
implementation. The dataset is very crucial for improving the ability of a network
in learning the required features and ultimately, the performance of the network.
7.1 RESULTS FROM THE COLLECTION OF DATASET
Fig. 7.1 Organization of the dataset into train and test sets
6
2
Fig. 7.3 Collection of videos of a class
6
3
Table 7.1. Organization of the classes representing words
The dataset was captured using the webcam with the help of OpenCV library
and stored such that each directory represents a class with the videos of that class
inside the directory. Three different people perform signing for the classes. Each
video is 2-4 seconds long, with a frame rate of 30 frames per second, and in the
".MP4'' format, containing all the three colour channels. Each frame is of the size
64 x 64 pixels. The train dataset consists of about 50 videos representing each
class, with the test dataset containing about 15 videos for each class. The dataset
totally has 251 videos for train data and 79 videos for test data.
7.2 RESULTS OBTAINED FROM TRAINING OF THE NEURAL
NETWORK
The neural network is fed with an array of frames as input to the first layer.
The shape of the array is thus (80, 64, 64, 64) which corresponds to (number of
frames, image height, image width, number of filters for convolution). The output
from the neural network is an array with the probabilities of each class, which is
calculated by the softmax activation in the output layer. The trained model is
exported and stored.
6
4
Fig. 7.5 Neural network model along with the number of parameters
6
5
Fig. 7.7 (a) Accuracy vs Number of epochs
The accuracy of the training was about 98% and the loss was about 2%.
6
6
and temporal features simultaneously, in contrast to CNN-RNN networks that
extract and learn from the features separately. 3D-CNNs while having more
accuracy than CNN-RNN models, they are still setup to capture spatial features
than temporal features. But the spatial features may have less weight when it
comes to video as the movement is essential. Therefore ConvLSTMs are apt for
this problem.
Fig. 7.8 (a). Prediction for “Hello” Fig. 7.8 (b). Prediction for “Yes”
6
7
Fig. 7.8 (c). Prediction for “Friend”
The output after each prediction is printed on the feed window for
representation. This class prediction is converted into speech using the
Python-Text-To-Speech library and outputted through the speaker connected to the
Raspberry Pi. This process allows the sign language gestures to be converted into
audio signals and thus enables a person carrying the portable device to
communicate intelligibly with everyone.
6
8
CHAPTER 8
8.1 CONCLUSION
The proposed method for sign language recognition and translation is being
developed using the sequential deep learning models with the help of Tensorflow,
OpenCV, and audio conversion with the help of pyttsx3 library. The system was
tested by performing sign language gestures in front of the camera and obtaining
the input for processing by the neural network. The input is collected frame-by-
frame, and they are stored in a buffer. After the collection of input in the required
format, it is passed onto the neural network for making predictions. Once the
prediction is made by the neural network, the predicted class is obtained from the
softmax probabilities. This class is outputted in the form of audio signals through
the speaker connected to the Raspberry Pi. After the word is outputted, the buffer is
cleared to allow the storage of new frames representing the next word. This process
is repeated to allow for translation of sign language in the form of gestures to
speech, word-by-word. The limitations are identified and a future plan of action is
created.
6
9
dataset could be recorded in various environments by different people creating a
diversity within the dataset and also allowing the model to focus only on the
features corresponding to the gesture and not the features of the surrounding or the
person performing the gesture.
A more accurate model could be trained by increasing the ConvLSTM layers
and the number of filters and the dense layer neurons could also be increased, all of
which could be applied on more powerful resources.
7
0
REFERENCES
[ 1] Van Hiep Phung, Eun Joo Rhee, “A High‐Accuracy Model Average Ensemble
of Convolutional Neural Networks for Classification of Cloud Image Patches on
Small Datasets”, Applied Sciences Machine Learning Techniques Applied to
Geospatial Big Data, 2019.
[ 2] Dongxu Li , Cristian Rodriguez Opazo, Xin Yu, Hongdong Li, “Word-level
Deep Sign Language Recognition from Video: A New Large-scale Dataset and
Methods Comparison”, IEEE Winter Conference on Applications of Computer
Vision (WACV), 2019.
[ 3] Andrej Karpathy, George Toderici, Sanketh Shetty, Thomas Leung, Rahul
Sukthankar, Li Fei-Fei, “Large-scale Video Classification with Convolutional
Neural Networks”, IEEE Conference on Computer Vision and Pattern Recognition,
2014.
[ 4] Pascal Schneider, Raphael Memmesheimer, Ivanna Kramer, Dietrich Paulus,
“Gesture Recognition in RGB Videos Using Human Body Keypoints and Dynamic
Time Warping”, Lecture Notes in Computer Science, Vol. 11531., Springer Cham.,
2019.
[ 5] Hao Tang, Hong Liu, Wei Xiao, Nicu Sebe, “Fast and Robust Dynamic Hand
Gesture Recognition via Key Frames Extraction and Feature Fusion”,
Neurocomputing, Volume 331, 2019.
[ 6] Dinh-Son Tran,Ngoc-Huynh Ho,Hyung-Jeong Yang,Eu-Tteum
Baek,Soo-Hyung Kim, Gueesang Lee, “Real-Time Hand Gesture Spotting and
Recognition using RGB-D Camera and 3D-Convolutional Neural Network”, 2018
International Conference on Machine Learning and Machine Intelligence, 2018.
[ 7] Noorkholis Luthfil Hakim, Timothy K Shih, Sandeli Priyanwada Kasthuri
Arachchi, Wisnu Aditya, Yi-Cheng Chen, Chih-Yang Lin, “Dynamic Hand Gesture
7
1
Recognition using 3D-CNN and LSTM with FSM Context-Aware Model”, Sensors
(Basel), 2019.
[ 8] P. S. Neethu, R. Suguna, Divya Sathish, “An Efficient Method for Human
Hand Gesture Detection and Recognition using Deep Learning Convolutional
Neural Networks”, Springer Nature, 2020.
[ 9] Aditya Das, Shantanu Gawde, Khyati Suratwala, Dhananjay Kalbande, “Sign
Language Recognition Using Deep Learning on Custom Processed Static Gesture
Images”, International Conference on Smart City and Emerging Technology, 2018.
[ 10] Brandon Garcia, Sigberto Alarcon Viesca, “Real-time American Sign
Language Recognition with Convolutional Neural Networks”, 2016.
[ 11] Kaixuan Chen, Dalin Zhang, Lina Yao, Bin Guo, Zhiwen Yu, Yunhao Liu,
“Deep Learning for Sensor-based Human Activity Recognition: Overview,
Challenges and Opportunities”, arXiv:2001.07416, 2020.
[ 12] Binjal Suthar,Bijal Gadhia, “Human Activity Recognition Using Deep
Learning: A Survey”, Lecture Notes on Data Engineering and Communications
Technologies, Volume 52, 2019.
[ 13] Negar Golestani, Mahta Moghaddam, “Human Activity Recognition using
Magnetic Induction-based Motion Signals and Deep Recurrent Neural Networks”,
Nature Communications, 2020.
[ 14] Xingjian Shi, Zhourong Chen, Hao Wang, Dit-Yan Yeung, Wai-kin Wong,
Wang-chun Woo, “Convolutional LSTM Network: A Machine Learning Approach
for Precipitation Nowcasting”, NIPS’15:Proceedings of the 28th International
Conference on Neural Information, 2015.
[ 15] [Link]
[ 16] [Link]
[ 17] [Link]
7
2
APPENDIX
import os
if not [Link]('data/train/noaction'):
[Link]('data/train/noaction')
if not [Link]('data/test/noaction'):
[Link]('data/test/noaction')
vid = [Link](0)
fourcc = cv2.VideoWriter_fourcc(*'MP4V')
flag = 0
frame_count = 0
vid_count = len([Link]('data/train/noaction'))
path = 'data/train/noaction/'
while(True):
if keyPress == ord('s'):
flag = 1
7
3
print("Writing")
fla = 0
vid_count = vid_count + 1
if vid_count == 50:
path = 'data/test/hello/'
[Link]()
print("Stopping")
break
[Link]("Feed", frame)
[Link]()
[Link]()
import cv2
import os
import numpy as np
def frame_collection(videoPath):
frames = []
vid = [Link](videoPath)
7
4
count = 1
if ret:
[Link](frame)
prev_frame = frame
else:
[Link](prev_frame)
count = count + 1
return frames
def dataset_extraction(inputdir):
X = []
Y = []
classes_list = [Link](inputdir)
for c in classes_list:
print(c)
for f in files:
print(f)
frames =
[Link](frames)
y = [0] * len(classes)
y[[Link](c)] = 1
[Link](y)
7
5
X = [Link](X)
Y = [Link](Y)
return X, Y
train_data, train_class =
dataset_extraction("/content/drive/MyDrive/data/train")
test_data, test_class =
dataset_extraction("/content/drive/MyDrive/data/test")
model = [Link]([
[Link](),
[Link](),
[Link](),
[Link](0.3),
])
[Link]()
metrics = ['accuracy'])
7
6
history = [Link](
train_data,
train_class,
epochs = 5,
batch_size = 8,
shuffle = True
[Link]('/content/drive/MyDrive/video_model1.model')
[Link]([Link]['accuracy'])
[Link]([Link]['val_accuracy'])
[Link]('model accuracy')
[Link]('accuracy')
[Link]('epoch')
[Link]()
[Link]([Link]['loss'])
[Link]([Link]['val_loss'])
[Link]('model loss')
[Link]('loss')
[Link]('epoch')
[Link]()
7
7
Source code for classification of videos
import numpy as np
import cv2
import tensorflow as tf
vid = [Link](0)
frame_count = 0
flag = 0
frames = []
prediction = ""
model = [Link].load_model("video_model.model")
while True:
[Link](frame)
frame_count = frame_count + 1
frame_count = 0
print("Done recording")
modelFrames = [Link](frames)
frames = []
pred = [Link](modelFrames)
predictionNum = [Link](pred[0])
prediction = classes[predictionNum]
print(prediction)
7
8
[Link](frameVid, prediction, (50, 150),
[Link]("Feed", frameVid)
[Link]()
[Link]()
7
9