This task performs classification for all ENVI Machine Learning model types.

Example


; Start the application
e = ENVI()
 
; Open an input raster file
RasterFile = Filepath('qb_boulder_msi', Subdir=['data'], $
  Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(RasterFile)
 
; Open an input ROI file
ROIFile = Filepath('qb_boulder_roi.xml', Subdir=['data'], $
Root_Dir=e.Root_Dir)
ROI = e.OpenROI(ROIFile)
 
; Get the statistics task from the catalog of ENVITasks
StatsTask = ENVITask('NormalizationStatistics')
 
; Define inputs
StatsTask.INPUT_RASTERS = Raster
 
; Run the task
StatsTask.Execute
 
; Get the data prep task from the catalog of ENVITasks
DataPrepTask = ENVITask('MLTrainingDataFromROIs')
 
; Define inputs
DataPrepTask.INPUT_RASTER = Raster
DataPrepTask.INPUT_ROI = ROI
DataPrepTask.BACKGROUND_LABELS = ['Disturbed Earth', 'Water']
DataPrepTask.NORMALIZE_MIN_MAX = StatsTask.Normalization
DataPrepTask.Execute
 
; Get the training task from the catalog of ENVITasks
TrainTask = ENVITask('TrainExtraTrees')
 
; Define inputs
TrainTask.INPUT_RASTER = DataPrepTask.OUTPUT_RASTER
TrainTask.NUM_ESTIMATORS = 100
 
; Run the task
TrainTask.Execute
 
; Output model metadata
outputModelUri = TrainTask.OUTPUT_MODEL_URI
print, 'Model URI: ' + outputModelUri
 
outputModel = TrainTask.OUTPUT_MODEL
print, outputModel.Attributes
 
; Get the classification task from the catalog of ENVITasks
ClassifyTask = ENVITask('MachineLearningClassification')
 
; Define inputs
ClassifyTask.INPUT_RASTER = Raster
ClassifyTask.INPUT_MODEL = TrainTask.OUTPUT_MODEL
 
; Run the task
ClassifyTask.Execute
 
; Get the collection of data objects currently available in the Data Manager
DataColl = e.Data
 
; Add the output to the Data Manager
DataColl.Add, ClassifyTask.OUTPUT_RASTER
DataColl.Add, Raster
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(Raster)
Layer = View.CreateLayer(ClassifyTask.OUTPUT_RASTER)

Syntax


Result = ENVITask('MachineLearningClassification')

Input properties (Set, Get): INPUT_RASTER, INPUT_MODEL, NORMALIZE_MIN_MAX, OUTPUT_RASTER_URI

Output properties (Get only): OUTPUT_RASTER

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 raster to classify.

INPUT_MODEL (required)

Specify a trained machine learning model to use for classifying the INPUT_RASTER.

NORMALIZE_MIN_MAX (optional)

Specify the data value that corresponds to 0% and 100% reflectance.

OUTPUT_RASTER

This is a reference to the output raster of filetype ENVI.

OUTPUT_RASTER_URI (required)

Specify a string with the fully qualified filename and path to export the associated OUTPUT_RASTER.

  • If you set this property to an asterisk symbol (*), the output raster will be virtual and not written to disk.
  • If you do not specify this property, or set it to an exclamation symbol (!), a temporary file will be created.

Version History


Deep Learning 2.0

Introduced

See Also


ENVIMachineLearningModel