in this series we're going to introduce
deep learning
at least from the perspective of solving
practical engineering problems
we're not going to go into too much
depth into neural network architectures
or
the algorithms that make deep learning
work there's
already tons of great resources that
describe all of that fantastically
and i've left links to many of them in
the description of this video
instead the goal of this series is to
provide an introduction to the range of
engineering problems that deep learning
is well suited for
and why it can solve these problems when
traditional methods fall short
either by being inefficient inaccurate
or impractical
i think it'll be pretty interesting so i
hope you stick around for it
i'm brian and welcome to a matlab tech
talk
at a really high level deep learning is
a machine learning technique that
teaches computers to learn
by example specifically we're teaching a
computer how to perform
some classification task by exposing it
to known scenarios and having it
automatically adjust its model
depending on whether it produced the
right response or not
and once we have a sufficiently trained
model using enough labeled data
we could input data that we haven't
classified yet
and the model will apply the most
probable label to it
now deep learning often uses deep neural
networks
to model the complex relationship
between an input
which is some kind of data and an output
the classification or labeling of that
data
and unlike other mathematical models
that can be designed and tuned manually
deep neural networks really can't be
they are too complex and have too many
free parameters
for example google net which is trained
to recognize
objects and images has about 7 million
parameters
to tune networks like these requires
learning algorithms these are
optimization techniques that tweak
and adjust the parameters over time
and having a trained model that can
classify data is beneficial far beyond
being able to label
pictures of cats or objects on a desk
for example we may want to find and
label specific objects in an
image which we can use for object
tracking and localization
we might want to visually inspect
hardware for defects like material
damage
or we may want to diagnose health issues
from an x-ray or mri
image but images themselves are just
one data type where complex patterns
exist
we can apply these learning techniques
to audio signals for
speech recognition or song
identification
or determining which genre the song is
from
and there are also other time series
signals
with complex patterns like we find in
predictive maintenance applications
or biomedical industries but in each of
these cases
hopefully you can see how valuable it
can be to be able to extract
classify and label complex patterns
within the data
automatically especially if it can be
done faster and more accurately
than a human so that's the reason to
build a classification model
but what is the motivation for designing
a network with
millions of parameters that requires
deep learning
to tune well to answer that i'll start
by posing this question to you
how would you approach writing code
that can distinguish between two
different complex patterns
in data and even though the answer is
application dependent
as we'll see it's not always easy to do
using rule-based approaches where a
human has to craft and curate the logic
themselves
and so we turn to techniques like deep
learning
which simply put is a way to develop
models that produce
useful input output relationships
specifically models
that can find classify and label complex
patterns
in data it does this by identifying
small features in the data
which can then be combined into larger
features and then
into recognizable patterns and i think
understanding this feature recognition
concept will go a long way to helping
you decide
when it makes sense to use deep learning
to build your model
versus some other more traditional
approach
so with that in mind let's start by
getting a better understanding of what a
feature is
in the first place and we'll use sensor
data
as an example engineers use
sensors to measure the environment and
we want to use the measured data to
perform some
future action we want to make some
informed decision based on what the
sensors observe
therefore we often need a function or
algorithm
that takes in sensor data and returns
something
useful and we have tons of methods that
we can use to find patterns in sensor
data
for two simple examples we might just
run a linear regression to determine how
the data is trending over time
or we may look for when the signal drops
below some threshold
to indicate that whatever the sensor was
observing is no longer in view
but here's the thing i want to point out
the complexity of this algorithm
and how difficult it is to develop
scales
with the complexity of the patterns that
you're trying to find and
label as well as how those patterns vary
from one observation
to another let me give you a rather
silly example to show this
let's say we're designing a watch that
has an accelerometer as one of its
sensors
and all we want to know is how fast is
the watch accelerating
in this case the pattern we're looking
for is essentially the true acceleration
and the function that generates it might
just be a low-pass filter to remove any
high-frequency noise
so in this case it's a pretty simple
function and one that could
easily be designed with traditional
methods and by traditional methods i'm
generally referring to any method that
doesn't rely on some form of machine
learning but now let's look at a case
where the pattern we're looking for
is more abstract perhaps we want to use
the accelerometer to determine when the
user high-fives someone
in this case the input into our function
is still acceleration
the exact same data as before but the
output is a flag that is set
when a high five pattern is detected the
function that does
this classification is decidedly more
complex than a simple low-pass filter
because the pattern it's looking for is
more complex
now here is one example of how we might
use a rule-based approach
to design this function ahead of time we
could record the acceleration of a
person performing a high five
we can label this particular
acceleration profile as
a high five since we purposefully set up
the test to produce this data
now we can use this labeled data to come
up with a representative profile
that we could pattern match against the
continuous stream of acceleration
measurements
from the sensor our function could look
at the standard deviation between the
two signals
which is hovering around point four for
non-high-five motions
and we could claim that there was a high
five when the deviation drops below some
threshold however we can make this
problem more difficult
by realizing that every high five is not
the same
but that the acceleration pattern varies
from instance to instance
some people might move their hand faster
or slower or
pause right before the big slap or just
high five in a strange way
now if we want to use our standard
deviation approach we have to do that
for each profile in the set
and if the deviation between any of
these profiles and the sensed
acceleration drops below some threshold
we claim a high five took place but
that wouldn't cover the cases for the
high fives that fall outside of these
ranges
and that we didn't collect data for so
instead of having
a database of millions of profiles that
we need to check
you know one for every possible type of
high five we might be a little smarter
about
it and realize that instead of looking
at the pattern as a whole
which can have wild variations maybe we
can find a set of features
that they all have in common and just
check for those
by features i mean smaller portions of
the pattern that combine to make up the
entire profile
for example we may reason that a high
five profile consists of a slow
acceleration at the beginning
corresponding to a person raising their
hand then another slow acceleration as
they move their hand backward
followed by a quick acceleration as
their hand moves forward and makes
contact with
another person and even though every hi5
profile is different
quantitatively from start to finish each
of these features might exist in some
form in every profile therefore we may
be able to claim that
any combination of a slow slow fast
acceleration
is a high five even if we observe a new
high five that we didn't explicitly
collect data for
in this way we're breaking the larger
pattern down
into its base components its features
however remember that even if we have
access to
lots of labeled data writing rule-based
logic
that understands the relevant features
of a pattern can be
time-consuming inefficient and possibly
impossible for humans to do directly
because it requires us to have a lot of
intimate knowledge about the pattern
and every variation of that pattern that
we're trying to find
to put a more concrete example to this
statement
let's look at a camera which can
generate images that have patterns that
are extremely complex
much more complex than the acceleration
profile that represents a high five
fundamentally the data in an image
represents the color
intensity and direction of light that
reaches the detector
but this usually isn't what we're
interested in
we're interested in the complex patterns
embedded within this data
and if we thought picking out relevant
features of high five was difficult
imagine trying to come up with the
features that allow you to optically
identify a good hex nut
versus a defective one even if you had
access to
thousands of images of both it would be
nearly impossible to come up with an
algorithm
that would distinguish one from the
other at least it would be without
deep learning i already mentioned how
deep learning
learns the relevant features and
combines those features to classify the
larger patterns
directly from a bunch of labeled input
data but the really neat thing about
deep learning
at least to me is that the features that
the layers in a deep neural network
converge on and use
for pattern recognition often aren't the
features that are obvious
to a human even though it's helpful to
think about these features as things
that
people can understand like lines and
little loops
and slow and fast accelerations there's
no guarantee that the network will
actually converge
on something this recognizable
to show you what i mean let's run the
matlab example called
create simple deep learning network for
classification that ships with
the deep learning toolbox this example
trains a neural network to recognize
handwritten numbers and this example
trains the network using 750 labeled
images
for each of the 10 numbers it then uses
250 images
for each number to verify the accuracy
of the network
which we can see here is about 99
accurate
so not too bad
the network we've trained has an input
and output layer
as well as a lot of hidden layers in
between
and the details of this network and the
layers aren't
too important i think for this video
it's enough to understand that there are
three
convolutional layers here where each one
is looking for particular features in
the input image
and to get a sense of what the first
convolutional layer is looking for
we can visualize the filter weights for
the second layer
and there's eight filters in this layer
you'll notice that some of the filters
kind of look like little tiny
line segments and loops but for the most
part they
mostly look like various little blobs so
somehow this network is saying
that if these blobby features show up
strongly in certain locations in the
image
it can use them to determine what the
number is
and these blobs probably aren't
something that a human would come up
with
but they do represent the same idea
of small recognizable features
now there isn't a whole lot of
interesting detail in these low
resolution
black and white images but we can do the
same thing with a network that has been
trained
to recognize flowers within larger color
images
to see this let's look at the matlab
example image category classification
using deep learning
the input image is a daisy and if you
apply the trained classifier on this
test image
it does in fact return the label daisy
and if we scroll back up what we're
seeing here is a visualization
of the first convolutional layer weights
these are the primitive features that
help this network
distinguish between a daisy and
something else
again it seems likely that these aren't
the features that a human would come up
with if they were trying to define
the features of a flower at least i
don't think i
would but this is why deep learning is
so powerful for
certain engineering problems
specifically problems that involve
finding patterns in an image where the
defining features are difficult
to describe of course we mentioned that
deep learning isn't only useful for
labeling objects and images
there are many engineering applications
where you could use these techniques
to find and label patterns in data
whether that data is in the form of an
image or an audio file or
some other signal in each of the next
few videos we'll look
at specific engineering topics in detail
and discuss
how deep learning can be applied to
solve that particular problem
in the process we'll talk about the
design workflow for deep
learning systems and where difficulties
may arise throughout this workflow
for the engineering problems that you
might come across so if you don't want
to miss
that or any other tech talk video don't
forget to subscribe to this channel
also you can check out my channel
control system lectures if you're
interested in other control theory
topics as well
thanks for watching and i'll see you
next time