Machine Learning Tech Talk
Machine Learning Tech Talk
About Us ............................................................................................................................................ 23
This manual contains step-by-step instructions on how to perform certain processes. You should be
aware that each exercise provides a single path through the application's tools. In most cases, there are
various ways to maximize tool usage, depending on the individual project.
This exercise manual is provided to the student, along with all images used by the instructor. Copies of
the presentation slides are available upon request. This provides the capability for recreating the
processes performed in class at a later date, as well as the key points on any theory involved.
Exercise Conventions
Section Title Page States the objective of the exercises and lists the application
tools to be used within the various tasks.
Exercise Tasks Each exercise is split into a set of tasks. After the course,
these tasks will help you locate within the manual where you
performed a certain set of steps.
Questions The instructor may quiz and/or review with you, following each
exercise.
Notational Conventions
Bold Text Any text that is bold indicates buttons, tabs, group names,
dialogs, and field names that are visible in the workspace
Monospace Text Any text that is monospace indicates a file name, text entered
by you, or code such as HTML, XML, JavaScript.
Graphics To help you locate buttons and objects used in the exercises,
the button icons will be next to the button name in the text.
Diagrams Optional diagrams can show you how to use some of the
application's tools.
This is a tip, describing a different way you can enter information into the
software or giving relevant information about the software.
1
This is a reference book, listing an external location (website, Help
document) where you can read or see more information.
2
Section 1: Classification using
Machine Learning Operators
Section Objective
Learn how to build spatial models that use machine learning operators to do raster and feature
classification.
Tools Used
2D Viewer
The main “map display” panel used in ERDAS IMAGINE to display and interact with imagery, vectors,
point clouds, annotation, etc.
3
Exercise 1: Feature Classification
In this task, we will get familiar with the data we will use for the exercise.
4. You may use Fit to Screen, Zoom and Roam through the image to get a sense of the image contents.
5. Click File > Open > Vector Layer. Browse to the data directory.
6. Select unclassified_land_cover_segments.shp. Click OK.
This shape file is generated from the land cover image by performing FLS segmentation on it.
7. Click File > New > 2D View to start a new 2D viewer.
8. Click File > Open > Raster Layer. Browse to the data directory.
9. Select land_cover.img. Click OK.
12. Click on the Style tab of the ribbon interface, then click on Unique Value button from the
Categorization group.
13. Select Name attribute name from the Unique Value dialog to specify the attribute to be used for
generating symbology.
This data is a subset of the shapefile generated by FLS segementation. The polygons in this
shapefile have their land cover type assigned manually. We will use this subset shape file as our
training data to classify the shapefile generated by the FLS segmentation.
4
Exercise 1: Feature Classification
We have to decide which attributes of the training data to use to train the machine learning algorithm that
will be used for the classification.
Since the polygons in the shapefile are derived from the raster data based on radiometric information, we
will use radiometric information (mean and standard deviation) of the raster image contained within each
polygon as the training attribute.
Let’s build a spatial model that will generate a feature that will have these information as its attribute.
1. Click File > Close > Close All Views to close all viewers.
2. Click File > New > Spatial Model Editor to open a new Spatial Model Editor window.
3. In the Operators panel, scroll down to the Input category and expand it. Select the Features Input
operator and drag it onto the left side of the Editor.
4. Drag Raster Input operator from the Input category in the Operators panel into the Editor.
5. Drag Raster Statistics Per Features from the Zonal category in the Operators panel into the Editor.
6. Drag Features Output operator from the Output category in the Operators panel into the Editor.
7. Click on the Raster Statistics Per Features operator and in the Properties panel check on the
Show column for ComputeMean and ComputeStdDev port.
5
Exercise 1: Feature Classification
Mean is computed by default (so is set to true), while standard deviation is not computed by default.
Double click on the ComputeStdDev port and check the ComputeStdDev on.
9. Click File > Save > Spatial Model. Name the model Data_prep.gmdx and click OK.
10. In the Spatial Modeler tab, click the Run button.
The model runs, creating a shapefile output that has the computed metrics as its attributes
11. Click File > Close > Close All Views to close all viewers.
12. Click File > New > 2D View to start a new 2D viewer.
13. Click File > Open > Vector Layer. Browse to the data directory.
14. Select land_cover_training_data_w_attributes.shp. Click OK.
15. Right click on the shapefile name in the Contents folder and select Display Attribute Table.
Let’s style the shapefile display by its Name attribute.
6
Exercise 1: Feature Classification
We have now created a shape file that has mean and standard deviation (texture) values for the
polygons representing the various land cover types. Note that the Mean and StdDev values are
generated per band.
The data to be classified also needs to have the same attributes that were used for training the algorithm.
So we will generate Per band Mean and StdDev values for the segments of the data to be classified.
1. Click File > Close > Close All Views to close all viewers.
2. Click File > New > Spatial Model Editor to open a new Spatial Model Editor window.
3. Click the File > Open > Open Spatial Model. The Select Spatial Model dialog opens.
4. Navigate to the data directory and click on Data_prep.gmdx to highlight it in the File Chooser.
5. Click OK and the spatial model opens in the Spatial Model Editor.
6. Replace the input shape file by double clicking on the Filename port of the Features Input operator.
7. Browse to the data directory. Select unclassified_land_cover_segments.shp. Click OK.
8. Replace the output shape file by double clicking on the Filename port of the Features Output
operator.
Dismiss the Attention dialog by clicking No since we do not want to overwrite the updated training
data.
7
Exercise 1: Feature Classification
11. Click File > Close > Close All Views to close all viewers.
12. Click File > New > 2D View to start a new 2D viewer.
13. Click File > Open > Vector Layer. Browse to the data directory.
14. Select unclassified_land_cover_segments_w_attributes.shp. Click OK.
15. Right click on the shapefile name in the Contents folder and select Display Attribute Table.
8
Exercise 1: Feature Classification
For this exercise we will use the random forest algorithm to classify the features into the various land
cover types. Prior to classification, the algorithm needs to be initialized with the training data. Initialization
is the process of creating a machine intellect by training the machine learning algorithm.
1. Click File > Close > Close All Views to close all viewers.
2. Click File > New > Spatial Model Editor to open a new Spatial Model Editor window.
3. In the Operators panel, scroll down to the Input category and expand it. Select the Features Input
operator and drag it onto the left side of the Editor.
4. Drag Select Attributes operator from the Feature Schema category in the Operators panel into the
Editor.
5. Drag Initialize Random Forest operator from the Classification category in the Operators panel
into the Editor.
6. Drag Machine Intellect Output operator from the Output category in the Operators panel into the
Editor.
7. Connect the various operators in the Editor as shown below.
9
Exercise 1: Feature Classification
The training data has two non-geometry attributes. We will use Select Attributes operator to select
the attributes that will be used for the training.
10. Double Click on the AttributeNames port of the Select Attributes operator.
11. In the Select Attributes Dialog, select the attributes to be used for training as shown in the figure
below. Click OK.
10
Exercise 1: Feature Classification
12. Double Click on the ClassAttributeName port of the Initialize Random Forest operator.
We will use the Name attribute of the training data as the Class name of the various land cover types.
13. In the Input Text dialog, enter “Name” as the value for ClassAttributeName. Click OK
14. Double-click the FilenameIn port of the Machine Intellect Output operator.
15. Browse to the data directory. Specify rf_land_cover.miz as the output File Name. Click OK
11
Exercise 1: Feature Classification
16. Click File > Save > Spatial Model. Name the model init_rf.gmdx and click OK.
17. In the Spatial Modeler tab, click the Run button.
The model runs, creating the machine intellect that will be used in the next step for classification.
In this task, we will create a spatial model that uses the machine intellect created in the step above to
perform feature classification.
1. Click File > Close > Close All Views to close all viewers.
2. Click File > New > Spatial Model Editor to open a new Spatial Model Editor window.
3. In the Operators panel, scroll down to the Input category and expand it. Select the Features Input
operator and drag it onto the left side of the Editor.
4. Drag Machine Intellect Input operator from the Input category in the Operators panel into the
Editor.
5. Drag Classify Using Machine Learning operator from the Classification category in the Operators
panel into the Editor.
6. Drag Features Output operator from the Output category in the Operators panel into the Editor.
7. Connect the various operators in the Editor as shown below.
12
Exercise 1: Feature Classification
14. Click File > Save > Spatial Model. Name the model rf_land_cover_classifier.gmdx and click
OK.
15. In the Spatial Modeler tab, click the Run button.
13
Exercise 1: Feature Classification
In this
1. Click File > Close > Close All Views to close all viewers.
2. Click File > New > 2D View to start a new 2D viewer.
3. Click File > Open > Raster Layer. Browse to the data directory.
4. Select land_cover.img. Click OK.
5. Click File > Open > Vector Layer. Browse to the data directory.
6. Select land_cover_training_data_w_attributes.shp. Click OK.
7. Click File > New > 2D View to start a new 2D viewer.
8. Click File > Open > Raster Layer. Browse to the data directory.
9. Select land_cover.img. Click OK.
10. Click File > Open > Vector Layer. Browse to the data directory.
11. Select classified_segments.shp. Click OK.
12. On the Home tab, Extent group, click the Fit to Frame button to see the full extent od the displayed
data. Do this for both views.
14
Exercise 1: Feature Classification
You can make a visual analysis of the training data and the classified segments by displaying each class
on both views.
15
Exercise 2: Raster Classification
In this task, we will get familiar with the data we will use for the exercise.
4. You may use Fit to Screen, Zoom and Pan tools to get a sense of the image contents.
5. This is the image we will attempt to classify in this exercise
6. Click File > Open > Vector Layer. Browse to the data directory.
7. Select land_cover_training_points.shp. Click OK.
8. Right click on the shapefile name in the Contents folder and select Display Attribute Table.
Let’s style the shapefile display by its Name attribute.
9. Click on the Style tab of the ribbon interface, then click on Unique Value button from the
Categorization group.
10. Select Name attribute name from the Unique Value dialog to specify the attribute to be used for
generating symbology.
We will use this shape file as our training data to classify the image.
16
Exercise 2: Raster Classification
We have to decide which attributes of the training data to use to train the machine learning algorithm that
will be used for the classification.
Since we are classifying the image, the DN values of the pixels will beused as the basis for classification.
Let’s first extract the DN value of the images at the training points and add generate a feature that has the
DN values as an attribute. as an attribute to the shape file. We will do that by building a spatial model.
11. Click File > Close > Close All Views to close all viewers.
12. Click File > New > Spatial Model Editor to open a new Spatial Model Editor window.
13. In the Operators panel, scroll down to the Input category and expand it. Select the Features Input
operator and drag it onto the left side of the Editor.
14. Drag Raster Input operator from the Input category in the Operators panel into the Editor.
15. Drag Raster Statistics Per Features from the Zonal category in the Operators panel into the Editor.
16. Drag Features Output operator from the Output category in the Operators panel into the Editor.
17
Exercise 2: Raster Classification
17. Click on the Raster Statistics Per Features operator and in the Properties panel check on the Show
column for ComputeMean and MeanAttributeBaseName port.
We will use the Mean as a proxy for the DN value (Since the mean of a single value is itself). We will
change the name of the attribute to be created in the output feature stream to something that better
reflects what we are creating.
Double click on the MeanAttributeBaseName port and change the value to DNV_B (DN Value). The
output stream will have attributes DNV_B1,…, DNV_B4 since the image has 4 bands.
19. Click File > Save > Spatial Model. Name the model Data_prep2.gmdx and click OK.
20. In the Spatial Modeler tab, click the Run button.
The model runs, creating a shapefile output that has the computed metrics as its attributes
21. Click File > Close > Close Spatial Model Editor to close the Spatial Model Editor window .
22. Click File > New > 2D View to start a new 2D viewer.
23. Click File > Open > Vector Layer. Browse to the data directory.
24. Select land_cover_training_points_w_attributes.shp. Click OK.
25. Right click on the shapefile name in the Contents folder and select Display Attribute Table.
Let’s style the shapefile display by its Name attribute.
18
Exercise 2: Raster Classification
We have now created a shape file that has the raster DN values at the points locations as an its
attribute.
For this exercise we will use the random forest algorithm to classify the features into the various land
cover types. Prior to classification, the algorithm needs to be initialized with the training data. Initialization
is the process of creating a machine intellect by training the machine learning algorithm.
1. Click File > Close > Close 2D View to close the 2D viewer.
2. Click File > New > Spatial Model Editor to open a new Spatial Model Editor window.
3. In the Operators panel, scroll down to the Input category and expand it. Select the Features Input
operator and drag it onto the left side of the Editor.
4. Drag Select Attributes operator from the Feature Schema category in the Operators panel into the
Editor.
5. Drag Initialize Random Forest operator from the Classification category in the Operators panel
into the Editor.
19
Exercise 2: Raster Classification
6. Drag Machine Intellect Output operator from the Output category in the Operators panel into the
Editor.
Connect the various operators in the Editor as shown below.
The training data has two non-geometry attributes. We will use Select Attributes operator to select
the attributes that will be used for the training.
20
Exercise 2: Raster Classification
Double Click on the ClassAttributeName port of the Initialize Random Forest operator.
We will use the Name attribute of the training data as the Class name of the various land cover types.
In the Input Text dialog, enter “Name” as the value for ClassAttributeName. Click OK
Double-click the FilenameIn port of the Machine Intellect Output operator.
Browse to the data directory. Specify rf_land_cover.miz as the output File Name. Click OK
21
Exercise 2: Raster Classification
Click File > Save > Spatial Model. Name the model init_rf.gmdx and click OK.
In the Spatial Modeler tab, click the Run button.
The model runs, creating the machine intellect that will be used in the next step for classification.
22
About Us
Hexagon Geospatial helps you make sense of the dynamically changing world. We enable you to
envision, experience and communicate geographic information. Our technology provides you the form to
design, develop and deliver solutions that solve complex, real-world challenges. Ultimately, this is
realized through our creative software products and platforms.
CUSTOMERS. Globally, a wide variety of organizations rely on our products daily including local, state
and national mapping agencies, transportation departments, defense organizations, engineering and
utility companies, and businesses serving agriculture and natural resource needs. Our portfolio enables
these organizations to holistically understand change and make clear, reliable decisions.
TECHNOLOGY. Our priority is to deliver products, platforms and solutions that make our customers
successful. Hexagon Geospatial is focused on developing technology that displays and interprets
information in a personalized, meaningful way. We enable you to transform location-based content into
dynamic and useable business information that creatively conveys the answers you need.
TEAM. As an employer, we recognize that the success of our business is the result of our highly
motivated and collaborative staff. At Hexagon Geospatial, we celebrate a diverse set of people and
talents, and we respect people for who they are and the wealth of knowledge they bring to the table. We
retain talent by fostering individual development and ensuring frequent opportunities to learn and grow.
HEXAGON. Hexagon’s solutions integrate sensors, software, domain knowledge and customer workflows
into intelligent information ecosystems that deliver actionable information. They are used in a broad range
of vital industries.
Hexagon (Nasdaq Stockholm: HEXA B) has approximately 18,000 employees in 50 countries and net
sales of approximately 3.3 bn USD. Learn more at hexagon.com and follow us @HexagonAB.
23
Copyright and Terms of Use
Copyright
© 2017 Hexagon AB and/or its subsidiaries and affiliates. All rights reserved. Hexagon has registered
trademarks in many countries throughout the world. Visit the Trademarks Page for information about the
countries in which the trademarks are registered. See Product Page and Acknowledgments for more
information.
The foregoing authorization specifically excludes content or material bearing a copyright notice or
attribution of rights of a third party. Except as expressly provided above, nothing contained herein shall be
construed as conferring by implication, estoppel or otherwise any license or right under any copyright,
patent or trademark of Hexagon Geospatial or Intergraph or any third party.
If you breach any of these Terms, your authorization to use this Document automatically terminates.
Upon termination, you will immediately destroy any downloaded or printed Materials in your possession or
control.
Disclaimers
ALL MATERIALS SUPPLIED HEREUNDER ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-
INFRINGEMENT. Hexagon Geospatial does not warrant that the content of this Document will be error-
free, that defects will be corrected, or that any Hexagon Geospatial Website or the services that make
Materials available are free of viruses or other harmful components.
Hexagon Geospatial does not warrant the accuracy and completeness of this Document. Hexagon
Geospatial may make changes to this Document at any time without notice.
24
Limitation Of Liability
IN NO EVENT SHALL HEXAGON GEOSPATIAL BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES, OR DAMAGES FOR LOSS OF PROFITS,
REVENUE, DATA OR USE, INCURRED BY YOU OR ANY THIRD PARTY, WHETHER IN AN ACTION
IN CONTRACT OR TORT, ARISING FROM YOUR ACCESS TO, OR USE OF, THIS DOCUMENT.
Indemnification
You agree to defend, indemnify, and hold harmless Hexagon Geospatial, its officers, directors,
employees, and agents from and against any and all claims, liabilities, damages, losses or expense,
including reasonable attorneys' fees and costs, arising out of or in any way connected with your access to
or use of this Document.
Use Of Software
Use of software described in this Document is subject to the terms of the end user license agreement that
accompanies the software, if any. You may not download or install any software that is accompanied by
or includes an end user license agreement unless you have read and accepted the terms of such license
agreement. Any such software is the copyrighted work of Hexagon Geospatial, Intergraph or its licensors.
Portions of the user interface copyright 2012-2017 Telerik AD.
Third party websites are owned and operated by independent parties over which Hexagon Geospatial has
no control. Hexagon Geospatial shall not have any liability resulting from your use of the third party
website. Any link you make to or from the third party website will be at your own risk and any information
you share with the third party website will be subject to the terms of the third party website, including
those relating to confidentiality, data privacy, and security.
Trademarks
The trademarks, logos and service marks ("Marks") displayed in this Document are the property of
Hexagon Geospatial, Intergraph or other third parties. Users are not permitted to use Marks without the
prior written consent of Hexagon Geospatial, Intergraph or the third party that owns the Mark. "Intergraph"
is a registered trademark of Intergraph Corporation in the United States and in other countries. Other
brands and product names are trademarks of their respective owners.
25
US Government Restricted Right
Materials are provided with "RESTRICTED RIGHTS." Use, duplication, or disclosure of Materials by the
U.S. Government is subject to restrictions as set forth in FAR 52.227-14 and DFARS 252.227-7013 et
seq. or successor provisions thereto. Use of Materials by the Government constitutes acknowledgment of
Hexagon Geospatial or Intergraph’s proprietary rights therein.
International Use
You may not use or export Materials in violation of U.S. export laws and regulations. Hexagon Geospatial
makes no representation that Materials are appropriate or available for use in every country, and access
to them from territories where their content is illegal is prohibited.
Hexagon Geospatial provides access to Hexagon Geospatial international data and, therefore, may
contain references or cross references to Hexagon Geospatial products, programs and services that are
not announced in your country. These references do not imply that Hexagon Geospatial intends to
announce such products, programs or services in your country.
The Materials are subject to U.S. export control and economic sanctions laws and regulations and you
agree to comply strictly with all such laws and regulations. In addition, you represent and warrant that you
are not a national of, or otherwise located within, a country subject to U.S. economic sanctions (including
without limitation Iran, Syria, Sudan, Cuba, and North Korea) and that you are not otherwise prohibited
from receiving or accessing the Materials under U.S. export control and economic sanctions laws and
regulations. Hexagon Geospatial makes no representation that the Materials are appropriate or available
for use in every country, and access to them from territories where their content is illegal is prohibited. All
rights to use the Materials are granted on condition that such rights are forfeited if you fail to comply with
the terms of this agreement.
Revisions
Hexagon Geospatial reserves the right to revise these Terms at any time. You are responsible for
regularly reviewing these Terms. Your continued use of this Document after the effective date of such
changes constitutes your acceptance of and agreement to such changes.
Applicable Law
This Document is created and controlled by Hexagon Geospatial in the State of Alabama. As such, the
laws of the State of Alabama will govern these Terms, without giving effect to any principles of conflicts of
law. You hereby irrevocably and unconditionally consent to submit to the exclusive jurisdiction of the
United States District Court for the Northern District of Alabama, Northeastern Division, or the Circuit
Court for Madison County, Alabama for any litigation arising out of or relating to use of this Document
(and agree not to commence any litigation relating thereto except in such courts), waive any objection to
the laying of venue of any such litigation in such Courts and agree not to plead or claim in any such
Courts that such litigation brought therein has been brought in an inconvenient forum. Some jurisdictions
do not allow the exclusions or limitations set forth in these Terms. Such exclusions or limitations shall
apply in all jurisdictions to the maximum extent allowed by applicable law.
Questions
Contact us with any questions regarding these Terms.
26