feature extraction supervised

Upload: pmjabor

Post on 05-Apr-2018

244 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 Feature Extraction Supervised

    1/20

    ENVI EX Tutorial: FeatureExtraction with SupervisedClassification

    Feature Extraction with Supervised Classification 2

    Extracting Impervious Features with Supervised Classification 4

    References 20

    1

  • 8/2/2019 Feature Extraction Supervised

    2/20

    Feature Extraction with Supervised ClassificationThis tutorial demonstrates how to extract impervious surfaces from a QuickBird multispectral image

    using supervised classification in Feature Extraction.

    Files Used in This TutorialENVI Resource DVD: Data\feature_extraction

    File Description

    qb_colorado QuickBird multispectral image, Boulder, CO, USA, captured July

    4, 2005

    qb_colorado.hdr Header file for above

    qb_colorado_supervised.xml Training data file for above

    ENVI Resource DVD: Data\feature_extraction\vectors

    File Description

    qb_colorado_groundtruth* Sample ground truth data in the form of a point shapefile

    QuickBird files are courtesy of DigitalGlobe and may not be reproduced without explicit permission

    from DigitalGlobe.

    Note: Some ENVI EX features take advantage of graphics hardware that supports the OpenGL 2.0 interface to

    improve rendering performance, if such hardware is present. Your video card should support OpenGL 2.0 or

    higher to take advantage of the graphics features ENVI EX. Be sure to update your video card drivers with the

    most recent version, and set the ENVI EX preference Use Graphics Card to Accelerate Enhancement Tools to

    Yes.

    Background

    Feature Extraction is a module for extracting information from high-resolution panchromatic or

    multispectral imagery based on spatial, spectral, and texture characteristics. You can extract multiple

    features at a time such as vehicles, buildings, roads, bridges, rivers, lakes, and fields. Feature Extraction

    is designed to work with any type of image data in an optimized, user-friendly, and reproducible fashion

    so you can spend less time understanding processing details and more time interpreting results.

    Feature Extraction uses an object-based approach to classify imagery. An object is a region of interest

    with spatial, spectral (brightness and color), and/or texture characteristics that describe the region.

    Traditional remote sensing classification techniques are pixel-based, meaning that spectral information

    in each pixel is used to classify imagery. This technique works well with hyperspectral data, but it is not

    ideal for panchromatic or multispectral imagery. With high-resolution panchromatic or multispectral

    imagery, an object-based method offers more flexibility in the types of features to be extracted.

    The Feature Extraction Workflow

    Feature Extraction is the combined process of segmenting an image into regions of pixels, computing

    attributes for e ach region to create objects, and classifying the objects (with rule-based or supervised

    classification) based on attributes, to extract features. The overall workflow is summarized in the

    2

    ENVI EX Tutorial: Feature Extraction with Supervised Classification

  • 8/2/2019 Feature Extraction Supervised

    3/20

    ENVI EX Tutorial: Feature Extraction with Supervised Classification

    following figure. The workflow allows you to go back to previous steps if you want to change your

    settings.

    3

  • 8/2/2019 Feature Extraction Supervised

    4/20

    Extracting Impervious Features with Supervised

    ClassificationThis tutorial simulates the workflow of a city planner who wants to identify all of the impervious

    surfaces in a neighborhood. Impervious surfaces include paved surfaces, rooftops, and other structures

    which replace naturally pervious soil with impervious materials. The total coverage by impervious

    surfaces in a given area affects urban air and water resources. City government officials often use the

    area of impervious surface on a given property as input into asse ssing its property tax. You will learn

    how to use Feature Extraction to extract impervious surfaces using supervised classification and save it

    to a polygon shapefile.

    Supervised classification in Feature Extraction is an iterative process. Best results are obtained by

    collecting a wide range of training samples, modifying classification parameters, and modifying

    computed attributes, all while previewing results on-the-fly. It is not meant to be a quick-and-dirty,

    simple, linear workflow when your imagery is highly textured and consists of many spatially and

    spectrally heterogeneous features.

    If you need more information about a particular step, click the Help button in the Feature Extractionworkflow to access ENVI EX Help.

    Opening and Displaying the Image

    1. Start ENVI EX.

    2. Double-clickFeature Extraction in the Toolbox, which is the lower-left corner of the ENVI EX

    interface.

    The Select Fx Input Files dialog appears.

    3. ClickOpen File. The Open dialog appears.

    4. Navigate to Data\feature_extraction , select qb_colorado, and clickOpen. Thisimage is a QuickBird, pan-sharpened, 0.6-m spatial resolution, subset saved to ENVI raster

    format. QuickBird captured this scene on July 4, 2005. You can create spectral and spatial

    subsets for use with Feature Extraction, but you will not do those steps in this exercise.

    5. ClickOKin the Select Fx Input files dialog. The Find Objects: Segment panel appears. You can

    drag this panel outside of the ENVI EX interface if it's obscuring the image.

    4

    ENVI EX Tutorial: Feature Extraction with Supervised Classification

  • 8/2/2019 Feature Extraction Supervised

    5/20

    ENVI EX Tutorial: Feature Extraction with Supervised Classification

    Segmenting the Image

    1. In the Find Objects: Segment panel, enable the Preview option to display a Preview Portal. ENVI

    EX segments the image into regions of pixels based on their spatial, spectral, and texture

    information. The Preview Portal shows you the current segmentation results for a portion of the

    image.

    If you move your cursor to the top of the Portal, the Portal toolbar appears.

    You can use the Blend, Flicker, and Swipe tools on the Preview Portal toolbar to view the

    underlying layer. You can also use the Pan, Zoom, and Transparency tools on the main toolbar,

    although these are for display purposes only; they do not affect Feature Extraction results. You

    cannot adjust the Contrast, Brightness, Stretch, or Sharpen values in a Preview Portal. Y ou canmove the Preview Portal around the image or resize it to look at different areas.

    Tip: If the segments are too light to visualize in the Preview Portal, you can click on the image in the

    Image window to select the image layer, then increase the transparency of the image (using the

    Transparency slider in the main toolbar).

    5

  • 8/2/2019 Feature Extraction Supervised

    6/20

    Later in this tutorial, you will restore a previously created training data file for use with

    supervised classification. This training data file was created using a Scale Level of 30, a Merge

    Level of 90, and no refinement. Training data files are tied to specific values for these

    parameters, so you must use these same segmentation parameters in the next fe w steps.

    For more background on choosing effec tive Scale Level, Merge Level, and Refine parameters,

    see the ENVI EX tutorial, Feature Extraction with Rule-Based Classification.

    2. Type 30.0 in the Scale Level field, and clickNext to segment the entire image using this value.

    ENVI EX creates a Region Means image, adds it to the Layer Manager, and displays it in the

    Image window. The new layer name is qb_coloradoRegionMeans. The Region Means

    image is a raster file that shows the results of the segmentation process. Each segment is assigned

    the mean band values of all the pixels that belong to that region. Feature Extraction proceeds to

    the Find Objects: Merge panel.

    3. Merging allows you to group similar a djacent segments by re-assembling over-segmented or

    highly textured results. Type 90.0 in the Merge Level field, and press Enter. The Preview Portal

    updates to show how the new Merge Level affects the segments.

    4. ClickNext. Feature Extraction proceeds to the Find Objects: Refine panel.

    5. The Refine step is an optional, advanced step that uses a technique called thresholding to further

    adjust the segmentation of objects. Thresholding works the best with point objects that have a high

    contrast relative to their background (for example, bright aircraft against a dark tarmac). You do

    not need to perform any thresholding on the image to extract impervious surfaces. Accept the

    default selection ofNo Thresholding, and clickNext. Feature Extraction proceeds to the FindObjects: Compute Attributes panel.

    6. For this exercise, you will compute all available attributes. Ensure that all attribute categories are

    selected under both the Attributes and Advanced tabs, a nd clickNext. ENVI EX computes the

    attributes; this process takes a few minutes to complete. These attributes will be available for

    supervised classification. If you choose not to compute selected attributes when using Feature

    6

    ENVI EX Tutorial: Feature Extraction with Supervised Classification

  • 8/2/2019 Feature Extraction Supervised

    7/20

    ENVI EX Tutorial: Feature Extraction with Supervised Classification

    Extraction, you will save time in this step but will be unable to use those attributes for

    classification.

    7. Feature Extraction proceeds to the Extract Features: Classify or Export panel. Select Choose by

    Selecting Examples, and clickNext.

    Supervised ClassificationSupervised classification is the process of using training data to assign objects of unknown identity to

    one or more known features. The more features a nd training samples you select, the better the results

    from supervised classification. Training data consist of objects that you select as representative samples

    of known features.

    The Extract Features: Supervised Classification panel begins with one undefined feature (Feature_1, see

    figure below). As you move the mouse around the Region Means image, the objects underlying your

    cursor are highlighted with the color a ssigned to that feature. You may need to click once in the Image

    window to activate this function. This is normally how you would begin the process of collecting training

    data. However, for this exercise, you will restore a previously created training data file for extracting

    impervious surfaces and further improve its classification.

    7

  • 8/2/2019 Feature Extraction Supervised

    8/20

    Restoring Training Data

    A training data file is an XML file that contains all the parameters used to classify a given image,

    including the Scale Level, Merge Level, Refine parameters, computed attributes, c lassification

    algorithm and associated parameters, attribute data, and training samples. The training data file you are

    about to open is a first attempt at extracting impervious surfaces. It contains three classes: Impervious,Trees, and Grass_Fields. It wa s created using all computed attributes and using the following

    classification parameters:

    Classification Algorithm: Support Vector Machine

    Kernel Type: Polynomial

    Degree of Kernel Polynomial: 2

    Bias in Kernel Function: 1.00

    Gamma in Kernel Function: 1.03

    Penalty Parameter: 200.00

    Classification Probability Threshold: 0.00

    Simple trial-and-error was used to arrive at these values, which produced a reasonable classification.

    You will learn more about this process later in this tutorial.

    1. Click the Restore Training Data button . The Restore Training Data dialog appears.

    2. Navigate to Data\feature_extraction, select qb_colorado_supervised.xml,

    and clickOpen. ENVI EX re stores and displays the previously created training data.

    Note: Make sure the file qb_colorado_supervised.xml is dated 25 June 2009. Versions of this

    file from previous ENVI releases and tutorials will not work correctly.

    Notice the various colored objects in the image. A red object, for example, is a training samplerepresenting the Impervious feature. The Supervised Classification panel lists each feature with

    its representative color. From this dialog, can you tell how many training samples were collected

    for the Impervious feature?

    Although you are interested in extracting only one feature (impervious surfaces), you still need to

    collect training data for several different features to obtain the best results. The more features and

    training samples you provide, the more choices the classification tool has in classifying objects.

    The minimum number of features needed to perform classification is two.

    Improving Classification Results

    If you were to use this training data file without any modifications and you exported the Imperviousfeature to a shapefile, the results would be reasonable. But the classification is still not completely

    accurate. Following are some helpful tips for improving the classification and obtaining more accurate

    impervious surface boundaries.

    1. Click the Preview option in the Supervised Classification panel. A Preview Portal appears with

    the current classification results. As you make changes to the training data, attributes, and

    classification parameters in the next several steps, the classification results will update in real

    8

    ENVI EX Tutorial: Feature Extraction with Supervised Classification

  • 8/2/2019 Feature Extraction Supervised

    9/20

    ENVI EX Tutorial: Feature Extraction with Supervised Classification

    time. Move the Preview Portal around the image or resize it to view results for different areas.

    2. In the Layer Manager (middle-left part of the ENVI EX interface), drag the layer named qb_

    colorado above qb_coloradomergedRegionMeans. The original Quickbird image is now the top-

    most layer and provides a better visual representation of the scene than the Region Means image.

    Understanding Errors of Commission and Omission in Supervised

    Classification

    1. In the upper-right corner of the ENVI EX interface, enter the pixel coordinates 710,284 in the Go

    To field. Press Enter.

    The image display centers over this pixel coordinate.

    2. Center the Preview Portal over the house and dirt roads in the c enter part of the image.

    9

  • 8/2/2019 Feature Extraction Supervised

    10/20

    Note: To move the Preview Portal yourself from now on, you may need to select RasterPortal in the

    Layer Manager to make the Preview Portal the active layer.

    3. Using the Transparency slider on the main toolbar, set the transparency to 100% so you can view

    the original image and training samples (see figure above). You will see that no training samples

    were taken from the houses or dirt roads (just the surrounding grasses/fields, shown as ayellowish color).

    4. Set the transparency back to 0% in the Preview Portal so you can see the c urrent classification

    results. Notice how the current training data set incorrectly classifies the dirt roads as Impervious.

    In terms of the Impervious feature, this is an example of an error of commission or a false

    positive. In other words, the dirt roads are not actually impervious surfaces, but they are classified

    as such.

    5. Set the transparency of the Preview Portal back to 100%.

    6. Enter700,1175 in the Go To field in the upper-right corner of the ENVI EX interface. Press

    Enter.

    The image display centers over this pixel coordinate.

    7. Move the Preview Portal over the paved trail shown in the figure below. Notice that some training

    data wa s previously collected from most of the trail (shown in red).

    10

    ENVI EX Tutorial: Feature Extraction with Supervised Classification

  • 8/2/2019 Feature Extraction Supervised

    11/20

  • 8/2/2019 Feature Extraction Supervised

    12/20

  • 8/2/2019 Feature Extraction Supervised

    13/20

  • 8/2/2019 Feature Extraction Supervised

    14/20

    This shapefile is a fictional example of ground truth data that represents a GPS survey of different

    surface features on a single property.

    An Import Attributes dialog also appears, when you open the shapefile. This dialog is similar to

    the Vector Attributes dialog in ENVI EX. In the next step, you will use the Import Attributesdialog to associate shapefile records to the features you have defined in the Supervised

    Classification dialog.

    6. You first need to indicate which feature you will associate a shapefile record with. In this

    example, select the Dirt Road feature in the Supervised Classification dialog.

    7. In the Import Attributes dialog, use the Shift key to select rows 7-10, which both contain records

    named dirt road. The associated points are highlighted with a cyan color in the Image window.

    14

    ENVI EX Tutorial: Feature Extraction with Supervised Classification

  • 8/2/2019 Feature Extraction Supervised

    15/20

    ENVI EX Tutorial: Feature Extraction with Supervised Classification

    8. In the Import Attributes dialog, clickImport Selected. ENVI EX adds the selected vector

    records to the Dirt Road feature by matching the points spatial locations with specific objects in

    the Region Means image (which is still available through the Layer Manager).

    Note that three new objects were selected and colored dark blue, which is the color c urrently

    assigned to the Dirt Road feature. The feature name in the Supervised Classification dialog also

    updates to show the number of new objects added.

    If you find that ENVI EX adds some unwanted or incorrect objects to a given feature, you can

    correct it with one of the following options:

    l You can remove a n unwanted object from the D irt Road feature by clicking on it, which

    removes the blue color. You can also continue with manually adding and deleting training

    samples for the feature, as described in "Adding a New Feature and Collecting Training

    Data" on page 11.

    l You wont do this step in this tutorial, but another option is to go back to the Segment step

    and experiment with a lowerMerge Level value, which will result in more

    segments/objects.

    15

  • 8/2/2019 Feature Extraction Supervised

    16/20

    9. Try selecting different records in the Import Attribute dialog (such as field) and importing them

    into a different feature (such as Fields_Grasses). Remember, you first have to select the Fields_

    Grasses feature in the Supervised Classification dialog so that ENVI EX will associate the

    selected records with that feature.

    Modifying Attributes1. Click the Attributes tab in the Supervised Classification panel. The attributes you computed

    earlier in the Compute Attribute step are used to further classify features. The training data file

    that you restored was created using all computed attributes (shown in the Selected Attributes list).

    Some attributes are more useful than others when differentiating objects. Classification results

    may not be as accurate when you use all attributes equally because the irrelevant attributes can

    introduce noise into the results.

    2. Click the Auto Select Attributes button . ENVI EX selects the best attributes to use for

    classifying features. The underlying logic is based on Yang (2007). See References.

    Did this improve the classification of impervious surfaces? If not, try experimenting with your

    own set of attributes, by following these steps:

    3. Select one or more attributes from the Selected Attributes list, then click the Unselect button

    to remove them from consideration. Again, the Preview Portal updates to show the changes

    to the classification.

    4. To select individual attributes for classification, expand the Spectral, Texture, and Spatial folders

    to see their respective attributes. Each attribute is shown with an icon. (The Customized

    folder contains the Color Space and Band Ratio attributes.) Click the Select button to add

    the attribute to the Selected Attribute list.

    5. Experiment with different combinations of spatial, spectral, texture, and customized attributes to

    determine the best results for c lassifying impervious surfaces. If you do not have time to selectyour own attributes, the Auto Select Attributes button often provides good results.

    Modifying Classification Parameters

    1. In the Supervised Classification panel, click the Algorithm tab.

    2. From the Classification Algorithm drop-down list, select K Nearest Neighbor.

    3. Click the Update button and examine the classification results in the Preview Portal. How did

    changing the supervised classification algorithm affect the classification of impervious surfaces?

    4. Experiment with the two classification algorithms (Support Vector Machine and K Nearest

    Neighbor), and try different values for eac h of their associated parameters. Evaluate how these

    changes affect the classification of impervious surfaces, by clicking the Update button to updatethe Preview Portal. Following are some tips on using the parameters.

    5. To restore the default values for all of the parameters, click the Reset button.

    16

    ENVI EX Tutorial: Feature Extraction with Supervised Classification

  • 8/2/2019 Feature Extraction Supervised

    17/20

    ENVI EX Tutorial: Feature Extraction with Supervised Classification

    K Nearest Neighbor

    K Parameter: This is the number of neighbors considered during classification. K nearest distances are

    used as a majority vote to determine which class the target belongs to. For example, suppose you have

    four classes and you set the K Parameter to 3. ENVI EX returns the distances from the target to the

    three nearest neighbors in the training dataset. In this example, assume that the distances are 5.0 (classA), 6.0 (class A), and 3.0 (class B). The target is assigned to class A because it found two close

    neighbors in class A that out-vote the one from class B, even though the class B neighbor is actually

    closer.

    Larger values tend to reduce the effect of noise and outliers, but they may cause inaccurate

    classification. Typically, values of 3, 5, or 7 work well. This is a useful feature of K Nearest Neighbor

    classification because it can reject outliers or noise in the training samples.

    Support Vector Machine (SVM)

    SVM is a classification system derived from statistical learning theory that provides good classification

    results from complex and noisy data. For more information, see Applying Support Vector Machine

    Classification in ENVI Help, or see Hsu, Chang, and Lin (2007) in References.

    Kernel Type: The SVM algorithm provides a choice of four kernel types: Linear, Polynomial, Radial

    Basis Function, and Sigmoid. All of these are different wa ys of mathematically representing a kernel

    function. The Radial Basis Function kernel type (default) works well in most cases.

    Linear:

    Polynomial:

    Radial Ba sis Function (RBF):

    Sigmoid:

    The Gamma in Kernel Function parameter represents the gamma value, which is used for all kernel

    types except Linear.

    The Bias in Kernel Function parameter represents the r value, which is used for Polynomial and

    Sigmoid kernels.

    Degree of Kernel Polynomial: Increasing this parameter more accurately delineates the boundarybetween classes. A value of 1 re presents a first-degree polynomial function, which is esse ntially a

    straight line between two classes. (Or you could use a linear kernel too.) So this value works well when

    you have two very distinctive classes. In most cases, however, you will be working with imagery that

    has a high degree of variation and mixed pixels. Increasing the polynomial value causes the algorithm to

    more accurately follow the contours between classes, but you risk fitting the classification to noise.

    17

  • 8/2/2019 Feature Extraction Supervised

    18/20

    Penalty Parameter: The penalty parameter controls the trade-off between allowing training errors and

    forcing rigid margins. The more you increase this value, the more the parameter suppresses training data

    from jumping classes as you make changes to other parameters. Increasing this value also increases

    the cost of misclassifying points and causes ENVI EX to create a more accurate model that may not

    generalize well. Enter a floating point value greater than 0.

    Classification Probability Threshold: Use this parameter to set the probability that is required for the

    SVM classifier to classify a pixel. Pixels where all rule probabilities are less than this threshold are

    unclassified. The range of values is 0.0 to 1.0. Increasing this value results in more unclassified pixels.

    Saving Your Changes to a New Training Data File

    If you significantly improved the delineation of impervious surface boundaries by adding features,

    selecting more training data, importing ground truth data, experimenting with different attributes, and

    modifying classification parameters, you can c hoose to save your updated training data set to a new

    training data file.

    1. In the Feature Extraction dialog, click the Features tab.

    2. Click the Save Training Data As button . The Training Data dialog appears.

    3. Select an output location and a new file name. Do not overwrite the training data file you restored

    earlier. This allows you to save an iteration of a training data set that you like in case you want

    to make further changes later. ClickOK.

    If you ever want to revert back to the classification results from the original training data file, you ca n

    click the Restore Training Data button and select qb_colorado_supervised.xml.

    Creating a Shapefile of Impervious Surfaces

    1. ClickNext in the Supervised Classification panel. ENVI EX classifies the entire image. Feature

    Extraction proceeds to the Export Features panel.2. The Export Vector Results option is selected by default so that you can output each feature to

    separate shapefiles. Because you are only interested in extracting impervious surfaces, leave the

    Impervious option checked and un-select all of the other features. (Use the small scroll bar to

    see the other features.)

    3. Feature Extraction provides an option to smooth your vector shapefiles using the Douglas-Peucker

    line-simplification algorithm (see References for more information). Line simplification works

    best with highly curved features such as rivers and roads. Select the Smoothing option and leave

    the default Smoothing Threshold value of1 for this exercise.

    4. Select an output directory to save your shapefile. By default, the shapefile will be named

    according to the associated Feature name.

    5. Ensure the Display Datasets After Export option is enabled.

    6. ClickNext. ENVI EX creates a shapefile of the Impervious feature, adds it as a new vector layer

    to the Layer Manager, and displays it in the Image window.

    18

    ENVI EX Tutorial: Feature Extraction with Supervised Classification

  • 8/2/2019 Feature Extraction Supervised

    19/20

    ENVI EX Tutorial: Feature Extraction with Supervised Classification

    7. In the Layer Manager, right-click on Impervious.shp (or whatever you named the output

    shapefile) and select Properties. The Properties dialog appears.

    8. Double-click inside the Fill Interior field, and select True.

    9. Choose a Fill Color, and close the dialog. The polygon shapefile is filled with color, which makes

    the boundaries of impervious surfaces easier to discern.

    Exiting Feature Extraction

    After you export your classification results, you are presented with a summary of the processing options

    and settings you used throughout the Feature Extraction workflow. The Report tab lists the details of

    your settings, and the Statistics tab gives a summary of your feature name, feature c ount, and area

    statistics for the polygon shapefile you created. You can save this information to a text file by clicking

    the Save Text Report button.

    After viewing the processing summary, you can clickFinish to exit the Feature Extraction workflow.

    Or, clickBack to go back to the Export Features panel and change the output options for classification

    results.

    If you clickBack, any output that you created is removed from the Data Manager and Layer Manager. If

    you clickNext from the Export Features panel without making any changes, Feature Extraction will not

    re-create the output. You must make at least one change in the Export Features panel for Feature

    Extraction to crea te new shapefiles and/or classification images.

    19

  • 8/2/2019 Feature Extraction Supervised

    20/20

    ReferencesArnold, C. L., and C. J. Gibbons. (1996). Impervious surface coverage: the emergence of a key

    environmental indicator. Journal of the American Planning Association, Vol. 62.

    Douglas, D. H., and T. K. Peucker. (1973). Algorithms for the reduction of the number of points required

    to represent a digitized line or its caricature. Cartographica, Vol. 10, No. 2, pp. 112-122.

    Hsu, C.-W., Chang, C.-C., and Lin, C.-J. (2007). A practical guide to support vector classification.

    National Taiwan U niversity. URL http://ntu.csie.org/~cjlin/papers/guide/guide.pdf.

    Yang, Z. (2007). An interval based attribute ranking technique. Unpublished report, ITT Visual

    Information Solutions. A copy of this paper is available from ITT Visual Information Solutions Technical

    Support.

    20

    ENVI EX Tutorial: Feature Extraction with Supervised Classification