Feature Extraction Supervised
Feature Extraction Supervised
Feature Extraction with Supervised Classification Extracting Impervious Features with Supervised Classification References 2 4 20
Description QuickBird multispectral image, Boulder, CO, USA, captured July 4, 2005 Header file for above Training data file for above
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.
following figure. The workflow allows you to go back to previous steps if you want to change your settings.
The Select Fx Input Files dialog appears. 3. Click Open File. The Open dialog appears. 4. Navigate to Data\feature_extraction , select qb_colorado, and click Open. This image 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. Click OK in the Select Fx Input files dialog. The Find Objects:Segment panel appears. You can drag this panel outside of the ENVI EXinterface if it's obscuring 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. You can move 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).
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 few steps. For more background on choosing effective 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 click Next 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 adjacent 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. Click Next. 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 of No Thresholding, and click Next. Feature Extraction proceeds to the Find Objects: 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, and click Next. 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
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 click Next.
Supervised Classification
Supervised classification is the process of using training data to assign objects of unknown identity to one or more known features. The more features and 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 assigned 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.
2. Navigate to Data\feature_extraction, select qb_colorado_supervised.xml, and click Open. ENVI EX restores 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 ENVIreleases and tutorials will not work correctly.
Notice the various colored objects in the image. A red object, for example, is a training sample representing 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.
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 topmost layer and provides a better visual representation of the scene than the Region Means image.
The image display centers over this pixel coordinate. 2. Center the Preview Portal over the house and dirt roads in the center part of the image.
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 a yellowish color). 4. Set the transparency back to 0% in the Preview Portal so you can see the current 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. Enter 700,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 was previously collected from most of the trail (shown in red).
10
8. Set the transparency of the Preview Portal to 0% and notice how a section of the trail is misclassified as Fields/Grasses. In terms of the Impervious feature, this is an error of ommission or false negative. In this case, you want this object to be classified as Impervious, but it is classified as something else.
9. In the next series of steps, you will learn two methods for correcting errors of commission and omission: (1) adding a new feature called Dirt Road and (2) collecting more training data.
11
4. Go back to the upper part of the image with the house and dirt road you examined earlier (see "Understanding Errors of Commission and Omission in Supervised Classification" on page 9). 5. The Dirt Road feature is selected by default. If the Preview Portal is still open, move it out of the way before continuing since you cannot select training data through the Preview Portal. Click once in the Image window to activate the process of collecting training data for this feature. As you move around the image, the objects underlying the cursor are highlighted with the color assigned to the Dirt Road Feature. 6. Click to select objects representing the dirt road, as shown in the following figure. The color of the objects change to the feature color, and the feature name updates to show the number of objects you added. Move around the entire image and choose a variety of different objects that represent dirt roads.
Here are a few more tips for selecting objects as training data:
l
To select multiple objects at once, click and drag the cursor to draw a box around the objects. ENVI EX assigns all of the segments that are completely enclosed within the selection box to the feature. Ctrl-Z undoes the box selection. Be careful using the selection box because you can easily select too many features, which will slow the performance of the Preview Portal. To remove an individual object from the selection, click on the object. The feature name updates to show one less object. To see the boundaries of the individual objects, enable the Show Boundaries option in the Feature Extraction dialog.
7. Notice how the Preview Portal updates to show the new classification results in other parts of the image each time you select a new object and add to the training data set. 8. Center the Preview Portal over the area with the dirt roads. By adding the Dirt Road feature, did the classification improve with regard to impervious surfaces? 9. In the Feature Extraction dialog, select the Impervious feature.
12
10. Experiment with selecting more training data for the Impervious feature, and possibly adding a new feature of your choice. Evaluate how these changes affect the classification of impervious surfaces.
5. In the Image window, pan to the area of the shapefile (pixel coordinates are approximately 1248,218) and zoom in so you can better see the individual records.
13
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 Attributes dialog 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
8. In the Import Attributes dialog, click Import 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 currently 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 an unwanted object from the Dirt 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. You wont do this step in this tutorial, but another option is to go back to the Segment step and experiment with a lower Merge Level value, which will result in more segments/objects.
15
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 Attributes
1. 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 the attribute to the Selected Attribute list. to add
5. Experiment with different combinations of spatial, spectral, texture, and customized attributes to determine the best results for classifying impervious surfaces. If you do not have time to select your own attributes, the Auto Select Attributes button often provides good results.
16
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 (class A), 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 ways of mathematically representing a kernel function. The Radial Basis Function kernel type (default) works well in most cases.
Linear:
Polynomial:
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 boundary between classes. A value of 1 represents a first-degree polynomial function, which is essentially 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
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.
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. Click OK. If you ever want to revert back to the classification results from the original training data file, you can click the Restore Training Data button and select qb_colorado_supervised.xml.
18
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.
19
References
Arnold, 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 University. 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