You can use a classification image to build a label raster for training a deep learning model. For example, you may already have a classification image that provides accurate locations of the features you are interested in. The classification image provides labeled pixel data that can be passed to a deep learning model to learn what the features look like.

All images used for training should have the same data type (byte) and range of data values. For better results, use the Build Deep Learning Raster tool with the same minimum and maximum pixel values for all images prior to using the Build Label Raster from Classification tool. Note that while the Build Label Raster from Classification tool will do this conversion for you when images are not of byte data type, it converts each image with its own minimum and maximum, which is not as optimal as a single minimum and maximum for all images.

You can also write a script to create a label raster from a classification image using the BuildLabelRasterFromClassification task.

For example, here is a multispectral input image of a residential area:

Here is a binary classification image created of the same geographic area that consists of a single "Rooftop" class, created from the ENVI Support Vector Machine classification tool:

The pixel values of the classification image consist of unique integers for each class. A value of 0 represents the background.

This tool normalizes each input raster individually. For multispectral rasters, it stretches the pixel values between the same minimum and maximum values across all bands.

Follow these steps for each raster and associated classification image:

  1. In the ENVI Toolbox, select Deep Learning > Pixel Segmentation > Build Label Raster from Classification. The Build Label Raster from Classification dialog appears.
  2. In the Input Raster field, select a training raster.
  3. In the Input Classification Raster field, select an ENVI classification image that provides labeled pixel data for the desired classes in the input training raster. The header file (.hdr) associated with the classification image must contain CLASS_NAMES and CLASS_COLORS fields. Also, the classification image must have the same dimensions as the input raster.
  4. In the Class Names field, enter the names of the classes from the input classification image, one per line. The output classification image will use these names.
  5. In the Output Raster field, select a location and filename for the output label raster (.dat). If the input raster is not byte data, then each band of the output raster will be stretched to its minimum and maximum value.
  6. Enable the Display result check box to display the output in the view when processing is complete.

  7. To reuse these task settings in future ENVI sessions, save them to a file. Click the down arrow next to the OK button and select Save Parameter Values, then specify the location and filename to save to. Note that some parameter types, such as rasters, vectors, and ROIs, will not be saved with the file. To apply the saved task settings, click the down arrow and select Restore Parameter Values, then select the file where you previously stored your settings.

  8. To run the process in the background, click the down arrow and select Run Task in the Background. If an ENVI Server has been set up on the network, the Run Task on remote ENVI Server name is also available. The ENVI Server Job Console will show the progress of the job and will provide a link to display the result when processing is complete. See the ENVI Servers topic in ENVI Help for more information.

  9. Click OK. When processing is complete, ENVI adds the label raster to the Data Manager. The label raster contains the original image bands plus an additional band called "Label Mask." The mask band indicates which pixels in the training raster correspond to the features of interest, with each feature represented by an integer (1 to the number of features). A value of 0 indicates the background.
  10. Pass the label raster to the Train TensorFlow Pixel Model tool. See the Train TensorFlow Pixel Models topic for instructions.

See Also

Build Label Rasters From ROIs