hello everyone in this video tutorial
we are going to look into one of the interesting application of
pattern recognition neural network
so what we are going to do is to create a neural network
to which we can feed a hand written number
images and then the network we are created
which number it is you will see that
it is easily attainable by using the concept
that we have already learned
so in this case i am using the data set
which you can easily find by
typing in google
the procedure which we are going to follow is
first we are creating auto encoder
for compressing the images which is 28 * 28 pixel in size
lower dimension size so we are using
2 autoencoder so autoencoder1
will compress the image from 28 * 28 that is 784
inputs to 400 inputs and then
then we are going to use that 400 to be feed in
next autoencoder which will further compressed in 200
inputs
and then we can make the use of pattern recognition neural network
that is pattern net and train the network
in a supervised manner after that
we will see the conclusion matrix to check the accuracy o the network created
one of the interesting and more advance application
that can be used is the data set is available
is instead of inputting the
hand written digit we can input the hand gesture
and as a label we can create
approximate meaning of that gesture
so by making the use of time series neural network
pattern recognition neural network and the autoencoder
we can create a network
that can help us understanding sign language
so i have already written the code
let's look into the code by line by line
so first i will load the image data set
using this command
then the data set structure
will be importing the work space which will contain the training
test images separately
so let's run the section
so after running the section we see that data set structure
will be imported in the work space click on it
as you can see that data set contain
trained image test images and the mapping
so trained images will contain the
images that will be using for training
and there are 240000 images
available and for each images
that is each column will represent an image so
each column has a number of rows of 784 that will
representing 28 * 28 pixel images
and the corresponding level is mention in the level
so the 1st image is image create
similarly the 2nd image that is 2nd number is no. 9 and so on
similar is the case for test field also
 
labels we have actually tells us
which number is this
videos that we required
matrix as the target so this is what
we are doing in next lines
training data set that we have
we are making a target matrix
that is hot encoded matrix
so this the simple for loop
and the if statement
after that we are doing the same thing
converting that into double data type
and then hot encoding the labels it have
after that we are plotting the 1st 20 images
using simple for loop and the image show command
note that we have used the reshaped
in the input image matrix
each column represent an image
28 * 28  pixels so that we can finally use the
image show on that
after that we are using default random number generator
this is done because finally what we will do
is combined all the neural networks that we have created
2 auto encoders and 1 pattern net
that we will be creating will be stacked or combined together
so it make sense
same random number generation in each neural network
after that we have first auto encoder
so this is trained
in similar way like discussed in previous video
so give the hidden size of 400
 
and use then train auto encoder
hidden size and the other parameters
which was the default parameter supplied by the matlab
and we can use the view auto encoder
after that we are getting the features
by using the encode command
this will give the compress form of the
so we are using 400 neurons
basically feature 1 represent the same
images but in 400 neurons
instead of 784 neurons
after that we are plotting the new images
auto encoder to get a comparison
between the actual image and reshape image
or the resized image
then we use the 2nd auto encoder then we will provide
hidden size of 100 same command
train auto encoder
we train that network
in this command we are looking into
how are input image features will look like
once they are compressed by 2nd auto encoder
after that we are either creating a soft mac layer
or max layer or pattern recognition neural network
so as you may recall in case of pattern net
we have soft mac layer as a output
so we can either supplied
and train it in a supervised manner
or we can also provide the hidden layer
so basically if we provide a hidden layer
if we use soft net time take for the hole
training will be comparatively less
we will reduce it a little it
but to increase the accuracy time will be increasing
we will use the pattern net
so we supply the training function
hidden layer size we use will be 10
in a usual manner we will create and train it
we are using the performance function of cross entropy
so what we are done till now is created 2 encoder
for compressing the image high number of inputs to
a small number of inputs and then
into a pattern net
and training in a supervised manner
after this use a stack command to combined these neural network
that we have created
and then we get the output
and then plot the conclusion matrix
test ratio as 0
for testing our network
data set
so just use that data set
corresponding level
to get the output as y
plot the conclusion matrix
which are hot encoded in the output
if the accuracy of the network
we can retrain the hole network
 
and then we use the simple train command
with the input and the target one
usually do the supervised learning and then
so let's run this code
 
say's this code contain 4 training
so it will take little bit time
so after all the training
this is what our neural network will look like
so in this we have the 1st encoder
and 2nd encoder and this is the pattern net
 
we are supplying the 784 inputs
get reduce to 400
encoder and 100 in 2nd encoder
and finally to the output
which are basically the labels in numbers
these are the same plot in the pattern recognition neural network
so let's see the different plot that we have generated
these are the actual images that we have available
from our data set
so this are the first 20 image data set
these represent the images
that i have compressed by using auto encoder 1
so as you can see that these are little bit 1
so figure 3 basically how are the features
of our input images are stored in
layer of 2nd auto encoder
then this is the image of 1st auto encoder
this is the image of 2nd auto encoder
neurons and this is the image of
pattern recognition neural network
so without training the step
accuracy which we obtain
is 37.8% which is very low
so what we will do is
retrain the network that we have created
as we can see that accuracy
which is very good as compare
so this is how we created
classifying the input images
you may be thinking that why we have used auto encoder
why not just simply supply the
into the pattern recognition neural network
so if we would have supplied 784 neural network
let's say 10000 samples
simulation such is very very high
or your computer may not be able to perform such a high
calculation
right after clicking on run option your software may
stop or may not respond
so that's why we are using the auto encoder
and then supplying the
to the pattern recognition neural network
so that's it every one this is it for this video
hope you like it and
please like subscribe and share and thanks for watching
