This task creates a classification raster from a class activation raster generated by a deep learning model. The class membership of each pixel can be determined automatically or by specifying an explicit threshold to use.
This task is part of ENVI Deep Learning, which requires a separate license and installation.
Classification rasters have a background class (value = 0) in addition to the feature classes. It is assumed that an input class activation raster with multiple bands includes the background class as the first band.
If you are training a deep learning model to find a single feature, the output classification raster will be binary: one background class (0) and a single feature class (1). In this case, the ClassActivationToClassification task accepts either a threshold value or method. If you specify a threshold value, that takes precedence. If you do not specify a value, a designated thresholding method is used to automatically compute the threshold value. If the feature class value for a given pixel is greater than or equal to the threshold value, the pixel will be designated as "feature" (value = 1).
If you are training a deep learning model to find multiple features, the output classification raster will have multiple values: one background class (0) and integers that range from 1 to the number of feature classes. In this case, the ClassActivationToClassification task accepts an optional threshold value and ignores the thresholding method. If you do not specify a threshold value, the class assigned to each pixel is that with the highest value out of all the classes, including the background class. If you specify a threshold value, the class assigned to each pixel is the feature class with the highest value, if it is greater than or equal to the threshold value. If it is less than the threshold value, the pixel is assigned the background class.
Example
The file TrainedModelContainers.h5 is included with the ENVI Deep Learning tutorial data, which is available on our ENVI Tutorials web page. Click the "Deep Learning" link in the ENVI Tutorial Data section to download a zip file containing the data. Extract the contents to a local directory. That file is in the shipping_containers directory.
e = ENVI()
File = Filepath('OaklandPortOrthophoto1.dat', $
Subdir=['data','deep_learning'], Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
ModelFile = 'C:\MyTutorialFiles\TrainedModelContainers.h5'
Model = ENVITensorFlowModel(ModelFile)
ClassTask = ENVITask('TensorFlowPixelClassification')
ClassTask.INPUT_RASTER = Raster
ClassTask.INPUT_MODEL = Model
ClassTask.OUTPUT_CLASS_ACTIVATION_RASTER_URI = e.GetTemporaryFilename()
ClassTask.Execute
Task = ENVITask('ClassActivationToClassification')
Task.INPUT_RASTER = ClassTask.OUTPUT_CLASS_ACTIVATION_RASTER
Task.Execute
e.Data.Add, Task.OUTPUT_RASTER
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)
Syntax
Result = ENVITask('ClassActivationToClassification')
Input properties (Set, Get): INPUT_RASTER, METHOD, OUTPUT_RASTER_URI, THRESHOLD
Output properties (Get only): OUTPUT_RASTER, OUTPUT_THRESHOLD
Properties marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Properties marked as "Get" are those whose values you can retrieve but not set.
Methods
This task inherits the following methods from ENVITask. See the ENVITask topic in ENVI Help.
- AddParameter
- Execute
- Parameter
- ParameterNames
- RemoveParameters
Properties
This task inherits the following properties from ENVITask:
COMMUTE_ON_DOWNSAMPLE
COMMUTE_ON_SUBSET
DESCRIPTION
DISPLAY_NAME
NAME
REVISION
See the ENVITask topic in ENVI Help for details.
This task also contains the following properties:
INPUT_RASTER (required)
Specify the ENVIRaster to classify. This raster must be in ENVI format and Float data type in the range 0 to 1.
METHOD (optional)
Specify the thresholding method to use to differentiate feature and background pixels in INPUT_RASTER. This property only applies to a single feature class and is ignored for multiple feature classes. If THRESHOLD is specified, it will supersede METHOD. The following are valid values:
- Isodata
- Mean
- Maximum Entropy
- Minimum Error
- Moments
- Otsu (default)
OUTPUT_RASTER
This is a reference to the output raster.
OUTPUT_RASTER_URI (optional)
Specify a string with the fully qualified filename and path of the associated OUTPUT_RASTER. If you do not specify this property, or set it to an exclamation symbol (!), a temporary file will be created.
OUTPUT_THRESHOLD
If you do not set the THRESHOLD property, then OUTPUT_THRESHOLD will be the threshold calculated by METHOD for a single feature class and !NULL for multiple feature classes. If you set the THRESHOLD property, then OUTPUT_THRESHOLD will be set to THRESHOLD.
THRESHOLD (optional)
Specify a threshold value to use to differentiate feature and background pixels in INPUT_RASTER. If the highest feature class value 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 property, that will supersede METHOD.
Version History
Deep Learning 1.0
|
Introduced |
Deep Learning 1.1
|
Modified INPUT_RASTER, OUTPUT_THRESHOLD, and THRESHOLD properties to allow multiple classes.
|
See Also
ClassActivationToPixelROI Task, ClassActivationToPolygonROI Task, ClassActivationToPolygonShapefile Task