This task creates polygon ROIs from a class activation raster generated by a deep learning model.
This task is part of ENVI Deep Learning, which requires a separate license and installation.
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. If the class activation raster is georeferenced, then the output polygon ROIs will use the same projection. This allows the ROIs to reproject to georeferenced rasters (that will be classified) that are not perfectly coregistered with their associated label rasters.
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', $
Raster = e.OpenRaster(File)
ModelFile = 'C:\MyTutorialFiles\TrainedModelContainers.h5'
Model = ENVITensorFlowModel(ModelFile)
ClassTask = ENVITask('TensorFlowMaskClassification')
ClassTask.INPUT_RASTER = Raster
ClassTask.INPUT_MODEL = Model
ClassTask.OUTPUT_CLASS_ACTIVATION_RASTER_URI = e.GetTemporaryFilename()
Task = ENVITask('ClassActivationToPolygonROI')
Task.INPUT_RASTER = ClassTask.OUTPUT_CLASS_ACTIVATION_RASTER
View = e.GetView()
Layer = View.CreateLayer(Raster)
roiLayer = Layer.AddRoi(Task.OUTPUT_ROI)
Result = ENVITask('ClassActivationToPolygonROI')
Input properties (Set, Get): INPUT_RASTER, METHOD, OUTPUT_ROI_URI, THRESHOLD
Output properties (Get only): OUTPUT_ROI, 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.
This task inherits the following methods from ENVITask. See the ENVITask topic in ENVI Help.
This task inherits the following properties from ENVITask:
See the ENVITask topic in ENVI Help for details.
This task also contains the following properties:
Specify an input class activation raster.
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:
- Maximum Entropy
- Minimum Error
- Otsu (default)
This is a reference to the output ROI.
Specify a string with the fully qualified path and filename for OUTPUT_ROI.
If THRESHOLD is not specified, then this will be the threshold calculated by METHOD. If THRESHOLD is specified, then this will be the threshold specified.
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.
Deep Learning 1.0
Deep Learning 1.1
Modified METHOD and THRESHOLD properties to allow multiple classes.
ClassActivationToClassification Task, ClassActivationToPixelROI Task, ClassActivationToPolygonShapefile Task