Train Support Vector Machine Classifier (Spatial Analyst)

Available with Spatial Analyst license.

Summary

Generates an Esri classifier definition file (.ecd) using the Support Vector Machine (SVM) classification definition.

Usage

  • The SVM classifier is a supervised classification method. It is well suited for segmented raster input but can also handle standard imagery. It is a classification method commonly used in the research community.

  • For standard image inputs, the tool accepts multiband imagery with any bit depth, and it will perform the SVM classification on a pixel basis, based on the input training feature file.

  • For segmented rasters that have their key property set to Segmented, the tool computes the index image and associated segment attributes from the RGB segmented raster. The attributes are computed to generate the classifier definition file to be used in a separate classification tool. The attributes for each segment can be computed from any Esri-supported image.

  • There are several advantages to using the SVM classifier rather than the maximum likelihood classification method:

    • The SVM classifier needs fewer samples and does not require the samples to be normally distributed.
    • It is less susceptible to noise, correlated bands, and an unbalanced number or size of training sites within each class.

  • Any Esri-supported raster is accepted as input, including raster products, segmented rasters, mosaics, image services, or generic raster datasets. Segmented rasters must be 8-bit rasters with 3 bands.

  • The Segment Attributes parameter is only active if one of the raster layer inputs is a segmented image.

Parameters

LabelExplanationData Type
Input Raster

The raster dataset to classify.

The preferred input is a 3-band, 8-bit segmented raster dataset in which all the pixels in the same segment have the same color. The input can also be a 1-band, 8-bit grayscale segmented raster. If no segmented raster is available, you can use any Esri-supported raster dataset.

Raster Layer; Mosaic Layer; Image Service; String
Output Classifier Definition File

The output JSON format file that will contain attribute information, statistics, hyperplane vectors, and other information for the classifier. An .ecd file will be created.

File
Additional Input Raster
(Optional)

Ancillary raster datasets, such as a multispectral image or a DEM, will be incorporated to generate attributes and other required information for classification. This parameter is optional.

Raster Layer; Mosaic Layer; Image Service; String
Segment Attributes Used
(Optional)

Specifies the attributes that will be included in the attribute table associated with the output raster.

  • COLORThe RGB color values will be derived from the input raster on a per-segment basis. This is also known as average chromaticity color.
  • MEANThe average digital number (DN) will be derived from the optional pixel image on a per-segment basis.
  • STDThe standard deviation will be derived from the optional pixel image on a per-segment basis.
  • COUNTThe number of pixels composing the segment, on a per-segment basis.
  • COMPACTNESSThe degree to which a segment is compact or circular, on a per-segment basis. The values range from 0 to 1, in which 1 is a circle.
  • RECTANGULARITYThe degree to which the segment is rectangular, on a per-segment basis. The values range from 0 to 1, in which 1 is a rectangle.
String
Dimension Value Field
(Optional)

Contains dimension values in the input training sample feature class.

This parameter is required to classify a time series of raster data using the change analysis raster output from the Analyze Changes Using CCDC tool in the Image Analyst toolbox.

Field

TrainSupportVectorMachineClassifier(in_raster, out_classifier_definition, {in_additional_raster}, {used_attributes}, {dimension_value_field})
NameExplanationData Type
in_raster

The raster dataset to classify.

The preferred input is a 3-band, 8-bit segmented raster dataset in which all the pixels in the same segment have the same color. The input can also be a 1-band, 8-bit grayscale segmented raster. If no segmented raster is available, you can use any Esri-supported raster dataset.

Raster Layer; Mosaic Layer; Image Service; String
out_classifier_definition

The output JSON format file that will contain attribute information, statistics, hyperplane vectors, and other information for the classifier. An .ecd file will be created.

File
in_additional_raster
(Optional)

Ancillary raster datasets, such as a multispectral image or a DEM, will be incorporated to generate attributes and other required information for classification. This parameter is optional.

Raster Layer; Mosaic Layer; Image Service; String
used_attributes
[used_attributes;used_attributes,...]
(Optional)

Specifies the attributes that will be included in the attribute table associated with the output raster.

  • COLORThe RGB color values will be derived from the input raster on a per-segment basis. This is also known as average chromaticity color.
  • MEANThe average digital number (DN) will be derived from the optional pixel image on a per-segment basis.
  • STDThe standard deviation will be derived from the optional pixel image on a per-segment basis.
  • COUNTThe number of pixels composing the segment, on a per-segment basis.
  • COMPACTNESSThe degree to which a segment is compact or circular, on a per-segment basis. The values range from 0 to 1, in which 1 is a circle.
  • RECTANGULARITYThe degree to which the segment is rectangular, on a per-segment basis. The values range from 0 to 1, in which 1 is a rectangle.

This parameter is only enabled if the Segmented key property is set to true on the input raster. If the only input to the tool is a segmented image, the default attributes are COLOR, COUNT, COMPACTNESS, and RECTANGULARITY. If an in_additional_raster value is included as an input with a segmented image, MEAN and STD are also available attributes.

String
dimension_value_field
(Optional)

Contains dimension values in the input training sample feature class.

This parameter is required to classify a time series of raster data using the change analysis raster output from the Analyze Changes Using CCDC tool in the Image Analyst toolbox.

Field

Code sample

TrainSupportVectorMachineClassifier example 1 (Python window)

This Python example uses the SVM classifier to classify a segmented raster.

import arcpy
from arcpy.sa import *

arcpy.gp.TrainSupportVectorMachineClassifier(
    "c:/test/moncton_seg.tif", "c:/test/train.gdb/train_features",
    "c:/output/moncton_sig_SVM.ecd", "c:/test/moncton.tif", "10",
    "COLOR;MEAN;STD;COUNT;COMPACTNESS;RECTANGULARITY")
TrainSupportVectorMachineClassifier example 2 (stand-alone script)

This Python script uses the SVM classifier to classify a segmented raster.

# Import system modules
import arcpy
from arcpy.sa import *


# Set local variables
inSegRaster = "c:/test/moncton_seg.tif"
train_features = "c:/test/train.gdb/train_features"
out_definition = "c:/output/moncton_sig.ecd"
in_additional_raster = "c:/moncton.tif"
maxNumSamples = "10"
attributes = "COLOR;MEAN;STD;COUNT;COMPACTNESS;RECTANGULARITY"

#Execute
arcpy.gp.TrainSupportVectorMachineClassifier(
    inSegRaster, train_features, out_definition, 
    in_additional_raster, maxNumSamples, attributes)
TrainSupportVectorMachineClassifier example 3 (stand-alone script)

This Python script uses the SVM classifier to classify a time series multidimensional raster using the output from the Analyze Changes Using CCDC tool.

# Import system modules
import arcpy
from arcpy.sa import *

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")


# Set local variables
in_changeAnalysisRaster = "c:/test/LandsatCCDC.crf"
train_features = "c:/test/train.gdb/train_features"
out_definition = "c:/output/change_detection.ecd"
additional_raster = ''
attributes = None
dimension_field = "DateTime"

# Execute
arcpy.sa.TrainSupportVectorMachineClassifier(
    in_changeAnalysisRaster, train_features, out_definition, 
	additional_raster, attributes, dimension_field)

Related topics