This task uses a trained Deep Learning ONNX model to perform pixel segmentation classification on a raster. The result is a classification image, with an optional output of a class activation raster whose pixel values represent the probability (0 to 1) of matching the feature of interest. If necessary, this task will convert a raster into an ENVIDeepLearningRaster for classification. To avoid having to convert the same input raster again, use the BuildDeepLearningRaster task once to convert it to an ENVIDeepLearningRaster.
Example
e = ENVI()
RasterFile = "RasterToClassify.dat"
Raster = e.OpenRaster(RasterFile)
ModelFile = 'pixelModel.envi.onnx'
Model = ENVIDeepLearningOnnxModel(ModelFile)
Task = ENVITask('DeepLearningPixelClassification')
Task.INPUT_RASTER = Raster
Task.INPUT_MODEL = Model
Task.OUTPUT_CLASSIFICATION_RASTER_URI = e.GetTemporaryFilename('.dat', /CLEANUP_ON_EXIT)
Task.OUTPUT_CLASS_ACTIVATION_RASTER_URI = e.GetTemporaryFilename('.dat', /CLEANUP_ON_EXIT)
Task.Execute
ClassificationRaster = Task.OUTPUT_CLASSIFICATION_RASTER
ActivationRaster = Task.OUTPUT_CLASS_ACTIVATION_RASTER
e.Data.Add, Raster
e.Data.Add, ClassificationRaster
e.Data.Add, ActivationRaster
View = e.GetView()
Layer1 = View.CreateLayer(Raster)
Layer2 = View.CreateLayer(ClassificationRaster)
Layer3 = View.CreateLayer(ActivationRaster)
Syntax
Result = ENVITask('DeepLearningPixelClassification')
Input parameters (Set, Get): CUDA_DEVICE_ID, ENHANCE_DISPLAY, INPUT_METADATA, INPUT_MODEL, INPUT_RASTER, OUTPUT_CLASS_ACTIVATION_RASTER_URI, OUTPUT_CLASSIFICATION_RASTER_URI, RUNTIME, VISUAL_RGB
Output parameters (Get only): OUTPUT_CLASS_ACTIVATION_RASTER, OUTPUT_CLASSIFICATION_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.
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.
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) to use for pixel-level classification of the INPUT_RASTER. The model must be compatible with the task requirements and capable of assigning accurate labels to individual pixels within the raster.
INPUT_RASTER (required)
Specify the raster to classify.
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 parameter, the class activation raster will not be created. You must set this parameter or the OUTPUT_CLASSIFICATION_RASTER_URI parameter. You can also set both.
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 parameter, the classification raster will not be created. You must set this parameter or the OUTPUT_CLASS_ACTIVATION_RASTER_URI parameter. You can also set both.
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_CLASS_ACTIVATION_RASTER
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_CLASSIFICATION_RASTER
This is a reference to the output classification raster of filetype ENVI. It is a single-band raster whose values range from 0 to the number of classes.
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
|
Renamed from TensorFlowMaskClassification task.
|
|
Deep Learning 4.0
|
Renamed from TensorFlowPixelClassification task.
Added parameters: CUDA_DEVICE_ID, ENHANCE_DISPLAY, INPUT_METADATA, RUNTIME, and VISUAL_RGB.
|
See Also
BuildLabelRasterFromROI Task, BuildLabelRasterFromClassification Task, TrainDeepLearningPixelModel Task, DeepLearningGridClassification Task, DeepLearningObjectClassification Task, DeepLearningOptimizedPixelClassification Task, BuildDeepLearningRaster Task