0:00
[MUSIC]
Hello, everyone and welcome back.
In this lecture, I'm going to try to bring together all these imagery concepts that
I've been teaching you into a really practical application.
This lecture is likely to be quite long.
So just sit tight with me, it should be pretty interesting.
In the last lecture, I showed you NDVI which is one practical application
of using imagery, but in this lecture I'm going to show you image classification.
Which with NDVI, we know what we're looking for and
we know an algorithm that gets us there reasonably with a couple bands.
What if we have a broader set of things we're looking for or
we want to just see what kinds of things are on the landscape?
Image classification gets us there.
0:51
Maybe we want to find all of the urban locations, or
all of the agricultural locations, or all of the water.
Water looks different everywhere, and agriculture looks different everywhere,
and urban areas look different everywhere, so finding them isn't so
much the same as using NDVI to find healthy vegetation.
We might need to figure out different properties of each of these that let us
identify them from space with remotely sensed imagery.
This is what we do with image classification.
We create signatures for areas of interest
that help us identify areas that we haven't created signatures for.
We can classify those locations we don't know something about
based upon ones we've told the GIS software about.
This will make sense in just a moment.
First, we have our Landsat image, and
it's once again in the wrong band ordering here, so let's correct that.
Go to properties, and under symbology, I'll set the bands to their correct bands.
Band 4 with Landsat is red, Band 3 is green and Band 2 is blue.
I'll click apply and that looks much better to me.
One thing for those of you who are following along to note is that you don't
necessarily have to download the huge file for this right now.
If you already downloaded the Landsat data and composited it into a file geodatabase
raster then you can use that instead of downloading this particular one here.
That's all this is, is the full 11 band raster using Landsat data.
Now, to start with, image classification comes as a toolbar in our GIS.
I right click in a blank space up on the tool bar and
click image classification in the drop down that pops up.
I'm just going to undock this.
2:37
Generally speaking,
we're working with whatever rastor is in this little drop down here.
I have a few buttons up here.
I have a training sample manager, which we'll use in a moment, drop polygon for
training sample, and then I have a classification button.
2:53
Let's do a quick unsupervised classification.
What that means is, it's going to use statistical models to try to figure out
what the classes should be, what different groupings these pixels fall into,
but it won't know what those pixels are.
It's just going to try to minimize the variation within a group and
figure out which things seem to be able to be grouped together.
I'm going to run that and it pops up and you'll note that it's a geoprocessing
tool, so we can probably find it in the tool box as well and
we can look up Iso cluster, that should be enough.
3:35
It added the Landsat scene, all bands layered,
the raster here to my input raster bands for me.
I'm going to tell it to find, five classes and
have it create a classified raster,
called Unsupervised Classification.
4:05
While it's running, let's talk about what it is just a little more.
Now, supervised versus unsupervised.
Maybe you can guess what that is,
but unsupervised means that the computer figures everything out.
We're not supervising the computer.
Whereas a supervised classification means that we tell the computer what
to look for.
We're the supervisors of that classification.
That may seem a little obvious but I just want to make it clear because we're
going to use that terminology a little bit.
Now, also while it's running, let's set up our supervised classification.
4:35
In a supervised classification, we go around the image and we draw polygons that
tell the computer, this is urban area or this is agriculture.
What it does is it's going to look at the combinations of bands in the values
in each pixel and say I know that when I get this value in red,
this value in green, this value in blue, this value in near infrared and
this value in shortwave infrared, it's agriculture.
But when use change to this other thing,
as it does over in this other training sample area, that means it's water.
Let's go do that.
5:12
To start with, let's zoom in on this lake here and we'll create a polygon here.
It says create training sample by drawing a polygon, so
we're not creating a feature class or anything.
We're just creating a polygon that we will use to tell it that this is water.
We don't need to be super precise but we need to cover different colors and
band values.
When I finish creating the polygon I can double-click to finish it and
have it stay there.
If I want to see my polygons, I can go to training sample manager and
it gives me these polygons here and generally speaking,
what I want to do is focus on one type of thing at a time.
I'm going to focus only on water until I'm done creating training samples for
water right now.
And that's not a hard and fast rule,
it's just a little easier with how ArcGIS works.
What I want to focus on while I'm creating these polygons is,
6:17
But what I want to do while I'm creating my polygons is focus on getting
variation in the types of things that represent one concept.
Water can look like this kind of murky green or
this kind of teal blue and then if I use C to pan and
drag, it can also be this deep dark blue here and then there's a hole
other like down here that's a lighter blue that we tend to think of as water.
I want to make sure I captured all of these in my training polygon here so
that I tell ArcGIS this is what water looks like in this image.
It even has this different reflectance sometimes when
the water surface is disturbed, it reflects sunlight back at the satellite.
7:03
So that's water right there and when I'm done creating training samples for
one item, I'm going to select them all by clicking on one, holding shift and
clicking the top one.
I'm going to hit this merge training samples button here and
then I'll click on class name and I'm just going to give it class name Water here.
Those are going to have a value one and I'll give it a color of blue for now.
7:38
we are just working on this lake here, but
it also seems to think that whatever is in here is the same as whatever is in here.
So we know that it missed a bit.
That lake gets merged with a whole let of other stuff that;s not water
in the mountains and it kind of mixes up with the agriculture down here.
There is lots of different Though there a lot of different types of agriculture down
here and it throws them into a bunch of different classes or
two different classes at least, this red class and this green class.
Now, remember it doesn't know what these classes are, what they mean,
it's just trying to figure out statistically
which pixels group best together and which ones should be not in the same group.
And so it's not going to be perfect but maybe there are instances where it helps
us understand the landscape a little better and we can fiddle with the settings
of the minimum number of pixels in a group and the number of
groups in order to try to get it to be a little more accurate for us.
But in the meantime let's focus on supervised classification where we can
improve the results even more.
So we've done our water already.
Now let's say we want to do five classes again.
We want to do water, we want to do bare earth, we want to do vegetation, and
then agricultural vegetation, and then urban areas like cities and towns.
Let's do bare earth next since we can do kind of wide swaths of the landscape here.
I"m just going to be pretty sloppy here and do that.
9:10
And I'll be a little quick.
And generally you want to be a little more precise than what I'm doing.
But remember, our big focus is find the different
types of places that represent bare earth here.
So, if I create a polygon here, with a little bit different color,
and try to spread out across the image, in order to
9:32
see that you're getting all the different things.
Because these are large scenes and
there are different areas with different colors just in the rock and the landscape.
So up here there's a kind of a reddish bare earth that I should
make sure to take a look at and add to my barreth sample.
10:32
But, let's also zoom in, because there are some meadows
in the Sierra Nevada that are a little lighter green, and
might not be captured in some of my other samples, here.
10:46
Let's grab this in here, has a number of different colors in this area.
And I'm even having trouble here telling whether this is,
these are small ponds or vegetation.
But I think it's vegetation.
Maybe some clear cuts that are starting to grow back in or something like that.
So let's Make sure that we capture those in some sort of polygon here.
11:50
Coming back back here and for those who are wondering how I'm panning again
I'm holding down C and then clicking and dragging to do that and
then I let go of C when I'm ready be use the tool I already have.
Now lets me quickly switch to the pan tool without constantly going to the tool bar.
Okay now Ag has a bunch of different colors associated with it.
And these are just in the visible light it probably very different once we include
all the bands that have been captured during our training areas.
I'll going to be a little sloppy.
It might be good if I could just the fields without the lines in between them.
12:34
because it even has some reddish locations, and then it has deep green, and
light green, and slightly tan.
All probably agriculture different phases.
These kind of bluish areas might be flooded fields for rice.
12:57
Purge it again, call it Ag.
Make that a deep green color.
And then let's do one last one here which is urban areas.
And I'm just going to do broad swaths of urban areas here.
13:35
Okay now before I go and run my classification,
one thing I might want to do is evaluate how well my
training samples seem to be doing even before I see how they classify it and
one way to do that Is to use the scatter plot tool here.
So let's just select two of these here and I'm going to use the show
scatter plots tool and we'll see if my computer can handle this.
And what should happen is that panes should fly out.
14:09
Let's expand it a little bit, so we could see it better and, what we're looking
at here is a cross-reference of the values and different bands.
So, band three being, that's green, versus band one being an aerosol band.
And, it's showing us this kind of cross graph between two bands at a time.
And, then it's showing us the values of each of those bands on the graph.
So, where bend 11, say, is a intensity of 25,000.
Band 1 is at an intensity of about 15,000 here in same cases.
And so it's kind off shows all the pixels in our training sample and
what we want here is for these not to be coincident.
These blobs shouldn't really align with each other because we're actually saying
their different things.
So they should have different values in these graphs.
15:01
So if we have a lot of alignment like I do now, especially in these down here,
it might be that we're doing not so great of a job, or that our class
definitions promote overlap and that they're going to be hard to separate out.
15:24
graphs here as I do now, then it might be a signal that I need to spend a little
more time refining my training samples and making sure that I get tighter areas so
I am little less quick and sloppy as I've been doing in this demo, and
a little more careful in my edges in what I'm selecting.
15:59
Okay, now another way to evaluate it,
though, is to actually run the classification.
And let's hide this for now and so to run it let's go to classification and
then maximum likelihood classification.
But first I need to save my signatures out.
So, what we're going to do is click the create a signature file button.
And give it a file name and it's going to save it as a signature file.
So landsat scene all bands demo, save and it writes out my signature file for me.
And now this might take a while and
now I can do the maximum likelihood classification on the data.
So again, when I do it without selecting the drop-down, it adds it as
the input raster bands, and then I go find the signature file I just saved out.
17:05
Okay and then it asks me where I want to put my output raster,
my output classified raster, so I'm going to call it Landsat classified v1.
And this v1 is important for me at least, because I know that my first
classification isn't going to be my best one.
This is a process of refinement.
You might do five or ten of these classifications and
each time you're going to reference that scatter plot and see if you can get even
better areas of interest or even better polygons that are your training samples.
And then you're going to run the classification again.
See how it performs visually and then re-assess and
add more training polygons and remove training polygons.
So V1 helps me keep track of how I am doing here.
And in fact it would be good if I had named my
signature file the same way, and added V1.
So that I would know which raster came from which signature file, so
that, if I start making it worse, all of a sudden,
I can go back to the raster that was best, and the signature file that was best.
So, It's good to keep track of these things.
I'm also going to look at the output confidence raster,
so I'm going to have it save out, a confidence raster.
I'm going to call it confidence_v1 to match.
And what it tells me is that this is a raster that shows the certainty of
the classification in 14 levels of confidence with the lowest values
being the highest reliability.
And we'll see how to use that in just a moment.
So I'll click okay to run it and this also might take awhile.
So we can sit back and wait for a little bit.
18:44
Okay and when it's done I get two rasters back,
my confidence raster and my classification raster here.
And initially, occasionally it chooses colors that look a little like the ones
that you chose, but what's actually going on is, it's the values here.
So the value in the classification raster matches the value that we put in here.
So what I like to do to make it more intuitive Is set the colors on
my raster to approximately match what I have in my classification window here.
So then Behr is going to be kind of orangish-yellow and non-intensive
will be a light green and ag will be a dark green of some sort.
19:38
So it looks relatively good to me.
I'm sure there's a lot of improvement but this urban area here was captured.
The ag is mostly limited to the ag areas.
I have a little bit of ag on this fringe here which
isn't actually agriculture here.
That's very likely just a forested area.
So that could be me, over sampling my Ag, or
under sampling my forested areas where I need to provide a few more polygons for
my vegetation non-intensive class, that actually captured this area here.
And, then let's take a look at the watered areas.
So, it captured the lakes pretty well.
It didn't really over-predict the lakes, either.
20:27
And then it looks like maybe I should have done either a snow area or
captured this as a bare earth and snow class because it seems to think that
the snowcap there is urban.
So we can see some areas to correct, but
that we did an okay job of automatically having it tell us what everything is here.
And then what we can maybe do with this is maybe convert to polygons for analysis, or
use this in a further raster processing chain, knowing that each pixel value is
now the type of something rather than just some raw imagery values.
21:03
Now, one more thick tool we can use for
refinement on future rounds is this confidence raster.
So where the values are read here.
Arc GIS is saying you know, I'm not really positive I got this right, and
so we might go use that as input to say well, maybe we need some training
samples that cover these particular areas a little more.
21:42
Now one last thing I've been talking about providing new training samples.
But then, if I want to work on one of these classes,
I should probably split it back out.
So, say I want to provide new urban training samples.
So, I'll click on it, and I'll split it back out.
And it's going to call them urban 1, 2, 3, 4, 5, and
6 and it gives me those polygons all back as individual polygons.
And then what I will usually do is go add new urban polygons here.
Or you can delete the individual ones,
say you think that one of these was a little overly broad.
So I maybe urban one was a little too broad so
I can click on that and then delete selected training samples.
And now I don't have that one that was maybe causing some
mispredictions elsewhere, because it was too big.
I can go create new and refined training samples that are a little more specific to
an area, or something like that.
And then, when I'm done, I can merge them back together,
by selecting them and using the Merge button again.
22:48
And if I want to I can save these out as a shapefile, just so
I have these polygons somewhere else.
For classification, you need to save out the training samples using this button but
you can also save these polygons out for you somewhere else too.
23:08
Okay so, that's it for this lecture.
If I was going to continue on, I would keep refining this, as I said,
and start removing training areas that were causing mispredictions.
And adding new training areas to refine the predictions, based upon my confidence
raster, based upon my scatter plots, to try to make sure that scatter plots don't
overlap too much, and then based upon my actual classification rasters.
And then, if I was done I could start taking my classified raster and
using it in other pipelines.
And because landsat trys to be consistent I could use a lot of time these same
classification on future images from landsat or past images from landsat.
So I could automate it across the whole stack of landsat images and say okay,
this is what Urban looks like in this area.
If I want to look at different paths and
rows of landsat basically different areas, I should
24:00
make sure that I have a classification that covers those areas, as well.
I shouldn't apply a classification from this area to a brand new
location on the Earth.
So, there's a limit to that reusability, but if you get broad spatial scope in your
classification, you can then use it across many different landsat scenes usually,
potentially with some additional refinement.
24:33
Or a set of training samples that had different class names with
different meanings to us and we could polygons that hold arc GIS.
What values in all 11 bands of landsat match those particular things
like water or bare earth.
And then, we ran a classification using those training samples in the Landsat
image to have ArcGIS predict what all of the pixels are on the landscape.
25:01
I think this is a really cool and a really powerful functionality in GIS.
There's a whole lot more here in terms of evaluating success and
in terms of how you apply this.
On a broader scale that we won't be covering in this course.
But you will get some practice in this week's assignment,
so I hope that helps you at least pick up the basics of this,
so you can continue to use it in your own work.
Okay see you next time.