0% found this document useful (0 votes)
139 views

Exercise: Prepare Training Sample Data For Object Detection

2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
139 views

Exercise: Prepare Training Sample Data For Object Detection

2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Spatial Data Science MOOC

Exercise
Prepare training sample data for
object detection
Section 5 Exercise 1
03/2020
Spatial Data Science MOOC

Prepare training sample data for object detection

Time to complete
45 minutes

Introduction
Deep learning is a type of machine learning. It relies on multiple layers of nonlinear
processing for feature identification and pattern recognition. ArcGIS uses deep learning
frameworks to accomplish various deep learning analyses, including object detection. Training
a model to detect one, or multiple objects, saves the time and expense of digitizing and
collecting data. It also allows you to expand your analysis by using the model with different
datasets and in different locations.

Exercise scenario
Tax assessors at local government agencies often rely on surveys to estimate property value
and calculate property taxes. These surveys are infrequent, which means that there can be
some inaccuracy in the assessment records. Swimming pools are an important part of these
assessments because they impact the value of the property. You will use ArcGIS deep learning
tools to detect all swimming pools in a defined area. Tax assessors can use this information to
identify newly constructed pools that were not recorded in the assessment records. This
information will help tax assessors identify more appropriate property values and taxes, which
can lead to additional revenue for the community.

Step 1: Download the exercise data files


In this step, you will download the exercise data files.

a Open a new web browser tab or window.

b Go to https://bit.ly/2FaJ5Wy and download the exercise data ZIP file.


Note: The complete URL to the exercise data file is https://www.arcgis.com/home/
item.html?id=835d0a54412a45b9b361ce8e0fbd37d4.

c Extract the files to a folder on your local computer, saving them in a location that you will
remember.

Copyright © 2020 Esri. All rights reserved. 1


Spatial Data Science MOOC

Step 2: Open an ArcGIS Pro project


a Start ArcGIS Pro.

b If necessary, sign in using the provided course ArcGIS account.

c Click Open Another Project.

d Browse to the ObjectDetection folder that you saved on your computer.

e Open the ObjectDetection.aprx project.

Your ArcGIS Pro project includes an imagery file that shows a false-color image of an area in
Southern California. This false-color image uses an infrared band to visualize vegetation in
red. Although you can use a true-color image for this analysis, the false-color image better
distinguishes pools from other objects.

Copyright © 2020 Esri. All rights reserved. 2


Spatial Data Science MOOC

Step 3: Create training samples


The first step in object detection is to create training samples that will be used to train the
model. There are various ways to create training samples:

• Create training samples using ArcGIS Pro editing tools.


• Create training samples using the Label Objects For Deep Learning tool.
• Create training samples using crowdsourced data (for example, community-based
damage assessments).
• Use pre-existing data as training samples (for example, a feature class of building
footprints).

In this step, you will follow the process of creating training samples using the Label Objects
For Deep Learning tool.

a In the Contents pane, select the NAIP_AOI.tif.

b From the Imagery tab, in the Image Classification group, click Classification Tools and
choose Label Objects For Deep Learning.

The Image Classification pane provides tools for you to trace, or digitize, the features that you
will use as your training samples.

c In the Image Classification pane, click the Polygon button .

d From the Map tab, go to the Pool 1 bookmark.

e On the map, click the four corners of the pool to create a rectangular outline.

Copyright © 2020 Esri. All rights reserved. 3


Spatial Data Science MOOC

f Double-click the last point of the rectangular outline.


The Define Class dialog box appears. It allows you to define the class and value of the
feature. Each class represents an object that you want to detect. If you wanted to detect pools
and tennis courts, you would create two classes with training samples for each class.

g In the Define Class dialog box, under Name, type Pool.

h Under Value, type 0.


Note: All training samples must be labeled with a class value.

i Click OK.

j Go to the Pool 2 bookmark.

k Use the Polygon button to outline the pool.

Note: The color and pixel percentage of your Pool polygons may differ.
In the Image Classification pane, under Labeled Objects, the next pool is automatically added
and labeled as Pool.

Copyright © 2020 Esri. All rights reserved. 4


Spatial Data Science MOOC

After creating your training samples, you would use the pane's Export Training Data tab to
export these training samples into a format that you can use to train your model. Because the
creation of training samples can be a time-consuming process, you will proceed with a layer of
pre-created training samples.

l Close the Image Classification pane.

m In the Label Objects warning window, click No.

Step 4: Review training samples


To save time, you will use pre-existing data as training samples. You can use pre-existing
point, line, polygon, or even raster data for your training samples. In the previous step, you
created polygons to represent the training samples (pools). In this step, you will use pre-
existing point data to represent the training samples (pools).
All training sample data must have a class value that distinguishes the types, or classes, of
objects to detect. In this step, you will confirm that the pre-created point data includes this
class value.

