Amazon SageMaker
Developer Guide

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

Semantic Segmentation Hyperparameters

The following tables list the hyperparameters supported by the Amazon SageMaker semantic segmentation algorithm for network architecture, data inputs, and training. You specify Semantic Segmentation for training in the AlgorithmName of the CreateTrainingJob request.

Network Architecture Hyperparameters

Parameter Name Description
backbone

The backbone to use for the algorithm's encoder component.

Optional

Valid values: resnet-50, resnet-101

Default value: resnet-50

use_pretrained_model

Whether a pretrained model is to be used for the backbone.

Optional

Valid values: True, False

Default value: True

algorithm

The algorithm to use for semantic segmentation.

Optional

Valid values:

Default value: fcn

Data Hyperparameters

Parameter Name Description
num_classes

The number of classes to segment.

Required

Valid values: 2 ≤ positive integer ≤ 254

num_training_samples

The number of samples in the training data. The algorithm uses this value to set up the learning rate scheduler.

Required

Valid values: positive integer

crop_size

The image size for input images. We rescale the input image to a square image to this crop_size. We do this by rescaling the shorter side to match this parameter while maintaining the aspect ratio, and then take a random crop along the longer side.

Optional

Valid values: positive integer > 16

Default value: 480

Training Hyperparameters

Parameter Name Description
early_stopping

Whether to use early stopping logic during training.

Optional

Valid values: True, False

Default value: False

early_stopping_min_epochs

The minimum number of epochs that must be run.

Optional

Valid values: integer

Default value: 5

early_stopping_patience

The number of epochs that meet the tolerance for lower performance before the algorithm enforces an early stop.

Optional

Valid values: integer

Default value: 4

early_stopping_tolerance

If the relative improvement of the score of the training job, the mIOU, is smaller than this value, early stopping considers the epoch as not improved. This is used only when early_stopping = True.

Optional

Valid values: 0 ≤ float ≤ 1

Default value: 0.0

epochs

The number of epochs with which to train.

Optional

Valid values: positive integer

Default value: 30

gamma1

The decay factor for the moving average of the squared gradient for rmsprop. Used only for rmsprop.

Optional

Valid values: 0 ≤ float ≤ 1

Default value: 0.9

gamma2

The momentum factor for rmsprop.

Optional

Valid values: 0 ≤ float ≤ 1

Default value: 0.9

learning_rate

The initial learning rate.

Optional

Valid values: 0 < float ≤ 1

Default value: 0.001

lr_scheduler

The shape of the learning rate schedule that controls its decrease over time.

Optional

Valid values:

  • step: A stepwise decay, where the learning rate is reduced by a factor at certain intervals.

  • poly: A smooth decay using a polynomial function.

  • cosine: A smooth decay using a cosine function.

Default value: poly

mini_batch_size

The batch size for training. Using a large mini_batch_size usually results in faster training, but it might cause you to run out of memory. Memory usage is affected by the values of the mini_batch_size and image_shape parameters, and the backbone architecture.

Optional

Valid values: positive integer

Default value: 4

momentum

The momentum for the sgd optimizer. When you use other optimizers, the semantic segmentation algorithm ignores this parameter.

Optional

Valid values: 0 < float ≤ 1

Default value: 0.9

optimizer

The type of optimizer. For more information about an optimizer, choose the appropriate link:

Optional

Valid values: adam, adagrad, nag, rmsprop, sgd

Default value: sgd

validation_mini_batch_size

The batch size for validation. A large mini_batch_size usually results in faster training, but it might cause you to run out of memory. Memory usage is affected by the values of the mini_batch_size and image_shape parameters, and the backbone architecture.

  • To score the validation on the entire image without cropping the images, set this parameter to 1. Use this option if you want to measure performance on the entire image as a whole.

    Note

    Setting the validation_mini_batch_size parameter to 1 causes the algorithm to create a new network model for every image. This might slow validation and training.

  • To crop images to the size specified in the crop_size parameter, even during evaluation, set this parameter to a value greater than 1.

Optional

Valid values: positive integer

Default value: 4

weight_decay

The weight decay coefficient for the sgd optimizer. When you use other optimizers, the algorithm ignores this parameter.

Optional

Valid values: 0 < float < 1

Default value: 0.0001