![]() |
VOOZH | about |
Sign language is a important mode of communication for individuals with hearing impairments. Building an automated system to recognize sign language can significantly improve accessibility and inclusivity.
In this article we will develop a Sign Language Recognition System using TensorFlow and Convolutional Neural Networks (CNNs) .
In the first step we will import all the necessary libraries. Python libraries simplify data handling and machine learning tasks.
The dataset is available as two CSV files, sign_mnist_train.csv and sign_mnist_test.csv. Each row in the CSV file is a training sample with the 0th index having the labels from 0-25 and the rest of the row containing the 784-pixel values of a 28 x 28 image. Each pixel value will be in the range [0, 255].
You can download the dataset from here.
Output:
The dataset has been provided in two files one is for training and the other one is for testing. We will load this data and then one hot encode the labels considering the fact we are not building the classifier for 'J' and 'Z' alphabet.
Now let's check the shape of the training and the testing data.
Output:
(21964, 28, 28, 1) (21964, 24)
(27455 28, 28, 1) (27455, 24)
In this section, we will try to visualize images for signs of some of the alphabets which have been provided to us to build the classifier for each class.
Output:
👁 ImageVisualized images of the signs corresponding to various alphabet classes.
From this step onward, we use TensorFlow to build our CNN model. The Keras framework of TensorFlow provides all the functionalities needed to define the architecture of a Convolutional Neural Network and train it on the data.
We will implement a sequential model containing the following parts:
The final output layer will have 24 units corresponding to the 24 alphabet classes.
Output:
👁 Screenshot-2025-03-24-091228When compiling the model, we provide three essential parameters:
Now we will train the model using the training data and validate it using the validation data, utilizing model.fit() function.
Output:
👁 Screenshot-2025-03-24-093139After training the model, we will visualize the training and validation accuracy as well as the loss for each epoch. This helps us analyze how well the model is performing.
Output:
👁 ImageThe training loss keeps decreasing which means the model is learning well. However, the validation loss is fluctuating a little suggesting the model might be overfitting slightly. The training accuracy is very high, close to 100% while validation accuracy also improves but is slightly lower. This means the model performs well on training data but may need fine-tuning to improve generalization.
Finally, let's evaluate the performance of the model on the test dataset using model.evaluate() function.
Output:
👁 Screenshot-2025-03-24-093904The model achieves 99% accuracy on the test set, which is impressive for a simple CNN model.
By using just a simple CNN model we are able to achieve an accuracy of 99% which is really great. This shows that this technology is certainly going to help us build some amazing applications which can be proved a really great tool for people with some special needs.