Segmentation YAML References
  • 21 Dec 2022
  • 2 Minutes to read
  • Dark
    Light
  • PDF

Segmentation YAML References

  • Dark
    Light
  • PDF

Article summary

Segmentation training jobs use the keys listed in the table below.

YAML KeyDescription
datasetThe dataset that the job is dependent on
trainModel training hyperparameters
modelClassification model and parameters
lossLoss function to use
evalParameters for evaluation
monitor_metricMetrics to monitor
metricsMonitoring metrics for the job

dataset

The following parameters can be used to load datasets.

train_split_key

  • Type: String
  • Default: Train
  • Choices: train/test/dev
  • Description: The name given to the data split that will be used for training.

test_split_key

  • Type: String
  • Default: dev
  • Choices: train/test/dev
  • Description: The name given to the data split that will be used for testing.

val_split_key

  • Type: String
  • Default: dev
  • Choices: train/test/dev
  • Description: The name given to the data split that will be used for validation.

train

The following parameters can be used to define model hyperparameters.

batch_size

  • Type: Integer
  • Default: 8
  • Value Range: 1 <= batch_size
  • Description: Number of examples/images in each training batch. The minimum batch size is 1.

epoch

  • Type: Integer
  • Default: 200
  • Value Range: 1 <= epoch <=1000
  • Description: The number of epochs to train the model. If you turn on early stopping, the actual training epoch may be smaller.

learning_rate

  • Type: Float
  • Default: 0.0001
  • Value Range: 0 < learning_rate < 1.0
  • Description: The learning rate used to update the weights.

validation_run_freq

  • Type: Integer
  • Default: 1
  • ValueRange: 1 <= validation_run_freq
  • Description: Number of epochs between validation runs.

early_stop

  • Type: Object
  • Description: Configuration for stopping training when a monitored metric has stopped improving.
  • Properties:
    • min_delta
      • Type: Float
      • Default: 0.01
      • Description: Minimum change in the monitored quantity to qualify as an improvement.
    • min_epochs
      • Type: Integer
      • Default: 40
      • Description: Number of epochs with no improvement after which training will be stopped.

auto_tuning

  • Type: Object
  • Description: Configuration for automated hyperparameter tuning.
  • Properties:
    • class_weights
      • Type: Boolean
      • Default: True
      • Description: Whether to use automated class weight tuning with pixel counts in the train and valid splits.
    • class_weights_method
      • Type: Integer
      • Default: 0
      • Choices: 0, 1, 2
      • Description: Which method to use to tune class weights
        debug
      • Type: Boolean
      • Default: False
      • Description: Whether to turn on the debug mode of auto-tuning process.

model

The following parameters can be used to specify which Segmentation model to use.

avi

  • Type: Object
  • Description: Specifies the python library from where the model is implemented.
  • Properties:
    • Unet:
      • Type: Object
      • Description: The UNet parser class.
    • Properties:
      • backbone_name
        • Type: string
          • Default: ResNet34
        • Choices:
          • ResNet18
            • ResNet34
            • ResNet50
          • Description: The backbone to use in RetinaNet.
      • output_depth
        • Type: integer
        • Value Range: 1 <= output_depth
        • Description: The number of classes. Number of defective class plus OK class.
      • input_shape
        • Type: Array
        • Description: Shape of the images.
      • Items:
        • item_1
          • Default: 512
            • Value Range: 1 <= item_1 <= 1024
            • Multiply of: 32
            • Description: Height of the image.
        • item_2
          • Default: 512
            • ValueRange: 1 <= item_2 <= 1024
            • Multiply of: 32
            • Description: Width of the image.
        • item_3
          • Default: 3
            • Value Range: 1 <= item_3 <= 4
            • Description: This is the channels of the image (1 for grayscale, 2 for grayscale + alpha, 3 for RGB, 4 for RGB + alpha).
        • activation
          • Type: String
          • Default: Softmax
          • Choices:
            • Softmax
            • Sigmoid
          • ValueRange: 0 <= nms_threshold <= 1
          • Description: Last layer activation function.
        • encoder_weights
          • Type: String | Null
          • Default: Imagenet
          • Choices:
            • null
            • imagenet
          • Description: Load imagenet pre-trained weights to the backbone or randomly
            decoder_block_type.
          • Type: String
          • Default: Transpose
          • Choices:
            • Transpose
            • Upsampling
          • Descriptions: Type of the decoder block type in segmentation models repo.

loss

The following parameters specify the loss functions to use for the Classification and regression head of the model.

CategoricalCrossEntropy

  • Type: Object
  • Description: CategoricalCrossEntropy
  • Properties:
    • weights
      • Type: Union[float, array[float]]
      • Default: 7.0
      • Value Range: 0 <= weights
      • Description: Weights to apply to each label in the loss function.
      • Item Type: float
    • from_logits
      • Type: Boolean
      • Default: false
      • Description: Whether the loss is computed from the logits of the network or from sigmoid activations.

BinaryCrossEntropy

  • Type: Object
  • Description: CategoricalCrossEntropy
  • Properties:
    • weights
      • Type: Union[float, array[float]]
      • Default: 7.0
      • Value Range: 0 <= weights
      • Description: Weights to apply to each label in the loss function.
      • Item Type: float
    • from_logits
      • Type: Boolean
      • Default: False
      • Description: Whether the loss is computed from the logits of the network or from sigmoid activations.

eval

The following parameters can be used in the evaluation phase:

postprocessing

  • Type: Object
  • Description: The configuration for post-processing steps.
  • Properties:
    • output_type
      • Type: String
      • Default: Segmentation
      • Choices:
        • Classification
        • Segmentation
      • Description: The kind of output after preprocessing
    • iou_threshold
      • Type: float
      • Default: 0.5
      • Value Range: 0 <= iou_threshold <= 1
      • Description: The IoU threshold to determine True Positive and False Positive.
    • transforms
      • Type: array | null
      • Items:
        • Type: Post-processing transforms
      • Description: The transformations to apply in post-processing steps to both ground truth and prediction.
    • gt_transforms
      • Type: array | null
      • Items:
        • Type: Post-processing transforms
      • Description: The transformations to apply in post-processing steps to ground truth only.
        pred_transforms
      • Type: array | null
      • Items:
        • Type: Post-processing transforms
        • Description: The transformations to apply in post-processing steps to prediction only.

Was this article helpful?

What's Next