This task classifies a raster using a trained ENVI Deep Learning ONNX grid model. The output is a shapefile of bounding boxes for each class.

Example


; Start the application
e = ENVI()
 
; Select a raster to classify.
; Update the following line with a valid raster path
RasterFile = "RasterToClassify.dat"
Raster = e.OpenRaster(RasterFile)
 
; Select a trained model.
; Update the following line with a valid model path
ModelFile = 'gridModel.envi.onnx'
Model = ENVIDeepLearningOnnxModel(ModelFile)
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('DeepLearningGridClassification')
 
; Select task inputs
Task.INPUT_RASTER = Raster
Task.INPUT_MODEL = Model
 
; Adjust based on model accuracy
Task.CONFIDENCE_THRESHOLD = 0.7
 
; Run the task
Task.Execute
 
; Get the classification vector output
Result = Task.OUTPUT_VECTOR
 
; Add data to the Data Manager
e.Data.Add, Raster
e.Data.Add, Result
 
; Access the view
View = e.GetView()
 
; Create the layers
Layer1 = View.CreateLayer(Raster)
Layer2 = View.CreateLayer(Result)

Syntax


Result = ENVITask('DeepLearningGridClassification')

Input parameters (Set, Get): CONFIDENCE_THRESHOLD, CUDA_DEVICE_ID, ENHANCE_DISPLAY, INPUT_METADATA, INPUT_MODEL, INPUT_RASTER, OUTPUT_VECTOR_URI, RUNTIME, VISUAL_RGB

Output parameters (Get only): 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.

Input Parameters


CUDA_DEVICE_ID (optional)

If the RUNTIME parameter is set to CUDA, specify the target GPU device ID. If a valid ID is provided, the classification task will execute on the specified CUDA-enabled GPU. If the ID is omitted or invalid, the system defaults to GPU device 0. Use this parameter to explicitly control GPU selection in multi-GPU environments.

CONFIDENCE_THRESHOLD (optional)

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

ENHANCE_DISPLAY (optional)

Specify whether to apply an additional small stretch to the processed data to suppress noise and enhance feature visibility. The optional stretch is effective for improving visual clarity in imagery acquired from aerial platforms or sensors with higher noise profiles.

INPUT_METADATA (optional)

Specify an optional hash containing metadata that will be passed on and accessible to ONNX preprocessor and postprocessor functions.

INPUT_MODEL (required)

Specify the trained ONNX model (.envi.onnx) that was designed for grid-based analysis to classify the INPUT_RASTER.

INPUT_RASTER (required)

Specify the raster to classify.

OUTPUT_VECTOR_URI (optional)

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

RUNTIME (optional)

Specify the execution environment for the classification task with one of these options:

  • CUDA: (Default) Uses NVIDIA GPU acceleration for optimal performance and faster processing. See also CUDA_DEVICE_ID for details on providing a device ID.
  • CPU: Ensures compatibility on systems without GPU support, but with reduced processing speeds.

VISUAL_RGB (optional)

Specify whether to encode the output raster as a three-band RGB composite (red, green, blue) for color image processing. This ensures consistent band selection from ENVI display types (such as RGB, CIR, and pan) and supports integration of diverse data sources (such as MSI, panchromatic, and VNIR) without band mismatch.

Output Parameters


OUTPUT_VECTOR

Specify the output shapefile with the classified features.

Methods


Execute

Parameter

ParameterNames

See ENVI Help for details on these ENVITask methods.

Properties


DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

See the ENVITask topic in ENVI Help for details.

Version History


Deep Learning 3.0

Introduced

Deep Learning 4.0

Renamed from TensorFlowGridClassification task.

Added parameters: CUDA_DEVICE_ID, ENHANCE_DISPLAY, INPUT_METADATA, RUNTIME, and VISUAL_RGB.

See Also


TrainDeepLearningGridModel Task, DeepLearningOptimizedObjectClassification Task, DeepLearningOptimizedPixelClassification Task, DeepLearningObjectClassification Task, DeepLearningPixelClassification Task, BuildDeepLearningRaster Task