This task uses a trained TensorFlow object detection model to perform inference on a raster in regions that contain features of interest identified by a grid model(patent pending). The output is an object shapefile of bounding boxes for each class, and a grid shapefile of areas containing objects detected.

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

Example


Use the trained grid model created with the TrainTensorFlowGridModeltask example and the trained object detection model created with the TensorFlowObjectClassification task example to perform optimized object classification. Tutorial files are located in the object_detection folder of ENVI Tutorial data that you previously downloaded.

; 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\ImageToClassify.dat'
Raster = e.OpenRaster(RasterURI)
 
; Select a trained Object Detection model
ObjectModelURI = 'C:\MyTutorialFiles\ObjectDetectionModel_HandicapSpots.h5'
ObjectModel = ENVITensorFlowObjectModel(ObjectModelURI)
 
; Select a trained Grid model
; Update the following line with the correct path
; to the model generated with documentation example
; TrainTensorFlowGridModel.
GridModelURI = 'C:\TrainTensorFlowGridExampleModel.h5'
GridModel = ENVITensorFlowGridModel(GridModelURI)
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('TensorFlowOptimizedObjectClassification')
 
; Select task inputs
Task.INPUT_RASTER = Raster
Task.INPUT_OBJECT_MODEL = ObjectModel
Task.INPUT_GRID_MODEL = GridModel
Task.OBJECT_CONFIDENCE_THRESHOLD = 0.8
Task.GRID_CONFIDENCE_THRESHOLD = 0.681
Task.IOU_THRESHOLD = 0.5
Task.OUTPUT_OBJECT_VECTOR_URI = e.GetTemporaryFilename('.shp', /CLEANUP_ON_EXIT)
Task.OUTPUT_GRID_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_OBJECT_VECTOR
e.Data.Add, Task.OUTPUT_GRID_VECTOR
 
; Display the result
View = e.GetView()
Layer1 = View.CreateLayer(Raster)
Layer2 = View.CreateLayer(Task.OUTPUT_GRID_VECTOR)
Layer3 = View.CreateLayer(Task.OUTPUT_OBJECT_VECTOR)
 
; Zoom in
View.Zoom, 1.334, /IN
 
; Go to a location were handicap spots were detected
view.GoToLocation, 3114577.1086, 1762493.9804, /MAP
end

Syntax


Result = ENVITask('TensorFlowOptimizedObjectClassification')

Input properties (Set, Get): GRID_CONFIDENCE_THRESHOLD, INPUT_RASTER, INPUT_GRID_MODEL, INPUT_OBJECT_MODEL, IOU_THRESHOLD, OBJECT_CONFIDENCE_THRESHOLD, OUTPUT_GRID_VECTOR_URI, OUTPUT_OBJECT_VECTOR_URI

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

GRID_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 will be used to classify features within the input raster.

INPUT_OBJECT_MODEL (required)

Specify a trained object detection model to classify features in grid detected cells.

IOU_THRESHOLD (optional)

(Non-Maximum Suppression Intersection Over Union) Specify the value to use to measure the overlap of a predicted versus actual bounding box for an object.

OBJECT_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.

OUTPUT_GRID_VECTOR (required)

This is a reference to the output grid vector. This is the output from the grid model providing the cells classified by the object detection model.

OUTPUT_GRID_VECTOR_URI (optional)

Specify a string with the fully-qualified path and filename for OUTPUT_GRID_VECTOR. This is a shape file containing rectangles in areas where one or more features are present.

OUTPUT_OBJECT_VECTOR (required)

This is a reference to the output object vector. This is the output from the object model containing the features that were detected.

OUTPUT_OBJECT_VECTOR_URI (optional)

Specify a string with the fully qualified filename and path of the associated OUTPUT_OBJECT_VECTOR. This is a shape file containing rectangles around detected objects.

Version History


Deep Learning 3.0

Introduced

See Also


TrainTensorFlowGridModel Task, TrainTensorFlowObjectModel Task