| pktools 2.6.7 Processing Kernel for geospatial data

pkannogr

classify vector dataset using Artificial Neural Network

## SYNOPSIS

`Usage: pkannogr -t training [-i input -o output] [-cv value]`

``

`Options: [-tln layer]* [-c name -r value]* [-of GDALformat|-f OGRformat] [-co NAME=VALUE]* [-ct filename] [-label attribute] [-prior value]* [-nn number]* [-m filename ] [-nodata value]`

`Advanced options: [-b band] [-sband band -eband band]* [-bal size]* [-min] [-bag value] [-bs value] [-comb rule] [-cb filename] [-pim priorimage] [–offset value] [–scale value] [–connection 0|1] [-w weights]* [–learning rate] [–maxit number]`

# Description

The utility pkannogr implements an artificial neural network (ANN) to solve a supervised classification problem. The implementation is based on the open source C++ library fann). 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 -ct.

# Options

- use either `-short` or `--long` options (both `--long=value` and `--long value` are supported)
- short option `-h` shows basic options only, long option `--help` shows all options

  short | long | type | default | description
  --- | --- | --- | --- | ---
  i | input | std::string |  | input image
  t | training | std::string |  | 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 bag and bsize options, where a random subset is taken from a single training file)
  tln | tln | std::string |  | training layer name(s)
  label | label | std::string | label | identifier for class label in training vector file.
  bal | balance | unsigned int | 0 | balance the input data to this number of samples for each class
  min | min | int | 0 | if number of training pixels is less then min, do not take this class into account (0: consider all classes)
  b | band | short |  | band index (starting from 0, either use band option or use start to end)
  sband | startband | unsigned short |  | Start band sequence number
  eband | endband | unsigned short |  | End band sequence number
  | offset | double | 0 | offset value for each spectral band input features: refl[band]=(DN[band]-offset[band])/scale[band]
  scale | scale | double | 0 | scale value for each spectral band input features: refl=(DN[band]-offset[band])/scale[band] (use 0 if scale min and max in each band to -1.0 and 1.0)
  a | aggreg | unsigned short | 1 | how to combine aggregated classifiers, see also rc option (1: sum rule, 2: max rule).
  prior | prior | double | 0 | prior probabilities for each class (e.g., -p 0.3 -p 0.3 -p 0.2 )
  pim | priorimg | std::string |  | prior probability image (multi-band img with band for each class
  cv | cv | unsigned short | 0 | n-fold cross validation mode
  cmf | cmf | std::string | ascii | Format for confusion matrix (ascii or latex)
  nn | nneuron | unsigned int | 5 | number of neurons in hidden layers in neural network (multiple hidden layers are set by defining multiple number of neurons: -n 15 -n 1, default is one hidden layer with 5 neurons)
  | connection | float | 1 | connection reate (default: 1.0 for a fully connected network)
  w | weights | float | 0 | weights for neural network. Apply to fully connected network only, starting from first input neuron to last output neuron, including the bias neurons (last neuron in each but last layer)
  l | learning | float | 0.7 | learning rate (default: 0.7)
  | maxit | unsigned int | 500 | number of maximum iterations (epoch) (default: 500)
  comb | comb | unsigned short | 0 | how to combine bootstrap aggregation classifiers (0: sum rule, 1: product rule, 2: max rule). Also used to aggregate classes with rc option. Default is sum rule (0)
  bag | bag | unsigned short | 1 | Number of bootstrap aggregations (default is no bagging: 1)
  bs | bsize | int | 100 | 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
  cb | classbag | std::string |  | output for each individual bootstrap aggregation (default is blank)
  m | mask | std::string |  | Only classify within specified mask (vector or raster).
  nodata | nodata | unsigned short | 0 | nodata value to put where image is masked as nodata
  o | output | std::string |  | output classification image
  ot | otype | std::string |  | Data type for output image ({Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/CInt16/CInt32/CFloat32/CFloat64}). Empty string: inherit type from input image
  ct | ct | std::string |  | colour table in ASCII format having 5 columns: id R G B ALFA (0: transparent, 255: solid)
  co | co | std::string |  | Creation option for output file. Multiple options can be specified.
  f | f | std::string | SQLite | Output ogr format for active training sample
  na | nactive | unsigned int | 1 | number of active training points
  c | class | std::string |  | list of class names.
  r | reclass | short |  | list of class values (use same order as in class opt).

Usage: pkannogr -t training [-i input -o output] [-cv value]

# Examples