a In the Catalog pane, expand Databases, and then expand ObjectDetection.gdb.

b Right-click TrainingSamplesComplete and choose Add To Current Map.

c In the Contents pane, right-click TrainingSamplesComplete and choose Zoom To Layer.

Copyright © 2020 Esri. All rights reserved. 5


Spatial Data Science MOOC

This training samples data uses points to represent swimming pools.

d Right-click TrainingSamplesComplete and choose Attribute Table.

This analysis will detect one class: pools. As such, there is only one class value: 0.

e Close the attribute table.

Step 5: Export training samples


In this step, you will export the pre-created training samples into image chips.

Copyright © 2020 Esri. All rights reserved. 6


Spatial Data Science MOOC

Image chips use the training sample locations to cut, or chip, the source imagery into defined
sub images that will contain a training sample. These image chips will be used to train the
object detection deep learning model.

a In the Geoprocessing pane, search for and open the Export Training Data For Deep
Learning (Image Analyst Tools) tool.
You will use this tool to define the properties of the image chips.

b Complete the tool using the following parameters:

• Input Raster: NAIP_AOI.tif


• Output Folder: ImageChips
• Input Feature Class Or Classified Raster: TrainingSamplesComplete
• Class Value Field: ClassValue
• Buffer Radius: 6

c For Buffer Radius, point to the parameter name and pause your pointer on the
Geoprocessing Input Information icon .
The Geoprocessing Input Information icon provides an explanation of how the parameter
is used in the tool. Because you are using point data, you can use this parameter to add a
buffer around each point, creating circular polygon training samples that will better represent
the shape of the pools.

d For Input Mask Polygons, leave the default.

Copyright © 2020 Esri. All rights reserved. 7


Spatial Data Science MOOC

This parameter delineates the area where image chips will be created. You want to create
image chips for all training samples, so you will leave this parameter empty.

e For Image Format, leave the default.


The image format that you choose will depend on the number of bands of your source
imagery file.

f For Tile Size X and Tile Size Y, leave the defaults.


Tile size is the dimensions of the image chip size in X and Y. The unit of measurement is in
pixels. Larger tile sizes will require more processing time and power.

g For Stride X and Stride Y, leave the defaults.


The stride determines how much overlap there will be in each image chip. With a tile size of
256 and a stride of 128, half of the first image chip will overlap with the next image chip. This
is useful when you have a small training sample size and want to increase the training sample
size.

h For Rotation Angle, leave the default.


Rotation can be used to create additional image chips. The original chip is rotated by a
specified angle to create additional chips, at additional angles. This process can help
augment the data.
Note: There is no correct tile size, stride, and rotation angle. These values will vary based on
your analysis, source imagery, and computing power. The default values provide a baseline,
but it is recommended that you try several variations to determine if your model results
improve.

i For Reference System, leave the default.


Reference System indicates the reference system used to interpret the input image. Because
this image is pre-processed orthoimagery, it should be processed using Map Space.

j For Output No Feature Tiles, leave the default.


This parameter allows you to include image chips that do not have any training samples. In
this analysis, it would create image chips with no pools. These chips can provide more context
to the model, identifying objects that may look like a pool but are not. Including false
positives like these can potentially improve model results but includes additional image chips
to process.

k For Meta Data Format, choose PASCAL Visual Object Classes.

Copyright © 2020 Esri. All rights reserved. 8


Spatial Data Science MOOC

The Meta Data Format defines the format for the image chip labels. The PASCAL Visual
Object Classes is a standardized image dataset format for object class detection.

l Click Run.
A message appears at the bottom of the Geoprocessing pane to confirm that the tool is
complete.

Copyright © 2020 Esri. All rights reserved. 9


Spatial Data Science MOOC

Step 6: Review image chips


After the Export Training Data For Deep Learning tool is complete, you can review the image
chips from the specified folder location.

a Open File Explorer.

b Browse to ..\ObjectDetection\ImageChips.

The tool creates a folder for the image chips that includes the images, label definitions for the
images, image statistics, and a model definition file. The model definition file references this
image chip information. You will use the model definition file to train the model.

c Double-click the Images folder.

d Open one of the .tif files.

This image chip is an example of one of the image chips that will be used to train the model.

e Save the project.

Copyright © 2020 Esri. All rights reserved. 10


Spatial Data Science MOOC

f If you are continuing to the next exercise, leave ArcGIS Pro open; otherwise, exit ArcGIS
Pro.

Copyright © 2020 Esri. All rights reserved. 11

You might also like