Skip To Content

Train Support Vector Machine Classifier

Available with Spatial Analyst license.

Available with Image Analyst license.


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


  • The SVM classifier is a powerful 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 multiple-band 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 with the SVM classifier tool, as opposed to the maximum likelihood classification method:

    • The SVM classifier needs much 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.

  • To create the training sample file, use the Training Samples Manager from the Classification Tools.

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


TrainSupportVectorMachineClassifier (in_raster, in_training_features, out_classifier_definition, {in_additional_raster}, {max_samples_per_class}, {used_attributes})
ParameterExplanationData Type

The raster dataset to classify.

The preferred input is a 3-band, 8-bit segmented raster dataset, where 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

The training sample file or layer that delineates your training sites.

These can be either shapefiles or feature classes that contain your training samples. The following field names are required in the training sample file:

  • classname—A text field indicating the name of the class category.
  • classvalue—A long integer field containing the integer value for each class category.

Feature Layer

The output JSON file that contains attribute information, statistics, hyperplane vectors, and other information for the classifier. An .ecd file is created.


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

Raster Layer; Mosaic Layer; Image Service; String

The maximum number of samples to use for defining each class.

The default value of 500 is recommended when the inputs are nonsegmented rasters. A value that is less than or equal to 0 means that the system will use all the samples from the training sites to train the classifier.


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

  • COLORThe RGB color values are derived from the input raster, on a per-segment basis.
  • MEANThe average digital number (DN), derived from the optional pixel image, on a per-segment basis.
  • STDThe standard deviation, derived from the optional pixel image, on a per-segment basis.
  • COUNTThe number of pixels comprising 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, where 1 is a circle.
  • RECTANGULARITYThe degree to which the segment is rectangular, on a per-segment basis. The values range from 0 to 1, where 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 is included as an input with a segmented image, MEAN and STD are also available attributes.


Code sample

TrainSupportVectorClassifier example 1 (Python window)

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

import arcpy
from import *
    "c:/test/moncton_seg.tif", "c:/test/train.gdb/train_features",
    "c:/output/moncton_sig_SVM.ecd", "c:/test/moncton.tif", "10",
TrainSupportVectorClassifier example 2 (stand-alone script)

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

# Import system modules
import arcpy
from 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"

    inSegRaster, train_features, out_definition, 
    in_additional_raster, maxNumSamples, attributes)

Licensing information

  • Basic: Requires Spatial Analyst or Image Analyst
  • Standard: Requires Spatial Analyst or Image Analyst
  • Advanced: Requires Spatial Analyst or Image Analyst

Related topics