pksvm(1)

NAME
pksvm - classify raster image using Support Vector Machine

SYNOPSIS
\FCpksvm\F[]
\FC-t\F[] training [\FC-i\F[] input] [\FC-o\F[] output] [\FC-cv\F[] value] [options] [advanced options]

DESCRIPTION
pksvm implements a support vector machine (SVM) to solve a supervised classification problem. The implementation is based on the open source C++ library libSVM (http://www.csie.ntu.edu.tw/~cjlin/libsvm). Both raster and vector files are supported as input. The output will contain the classification result, either in raster or vector format, corresponding to the format of the input. A training sample must be provided as an OGR vector dataset that contains the class labels and the features for each training point. The point locations are not considered in the training step. You can use the same training sample for classifying different images, provided the number of bands of the images are identical. Use the utility pkextract to create a suitable training sample, based on a sample of points or polygons. For raster output maps you can attach a color table using the option \FC-ct\F[].

OPTIONS

\FC-t\F[] filename, \FC--training\F[] filename
    Training vector file. A single vector file contains all training features (must be set as: b0, b1, b2,...) for all classes (class numbers identified by label option). Use multiple training files for bootstrap aggregation (alternative to the \FC--bag\F[] and \FC--bagsize\F[] options, where a random subset is taken from a single training file)

\FC-i\F[] filename, \FC--input\F[] filename
    input image

\FC-o\F[] filename, \FC--output\F[] filename
    Output classification image

\FC-cv\F[] value, \FC--cv\F[] value
    N-fold cross validation mode (default: 0)

\FC-tln\F[] layer, \FC--tln\F[] layer
    Training layer name(s)

\FC-c\F[] name, \FC--class\F[] name
    List of class names.

\FC-r\F[] value, \FC--reclass\F[] value
    List of class values (use same order as in \FC--class\F[] option).

\FC-of\F[] GDALformat, \FC--oformat\F[] GDALformat
    Output image format (see also gdal_translate(1)).

\FC-f\F[] format, \FC--f\F[] format
    Output ogr format for active training sample

\FC-co\F[] NAME=VALUE, \FC--co\F[] NAME=VALUE
    Creation option for output file. Multiple options can be specified.

\FC-ct\F[] filename, \FC--ct\F[] filename
    Color table in ASCII format having 5 columns: id R G B ALFA (0: transparent, 255: solid)

\FC-label\F[] attribute, \FC--label\F[] attribute
    Identifier for class label in training vector file. (default: label)

\FC-prior\F[] value, \FC--prior\F[] value
    Prior probabilities for each class (e.g., \FC-prior\F[] 0.3 \FC-prior\F[] 0.3 \FC-prior\F[] 0.2) Used for input only (ignored for cross validation)

\FC-g\F[] gamma, \FC--gamma\F[] gamma
    Gamma in kernel function

\FC-cc\F[] cost, \FC--ccost\F[] cost
    The parameter C of C_SVC, epsilon_SVR, and nu_SVR

\FC-m\F[] filename, \FC--mask\F[] filename
    Only classify within specified mask (vector or raster). For raster mask, set nodata values with the option \FC--msknodata\F[].

\FC-msknodata\F[] value, \FC--msknodata\F[] value
    Mask value(s) not to consider for classification. Values will be taken over in classification image.

\FC-nodata\F[] value, \FC--nodata\F[] value
    Nodata value to put where image is masked as nodata

\FC-v\F[] level, \FC--verbose\F[] level
    Verbose level

Advanced options

\FC-b\F[] band, \FC--band\F[] band
    Band index (starting from 0, either use \FC--band\F[] option or use \FC--startband\F[] to \FC--endband\F[])

\FC-sband\F[] band, \FC--startband\F[] band
    Start band sequence number

\FC-eband\F[] band, \FC--endband\F[] band
    End band sequence number

\FC-bal\F[] size, \FC--balance\F[] size
    Balance the input data to this number of samples for each class

\FC-min\F[] number, \FC--min\F[] number
    If number of training pixels is less then min, do not take this class into account (0: consider all classes)

\FC-bag\F[] value, \FC--bag\F[] value
    Number of bootstrap aggregations (default is no bagging: 1)

\FC-bagsize\F[] value, \FC--bagsize\F[] value
    Percentage of features used from available training features for each bootstrap aggregation (one size for all classes, or a different size for each class respectively

\FC-comb\F[] rule, \FC--comb\F[] rule
    How to combine bootstrap aggregation classifiers (0: sum rule, 1: product rule, 2: max rule). Also used to aggregate classes with rc option.

\FC-cb\F[] filename, \FC--classbag\F[] filename
    Output for each individual bootstrap aggregation

\FC-prob\F[] filename, \FC--prob\F[] filename
    Probability image.

\FC-offset\F[] value, \FC--offset\F[] value
    Offset value for each spectral band input features: \FCrefl[band]=(DN[band]-offset[band])/scale[band]\F[]

\FC-scale\F[] value, \FC--scale\F[] value
    Scale value for each spectral band input features: \FCrefl=(DN[band]-offset[band])/scale[band]\F[] (use \FC0\F[] if scale min and max in each band to \FC-1.0\F[] and \FC1.0\F[])

\FC-svmt\F[] type, \FC--svmtype\F[] type
    Type of SVM (C_SVC, nu_SVC,one_class, epsilon_SVR, nu_SVR)

\FC-kt\F[] type, \FC--kerneltype\F[] type
    Type of kernel function (linear,polynomial,radial,sigmoid)

\FC-kd\F[] value, \FC--kd\F[] value
    Degree in kernel function

\FC-c0\F[] value, \FC--coef0\F[] value
    Coef0 in kernel function

\FC-nu\F[] value, \FC--nu\F[] value
    The parameter nu of nu-SVC, one-class SVM, and nu-SVR

\FC-eloss\F[] value, \FC--eloss\F[] value
    The epsilon in loss function of epsilon-SVR

\FC-cache\F[] number, \FC--cache\F[] number
    memory size in MB (default: 100)

\FC-etol\F[] value, \FC--etol\F[] value
    the tolerance of termination criterion (default: 0.001)

\FC-shrink\F[], \FC--shrink\F[]
    Whether to use the shrinking heuristics

\FC-na\F[] number, \FC--nactive\F[] number
    Number of active training points

EXAMPLE
Classify input image input.tif with a support vector machine. A training sample that is provided as an OGR vector dataset. It contains all features (same dimensionality as input.tif) in its fields (please check pkextract(1) on how to obtain such a file from a "clean" vector file containing locations only). A two-fold cross validation (cv) is performed (output on screen). The parameters cost and gamma of the support vector machine are set to 1000 and 0.1 respectively. A colourtable (a five column text file: image value, RED, GREEN, BLUE, ALPHA) has also been provided.

\FC
pksvm -i input.tif -t training.sqlite -o output.tif -cv 2 -ct colourtable.txt -cc 1000 -g 0.1
      \F[]

Classification using bootstrap aggregation. The training sample is randomly split in three subsamples (33% of the original sample each).

\FC
pksvm -i input.tif -t training.sqlite -o output.tif -bs 33 -bag 3
      \F[]

Classification using prior probabilities for each class. The priors are automatically normalized. The order in which the options \FC-p\F[] are provide should respect the alphanumeric order of the class names (class 10 comes before 2...)

\FC
pksvm -i input.tif -t training.sqlite -o output.tif -p 1 -p 1 -p 1 -p 1 -p 1 -p 1 -p 1 -p 1 -p 1 -p 1 -p 1 -p 0.2 -p 1 -p 1 -p 1
      \F[]