Sample Selection

Brief Description

Selects samples from a training vector data set.

Tags

Learning

Long Description

The application selects a set of samples from geometries intended for training (they should have a field giving the associated class).

First of all, the geometries must be analyzed by the PolygonClassStatistics application to compute statistics about the geometries, which are summarized in an xml file.
Then, this xml file must be given as input to this application (parameter instats).

The input support image and the input training vectors shall be given in parameters 'in' and 'vec' respectively. Only the sampling grid (origin, size, spacing)will be read in the input image.
There are several strategies to select samples (parameter strategy) :

- smallest (default) : select the same number of sample in each class so that the smallest one is fully sampled.
- constant : select the same number of samples N in each class (with N below or equal to the size of the smallest class).
- byclass : set the required number for each class manually, with an input CSV file (first column is class name, second one is the required samples number).

- percent: set a target global percentage of samples to use. Class proportions will be respected.

- total: set a target total number of samples to use. Class proportions will be respected.

There is also a choice on the sampling type to performs :

- periodic : select samples uniformly distributed
- random : select samples randomly distributed

Once the strategy and type are selected, the application outputs samples positions(parameter out).

The other parameters to look at are :

- layer : index specifying from which layer to pick geometries.
- field : set the field name containing the class.
- mask : an optional raster mask can be used to discard samples.
- outrates : allows outputting a CSV file that summarizes the sampling rates for each class.

As with the PolygonClassStatistics application, different types of geometry are supported : polygons, lines, points.
The behavior of this application is different for each type of geometry :

- polygon: select points whose center is inside the polygon
- lines : select points intersecting the line
- points : select closest point to the provided point

Parameters

Limitations

None

Authors

OTB-Team

See also

Example of use