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).
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
[param] -in <string> Support image that will be classified. Mandatory: True. Default Value: ""
[param] -mask <string> Validity mask (only pixels corresponding to a mask value greater than 0 will be used for statistics). Mandatory: False. Default Value: ""
[param] -strategy.byclass.in <string> Number of samples by class (CSV format with class name in 1st column and required samples in the 2nd.. Mandatory: True. Default Value: ""
[group] -constant
[param] -strategy.constant.nb <int32> Number of samples for all classes. Mandatory: True. Default Value: "0"