Growing up building things using Lego has always been fun, so is building machine learning algorithm from scratch. Usually, machine learning algorithms are sufficient for various applications but when it comes to huge data size and classifying images we need more powerful machine learning algorithms hence deep learning comes into picture. Building an algorithm is always beneficial but time consuming so why not use existing algorithms and model for similar type of data. The process of using the stored knowledge which is gained while solving one problem and applying it to a different but similar problem is called Transfer Learning. Let’s get a better picture of how we can use some really powerful convolutional neural network on our own data set.

Import dependencies

As usual before starting any machine learning problem we need to import the dependencies and the libraries — just laying the foundation to build our entire model on.

import tensorflow as tf
	import tensorflow_datasets as tfds
	import matplotlib.pyplot as plt
	import numpy as np
	import platform
	import datetime
	import os
	import math
	import random

	print('Python version:', platform.python_version())
	print('Tensorflow version:', tf.__version__)
	print('Keras version:', tf.keras.__version__)

Import data

The data we will be using are computer generated images of hands showing the different pose for rock paper scissors. The “rock paper scissors” dataset is available directly from the Tensorflow package. In the cells that follow, we’ll get the data, plot a few examples, and also do some pre-processing.

import tensorflow_datasets as tfds
	(ds_train, ds_test), ds_info = tfds.load(
	    'rock_paper_scissors',
	    split=['train', 'test'],
	    shuffle_files=True,
	    with_info=True
	)

To know how our data set looks like using the following cell.

fig = tfds.show_examples(ds_info, ds_train)
	classes = np.array(['rock', 'paper', 'scissors'])

#image-classification #data-science #deep-learning #machine-learning

Transfer Learning-Rock Paper Scissors Classifier
4.00 GEEK