This task creates a polygon shapefile 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.

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.

; Start the application
e = ENVI()
 
; Open an input file
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)
 
; Run the classification task
ClassTask = ENVITask('TensorFlowPixelClassification')
ClassTask.INPUT_RASTER = Raster
ClassTask.INPUT_MODEL = Model
ClassTask.OUTPUT_CLASS_ACTIVATION_RASTER_URI = e.GetTemporaryFilename()
ClassTask.Execute
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('ClassActivationToPolygonShapefile')
 
; Define inputs
Task.INPUT_RASTER = ClassTask.OUTPUT_CLASS_ACTIVATION_RASTER
 
; Run the task
Task.Execute
 
; Add the output to the Data Manager
e.Data.Add, ClassTask.OUTPUT_CLASS_ACTIVATION_RASTER
e.Data.Add, Task.OUTPUT_VECTOR
 
; Display the result
View = e.GetView()
Layer1 = View.CreateLayer(ClassTask.OUTPUT_CLASS_ACTIVATION_RASTER)
Layer2 = View.CreateLayer(Task.OUTPUT_VECTOR)

Syntax


Result = ENVITask('ClassActivationToPolygonShapefile')

Input properties (Set, Get): APPLY_SYMBOLOGY, INPUT_RASTER, METHOD, OUTPUT_VECTOR_URI, THRESHOLD

Output properties (Get only): OUTPUT_THRESHOLD, OUTPUT_VECTOR

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:

APPLY_SYMBOLOGY (optional)

Set this property to generate a vector style sheet that will automatically set the colors of the output polygons to match the class colors of the input raster.

INPUT_RASTER (required)

Specify a class activation raster from which to generate a polygon shapefile.

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_THRESHOLD

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.

OUTPUT_VECTOR

This is a reference to the output vector.

OUTPUT_VECTOR_URI (optional)

Specify a string with the fully qualified path and filename for OUTPUT_VECTOR.

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 METHOD and THRESHOLD properties to allow multiple classes.

See Also


ClassActivationToClassification Task, ClassActivationToPixelROI Task, ClassActivationToPolygonROI Task