Skip to content

Training

tselea edited this page Dec 18, 2019 · 6 revisions

Training

Usage

Each training operation includes:

  • pre-processing - actions applied to the input data
  • model configuration - specify inputs and outputs, customize model training parameters

It is mandatory to prepare a training configuration YAML file, that sets the parameters for the training process.

The pre-processing steps includes:

  • tiling the image in smaller patches
  • standardise the pixel values based on Z-Score

Starting the training step (from the src directory):

python -m hugin.tools.cli train --config /path/to/training_config.yaml --keras-batch-size 5

The --config parameter is mandatory. This should be followed by the path to the training configuration file.
The --keras-batch-size is optional. If not present, the training batch size is set from the configuration file.

An example file can be found at hugin/etc/usecases/s2-forestry/train_unet_corine_gt.yaml.

Options on top of basic Hugin parameters:

  • data_pattern: Mandatory parameter. This is the regex pattern also available in Hugin 0.1.x that must match all the possible image types and ground truth (GT) images that should be included in the sampling. The regex should include named groups (?P<group_name>regex), in order to make the image name pattern easier to identify.
    Example: ''(?PT[0-9A-Z]+)(?P[A-Z0-9]+)(?P[A-Z0-9_a-z]+)(?P[0-9a-z]+)(?P[0-9]+)..*$''
    A match pattern is: T31UES_20180508T104031_B02_10m_4326.jp2
    region: T31UES
    timestamp: 20180508T104031
    type: B02
    res: 10m
  • include_classfication_layer: Optional parameter. Default value is False. If set to True, it enable loading a pre-trained model as initialization step, removing the original classification layer and replacing it to match the new classification parameters (e.g when we have a different number of classes).
  • z_scaler: Optional parameter. If present, it performes Z-score standardisation for each pixel with the provided values.
    Example:
z_scaler:
  B02-10m-4326:
      mean: 327.22765374622156
      std: 465.1138674711807

Explanation: for the pixels from the B02 band, apply Z-score using the mean 327.22765374622156 and standard deviation: 465.1138674711807

Clone this wiki locally