This task uses a trained TensorFlow pixel segmentation model to perform inference on a raster in regions that contain features of interest identified by a grid model (patent pending). The result is a classification image and a grid output vector. An optional output is a class activation raster whose pixel values represent the probability (0 to 1) of matching the feature of interest.

This task is part of ENVI Deep Learning, which requires a separate license and installation.

Example


Sample data files are 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. The files are located in Grid_Tutorial_Data\Classification\ under the Models and Rasters subdirectories.

; Start the application
e = ENVI()
 
; Open a raster for classification
; Update the following line with the correct path
; to the tutorial data files.
RasterURI = 'C:\MyTutorialFiles\california_1_subset_20090623.dat'
Raster = e.OpenRaster(RasterURI)
 
; Select a trained Pixel Segmentation model
; Update the following line with the correct path
; to the tutorial data files.
PixelModelURI = 'C:\MyTutorialFiles\TrainedPixelModel.h5'
PixelModel = ENVITensorFlowModel(PixelModelURI)
 
; Select a trained Grid model
; Update the following line with the correct path
; to the tutorial data files.
GridModelURI = 'C:\MyTutorialFiles\TrainedGridModel.h5'
GridModel = ENVITensorFlowGridModel(GridModelURI)
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('TensorFlowOptimizedPixelClassification')
 
; Select task inputs
Task.INPUT_RASTER = Raster
Task.INPUT_PIXEL_MODEL = PixelModel
Task.INPUT_GRID_MODEL = GridModel
Task.CONFIDENCE_THRESHOLD = 0.7
Task.OUTPUT_CLASSIFICATION_RASTER_URI = e.GetTemporaryFilename('.dat', /CLEANUP_ON_EXIT)
Task.OUTPUT_VECTOR_URI = e.GetTemporaryFilename('.shp', /CLEANUP_ON_EXIT)
 
; Run the task
Task.Execute
 
; Add the output to the Data Manager
e.Data.Add, Task.OUTPUT_CLASSIFICATION_RASTER
e.Data.Add, Task.OUTPUT_VECTOR
 
; Display the result
View = e.GetView()
Layer1 = View.CreateLayer(Raster)
 
; Disable the unclassified class for display
classRaster = Task.OUTPUT_CLASSIFICATION_RASTER
classRaster.Metadata['data ignore value'] = 0
classRaster.WriteMetadata
Layer2 = View.CreateLayer(classRaster)
Layer3 = View.CreateLayer(Task.OUTPUT_VECTOR)
 
; Zoom out
View.Zoom, 1.0, /OUT
end

Syntax


Result = ENVITask('TensorFlowOptimizedPixelClassification')

Input properties (Set, Get): CONFIDENCE_THRESHOLD, INPUT_RASTER, INPUT_GRID_MODEL, INPUT_PIXEL_MODEL, OUTPUT_CLASS_ACTIVATION_RASTER_URI, OUTPUT_CLASSIFICATION_RASTER_URI, OUTPUT_VECTOR_URI

Output properties (Get only): OUTPUT_CLASS_ACTIVATION_RASTER, OUTPUT_CLASSIFICATION_RASTER, 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:

CONFIDENCE_THRESHOLD (optional)

Specify a floating-point threshold value between 0 and 1.0. Bounding boxes with a confidence score less than this value will be discarded before applying the IOU_THRESHOLD. The default value is 0.2. Decreasing this value generally results in more classification bounding boxes throughout the scene. Increasing it results in fewer classification bounding boxes.

INPUT_RASTER (required)

Specify the raster to classify.

INPUT_GRID_MODEL (required)

Specify a trained TensorFlow grid model that was used to classify features within the input raster.

INPUT_PIXEL_MODEL (required)

Specify a trained pixel segmentation model to classify features in grid-detected cells.

OUTPUT_CLASS_ACTIVATION_RASTER (optional)

This is a reference to the output class activation raster of filetype ENVI. It is a float raster with one band for each class, including the background class, whose values range from 0 to 1.

OUTPUT_CLASS_ACTIVATION_RASTER_URI (optional)

Specify a string with the fully qualified filename and path of the associated OUTPUT_CLASS_ACTIVATION_RASTER. If you do not set this property, the class activation raster will not be created. You must set this property or the OUTPUT_CLASSIFICATION_URI property. You can also set both.

OUTPUT_CLASSIFICATION_RASTER (optional)

This is a reference to the output classification raster of filetype ENVI. It is a single-band byte raster whose values range from 0 to the number of classes.

OUTPUT_CLASSIFICATION_RASTER_URI (optional)

Specify a string with the fully qualified filename and path of the associated OUTPUT_CLASSIFICATION_RASTER. If you do not set this property, the classification raster will not be created. You must set this property or the OUTPUT_CLASS_ACTIVATION_URI property. You can also set both.

OUTPUT_VECTOR (required)

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.

Version History


Deep Learning 3.0

Introduced

See Also


TrainTensorFlowGridModel Task, TrainTensorFlowPixelModel Task