Understanding Sign Language Using Machine Learning
Today i am going to show you, how you can use machine learning and computer vision to understand sign language.
There is no source code to download, each code block is present in the article itself.
Let’s start coding:
# Import libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from pathlib import Path
import os.path
from sklearn.model_selection import train_test_split
from tensorflow.keras.preprocessing.image import ImageDataGenerator
import tensorflow as tf
from sklearn.metrics import accuracy_score, f1_score
#
First of all we start by importing certain libraries, which help us make our code work. We are going to use numpy for data manipulation and pandas for analysis, we will use matplotlib for data visualisation and path and os.path, this is for managing file paths. After that we are going to import train_test_split from sklearn library, we are going to use this for splitting data into training and testing sets.
We also import ImageDataGenerator from tensroflow.keras.preprocessing.image, we are going to use this for data augmentation. Data augmentation is a technique for creating a new training samples from exisitng one. For building our deep learning model we are going to use tensorflow. And at the end we import some metrics from sklearn, for evaluating our model.
from google.colab import drive
drive.mount('/content/gdrive')
To get our dataset working we need to mount our drive on google colab.
os.environ['KAGGLE_CONFIG_DIR'] = "/content/gdrive/My Drive/Kaggle"
Here we set an environment variable called KAGGLE_CONFIG_DIR variable, this is going to tell our computer where it can find the kaggle.json. In our case the file is located in our gdrive. The os module helps it access it.
!kaggle datasets download -d grassknoted/asl-alphabet
Using this code we download our dataset.
#unzipping the zip files and deleting the zip files
!unzip \*.zip && rm *.zip
Here we first unzip all of our files. After that we also use rm command to delete all of the .zip files that we just unzipped.