ENVI Tutorial: Decision Tree Classification
ENVI Tutorial: Decision Tree Classification
Decision Tree Classification Files Used in this Tutorial Background Decision Tree Input Displaying Images for Decision Tree Classification Entering Decision Tree Rules Pairing the Expression Variable with a File Entering Additional Rules Executing the Decision Tree Viewing the Decision Tree Results Modifying the Decision Tree Adding New Decisions Changing the Class Colors and Names Using Band Indices in Decision Expressions Pruning the Decision Tree Saving Tree Survivors to a Mask 2 2 2 2 4 5 5 5 7 8 9 9 9 9 10 11
boulder_dem.dat Spatial subset of USGS DEM of Boulder, Colorado boulder_dem.hdr ENVI Header for above
Background
A decision tree is a type of multistage classifier that can be applied to a single image or a stack of images. It is made up of a series of binary decisions that are used to determine the correct category for each pixel. The decisions can be based on any available characteristic of the dataset. For example, you may have an elevation image and two different multispectral images collected at different times, and any of those images can contribute to decisions within the same tree. No single decision in the tree performs the complete segmentation of the image into classes. Instead, each decision divides the data into one of two possible classes or groups of classes. ENVI provides a decision tree tool designed to implement decision rules, such as the rules derived by any number of excellent statistical software packages that provide powerful and flexible decision tree generators. Two examples that are used commonly in the remote sensing community include CART by Salford Systems and S-PLUS by Insightful. The logic contained in the decision rules derived by these software packages can be used to build a decision tree classifier with ENVIs interactive decision tree tool. Even if you have not used one of these packages to derive any decision rules, you may find ENVIs new decision tree tool to be a useful way to explore your data, or to find areas in your data that fulfill certain criteria. You do not need to start by having a tree that has been generated outside of ENVI in order to learn useful information about your dataset using the decision tree tool.
degrees. The pixels with lower slope are divided into these two groups: north facing slopes, and nonnorth-facing slopes. The pixels that had high NDVI and slopes greater than or equal to 20 are not subdivided. The pixels that have NDVI less than or equal to 0.3 are divided into these two groups: those with band 4 values below 20, and those with band 4 values greater than or equal to 20. However, the band 4 values equal to 0 are different from the values below 20 and band 1 values below the mean of band 1 are different from NDVI less than or equal to 0.3, so subgroups are also derived for these pixels. Or the same tree can be described using the following criteria:
l l l l l l l
Class 1: NDVI above 0.3, slope greater than or equal to 20 degrees Class 2: NDVI above 0.3, slope below 20 degrees, non-north-facing aspect Class 3: NDVI above 0.3, slope below 20 degrees, north-facing aspect Class 4: NDVI less than or equal to 0.3, band 4 greater than or equal to 20 Class 5: NDVI less than or equal to 0.3, band 4 below 20 Class 6: band 4 equal to 0 Class 7: band 1 less than the mean of band 1
2. The first decision will be based on the Landsat image. To define the decision, click on the decision node labeled Node 1. The Edit Decision Properties dialog appears. 3. In the Name field, type NDVI > 0.3. This is the text that will appear on the decision node in the graphical view of the decision tree. 4. In the Expression field, type {ndvi} gt 0.3, then click OK. The Variable/File Pairings dialog appears. The expression entered into the field tells ENVI to divide the pixels into those that have green vegetation and those that do not. NDVI is a commonly used index of green vegetation abundance calculated from the red and near-infrared bands of a multispectral image. The decision tree will calculate the NDVI vegetation index for each pixel, and find all of the pixels that have values higher than 0.3. The pixels with NDVI above 0.3 should have some green vegetation.s
3. In the Name field, type Slope < 20. 4. In the Expression field, type: {slope} lt 20, then click OK. This decision will divide the high NDVI pixels based on the steepness of the slope. 5. Right-click on Class 2 (the green terminal node) and select Add Children to subdivide the pixels with high NDVI and low slopes into those with north facing aspects and those without strongly north facing aspects. 6. The node previously labeled Class 2 is now blank. Click once on this node. The Edit Decision Properties dialog appears. 7. In the Name field, type North. 8. In the Expression field, type: {aspect} lt 20 and {aspect} gt 340, then click OK. 9. Right-click on Class 0 (the black terminal node) and select Add Children to subdivide the pixels with low NDVI values into those with values less than 20 in band 4 (these will mainly correspond to water). 10. The node previously labeled Class 0 is now blank. Click once on this node. The Edit Decision Properties dialog appears. 11. In the Name field, type Low B4. 12. In the Expression field, type: b4 lt 20, then click OK.
While the calculation is taking place, the node that is currently being used to group pixels is temporarily colored light green. Therefore, it is possible to watch the classification process proceed from node to node. When the classification is finished, the result is automatically loaded into a new display.
5. To apply the change to the decision tree, execute the tree again. Some of the yellow pixels that have low Band 1 values are now magenta.
Delete permanently removes the children from the tree. Prune temporarily removes them and allows them to be reinstated without redefining the decision rule or node properties.
In this exercise, you will prune children from the decision tree, then restore them. Pruning and restoring the children allows you to compare the tree results with and without particular sets of children. 1. Right-click on the Low B1 node and select Prune Children. Notice that, while the children are still visible, they are no longer colored nor connected to the tree. This indicates that they have been pruned, and will not be used when the tree is executed. 2. Right-click on the Class 8 node and select Restore Pruned Children.
10
11