Class Activation to Pixel ROI
Use the Class Activation to Pixel ROI tool to create pixel regions of interest (ROIs) from a class activation raster that was generated by a deep learning model. The ROIs created with this tool can be combined with the original ROIs to create new label rasters to either train a new model again or to refine a trained model. Pixel ROIs do not contain georeferencing information. They can only be used as input to label rasters that are perfectly coregistered with their associated input rasters. If you want to create ROIs that can reproject to a georeferenced raster, then use the Class Activation To Polygon ROI tool instead.
You can also write a script to create pixel ROIs from a class activation raster using the ClassActivationToPixelROI task.
Follow these steps:
- Open the Class Activation to Pixel ROI dialog using one of the following options:
- In the ENVI Toolbox, select Deep Learning > Pixel Segmentation > Class Activation to Pixel ROI.
- In the Deep Learning Guide Map, click the Refine a Trained Model button, followed by Class Activation to Pixel ROI.
- In the Input Raster field of the Class Activation to Pixel ROI dialog, select a class activation raster that you created using the TensorFlow Pixel Classification tool.
- Use the Threshold the slider bar or up/down arrow buttons to specify the minimum value in the class activation raster that will be used to differentiate feature pixels from background pixels. If the highest feature class for a given pixel is greater than or equal to the threshold value, the pixel will be designated as that feature class. Otherwise, it will be designated as background.
-
If you set the Threshold value to 0 (the default) and you only have one feature class, select an automatic thresholding method to use from the Automatic Threshold Method drop-down list. The choices are:
-
Isodata: Works iteratively by calculating an initial threshold that is half the dynamic range of the image or layer, effectively dividing the image into feature (above the initial threshold) and background (below the initial threshold) pixels. Next, the algorithm separately calculates the sample mean of the feature and background pixels, using these new sample means to calculate a new threshold value (the average of the sample means). The process repeats using each new, successive threshold value until the resulting threshold value ceases to change (Ridler and Calvard, 1978).
- Mean: Takes the mean value of the gray levels as the threshold (Glasbey, 1993).
- Maximum Entropy: Considers the thresholding image as two classes of events, with each class characterized by a Probability Density Function (PDF). It then maximizes the sum of the entropy of the two PDFs to converge on a single threshold value (Kapur, Sahoo, and Wong, 1985).
- Minimum Error: Approximates the histogram as a bimodal Gaussian distribution and finds a cutoff point. The cost function is based on the Bayes classification rule (Kittler and Illingworth, 1986).
- Moments: Considers the grayscale image as a blurred version of an ideal binary image. This method determines the threshold so that the first three moments of the input image are preserved in the output image (Tsai, 1985).
- Otsu: (default) A histogram shape-based method. It is based on discriminate analysis and uses the zero- and the first-order cumulative moments of the histogram for calculating the value of the thresholding level (Otsu, 1979).
- Select an output location and filename in the Output ROI field.
-
To reuse these task settings in future ENVI sessions, save them to a file. Click the down arrow next to the OK button and select Save Parameter Values, then specify the location and filename to save to. Note that some parameter types, such as rasters, vectors, and ROIs, will not be saved with the file. To apply the saved task settings, click the down arrow and select Restore Parameter Values, then select the file where you previously stored your settings.
-
To run the process in the background, click the down arrow and select Run Task in the Background. If an ENVI Server has been set up on the network, the Run Task on remote ENVI Server name is also available. The ENVI Server Job Console will show the progress of the job and will provide a link to display the result when processing is complete. See the ENVI Servers topic in ENVI Help for more information.
- Click OK.
To view the result:
- From the ENVI main menu bar, select File > Open.
- Select the ROI file (.xml) that you just created, and click Open. The Select Base ROI Visualization Layer dialog appears.
- Select an image on which to display the ROI, and click OK.
References:
Glasbey, C. "An Analysis of Histogram-Based Thresholding Algorithms." CVGIP: Graphical Models and Image Processing 55 (1993): 532-537.
Kapur, J., P. Sahoo, and A. Wong. "A New Method for Gray-Level Picture Thresholding Using the Entropy of the Histogram." Graphical Models and Image Processing 29, No. 3 (1985): 273-285.
Kittler, J., and J. Illingworth. "Minimum Error Thresholding." Pattern Recognition 19 (1986): 41-47.
Otsu, N. "A Threshold Selection Method from Gray-Level Histograms." IEEE Transactions on Systems, Man and Cybernetics 9 (1979): 62–66.
Ridler, T., and S. Calvard. "Picture Thresholding Using an Iterative Selection Method." IEEE Transactions on Systems, Man and Cybernetics 8 (1978): 630 - 632.
Tsai, W. "Moment-Preserving Thresholding: a New Approach." Computer Vision, Graphics, and Image Processing 29 (1985): 377-393.