Class ImageModelSettings

  • Direct Known Subclasses:
    ImageModelSettingsClassification, ImageModelSettingsObjectDetection

    public class ImageModelSettings
    extends Object
    Settings used for training the model. For more information on the available settings please visit the official documentation: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models.
    • Constructor Detail

      • ImageModelSettings

        public ImageModelSettings()
    • Method Detail

      • advancedSettings

        public String advancedSettings()
        Get the advancedSettings property: Settings for advanced scenarios.
        Returns:
        the advancedSettings value.
      • withAdvancedSettings

        public ImageModelSettings withAdvancedSettings​(String advancedSettings)
        Set the advancedSettings property: Settings for advanced scenarios.
        Parameters:
        advancedSettings - the advancedSettings value to set.
        Returns:
        the ImageModelSettings object itself.
      • amsGradient

        public Boolean amsGradient()
        Get the amsGradient property: Enable AMSGrad when optimizer is 'adam' or 'adamw'.
        Returns:
        the amsGradient value.
      • withAmsGradient

        public ImageModelSettings withAmsGradient​(Boolean amsGradient)
        Set the amsGradient property: Enable AMSGrad when optimizer is 'adam' or 'adamw'.
        Parameters:
        amsGradient - the amsGradient value to set.
        Returns:
        the ImageModelSettings object itself.
      • augmentations

        public String augmentations()
        Get the augmentations property: Settings for using Augmentations.
        Returns:
        the augmentations value.
      • withAugmentations

        public ImageModelSettings withAugmentations​(String augmentations)
        Set the augmentations property: Settings for using Augmentations.
        Parameters:
        augmentations - the augmentations value to set.
        Returns:
        the ImageModelSettings object itself.
      • beta1

        public Float beta1()
        Get the beta1 property: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1].
        Returns:
        the beta1 value.
      • withBeta1

        public ImageModelSettings withBeta1​(Float beta1)
        Set the beta1 property: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1].
        Parameters:
        beta1 - the beta1 value to set.
        Returns:
        the ImageModelSettings object itself.
      • beta2

        public Float beta2()
        Get the beta2 property: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1].
        Returns:
        the beta2 value.
      • withBeta2

        public ImageModelSettings withBeta2​(Float beta2)
        Set the beta2 property: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1].
        Parameters:
        beta2 - the beta2 value to set.
        Returns:
        the ImageModelSettings object itself.
      • checkpointDatasetId

        public String checkpointDatasetId()
        Get the checkpointDatasetId property: FileDataset id for pretrained checkpoint(s) for incremental training. Make sure to pass CheckpointFilename along with CheckpointDatasetId.
        Returns:
        the checkpointDatasetId value.
      • withCheckpointDatasetId

        public ImageModelSettings withCheckpointDatasetId​(String checkpointDatasetId)
        Set the checkpointDatasetId property: FileDataset id for pretrained checkpoint(s) for incremental training. Make sure to pass CheckpointFilename along with CheckpointDatasetId.
        Parameters:
        checkpointDatasetId - the checkpointDatasetId value to set.
        Returns:
        the ImageModelSettings object itself.
      • checkpointFilename

        public String checkpointFilename()
        Get the checkpointFilename property: The pretrained checkpoint filename in FileDataset for incremental training. Make sure to pass CheckpointDatasetId along with CheckpointFilename.
        Returns:
        the checkpointFilename value.
      • withCheckpointFilename

        public ImageModelSettings withCheckpointFilename​(String checkpointFilename)
        Set the checkpointFilename property: The pretrained checkpoint filename in FileDataset for incremental training. Make sure to pass CheckpointDatasetId along with CheckpointFilename.
        Parameters:
        checkpointFilename - the checkpointFilename value to set.
        Returns:
        the ImageModelSettings object itself.
      • checkpointFrequency

        public Integer checkpointFrequency()
        Get the checkpointFrequency property: Frequency to store model checkpoints. Must be a positive integer.
        Returns:
        the checkpointFrequency value.
      • withCheckpointFrequency

        public ImageModelSettings withCheckpointFrequency​(Integer checkpointFrequency)
        Set the checkpointFrequency property: Frequency to store model checkpoints. Must be a positive integer.
        Parameters:
        checkpointFrequency - the checkpointFrequency value to set.
        Returns:
        the ImageModelSettings object itself.
      • checkpointRunId

        public String checkpointRunId()
        Get the checkpointRunId property: The id of a previous run that has a pretrained checkpoint for incremental training.
        Returns:
        the checkpointRunId value.
      • withCheckpointRunId

        public ImageModelSettings withCheckpointRunId​(String checkpointRunId)
        Set the checkpointRunId property: The id of a previous run that has a pretrained checkpoint for incremental training.
        Parameters:
        checkpointRunId - the checkpointRunId value to set.
        Returns:
        the ImageModelSettings object itself.
      • distributed

        public Boolean distributed()
        Get the distributed property: Whether to use distributed training.
        Returns:
        the distributed value.
      • withDistributed

        public ImageModelSettings withDistributed​(Boolean distributed)
        Set the distributed property: Whether to use distributed training.
        Parameters:
        distributed - the distributed value to set.
        Returns:
        the ImageModelSettings object itself.
      • earlyStopping

        public Boolean earlyStopping()
        Get the earlyStopping property: Enable early stopping logic during training.
        Returns:
        the earlyStopping value.
      • withEarlyStopping

        public ImageModelSettings withEarlyStopping​(Boolean earlyStopping)
        Set the earlyStopping property: Enable early stopping logic during training.
        Parameters:
        earlyStopping - the earlyStopping value to set.
        Returns:
        the ImageModelSettings object itself.
      • earlyStoppingDelay

        public Integer earlyStoppingDelay()
        Get the earlyStoppingDelay property: Minimum number of epochs or validation evaluations to wait before primary metric improvement is tracked for early stopping. Must be a positive integer.
        Returns:
        the earlyStoppingDelay value.
      • withEarlyStoppingDelay

        public ImageModelSettings withEarlyStoppingDelay​(Integer earlyStoppingDelay)
        Set the earlyStoppingDelay property: Minimum number of epochs or validation evaluations to wait before primary metric improvement is tracked for early stopping. Must be a positive integer.
        Parameters:
        earlyStoppingDelay - the earlyStoppingDelay value to set.
        Returns:
        the ImageModelSettings object itself.
      • earlyStoppingPatience

        public Integer earlyStoppingPatience()
        Get the earlyStoppingPatience property: Minimum number of epochs or validation evaluations with no primary metric improvement before the run is stopped. Must be a positive integer.
        Returns:
        the earlyStoppingPatience value.
      • withEarlyStoppingPatience

        public ImageModelSettings withEarlyStoppingPatience​(Integer earlyStoppingPatience)
        Set the earlyStoppingPatience property: Minimum number of epochs or validation evaluations with no primary metric improvement before the run is stopped. Must be a positive integer.
        Parameters:
        earlyStoppingPatience - the earlyStoppingPatience value to set.
        Returns:
        the ImageModelSettings object itself.
      • enableOnnxNormalization

        public Boolean enableOnnxNormalization()
        Get the enableOnnxNormalization property: Enable normalization when exporting ONNX model.
        Returns:
        the enableOnnxNormalization value.
      • withEnableOnnxNormalization

        public ImageModelSettings withEnableOnnxNormalization​(Boolean enableOnnxNormalization)
        Set the enableOnnxNormalization property: Enable normalization when exporting ONNX model.
        Parameters:
        enableOnnxNormalization - the enableOnnxNormalization value to set.
        Returns:
        the ImageModelSettings object itself.
      • evaluationFrequency

        public Integer evaluationFrequency()
        Get the evaluationFrequency property: Frequency to evaluate validation dataset to get metric scores. Must be a positive integer.
        Returns:
        the evaluationFrequency value.
      • withEvaluationFrequency

        public ImageModelSettings withEvaluationFrequency​(Integer evaluationFrequency)
        Set the evaluationFrequency property: Frequency to evaluate validation dataset to get metric scores. Must be a positive integer.
        Parameters:
        evaluationFrequency - the evaluationFrequency value to set.
        Returns:
        the ImageModelSettings object itself.
      • gradientAccumulationStep

        public Integer gradientAccumulationStep()
        Get the gradientAccumulationStep property: Gradient accumulation means running a configured number of "GradAccumulationStep"\ steps without updating the model weights while accumulating the gradients of those steps, and then using the accumulated gradients to compute the weight updates. Must be a positive integer.
        Returns:
        the gradientAccumulationStep value.
      • withGradientAccumulationStep

        public ImageModelSettings withGradientAccumulationStep​(Integer gradientAccumulationStep)
        Set the gradientAccumulationStep property: Gradient accumulation means running a configured number of "GradAccumulationStep"\ steps without updating the model weights while accumulating the gradients of those steps, and then using the accumulated gradients to compute the weight updates. Must be a positive integer.
        Parameters:
        gradientAccumulationStep - the gradientAccumulationStep value to set.
        Returns:
        the ImageModelSettings object itself.
      • layersToFreeze

        public Integer layersToFreeze()
        Get the layersToFreeze property: Number of layers to freeze for the model. Must be a positive integer. For instance, passing 2 as value for 'seresnext' means freezing layer0 and layer1. For a full list of models supported and details on layer freeze, please see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models.
        Returns:
        the layersToFreeze value.
      • withLayersToFreeze

        public ImageModelSettings withLayersToFreeze​(Integer layersToFreeze)
        Set the layersToFreeze property: Number of layers to freeze for the model. Must be a positive integer. For instance, passing 2 as value for 'seresnext' means freezing layer0 and layer1. For a full list of models supported and details on layer freeze, please see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models.
        Parameters:
        layersToFreeze - the layersToFreeze value to set.
        Returns:
        the ImageModelSettings object itself.
      • learningRate

        public Float learningRate()
        Get the learningRate property: Initial learning rate. Must be a float in the range [0, 1].
        Returns:
        the learningRate value.
      • withLearningRate

        public ImageModelSettings withLearningRate​(Float learningRate)
        Set the learningRate property: Initial learning rate. Must be a float in the range [0, 1].
        Parameters:
        learningRate - the learningRate value to set.
        Returns:
        the ImageModelSettings object itself.
      • learningRateScheduler

        public LearningRateScheduler learningRateScheduler()
        Get the learningRateScheduler property: Type of learning rate scheduler. Must be 'warmup_cosine' or 'step'.
        Returns:
        the learningRateScheduler value.
      • withLearningRateScheduler

        public ImageModelSettings withLearningRateScheduler​(LearningRateScheduler learningRateScheduler)
        Set the learningRateScheduler property: Type of learning rate scheduler. Must be 'warmup_cosine' or 'step'.
        Parameters:
        learningRateScheduler - the learningRateScheduler value to set.
        Returns:
        the ImageModelSettings object itself.
      • modelName

        public String modelName()
        Get the modelName property: Name of the model to use for training. For more information on the available models please visit the official documentation: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models.
        Returns:
        the modelName value.
      • withModelName

        public ImageModelSettings withModelName​(String modelName)
        Set the modelName property: Name of the model to use for training. For more information on the available models please visit the official documentation: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models.
        Parameters:
        modelName - the modelName value to set.
        Returns:
        the ImageModelSettings object itself.
      • momentum

        public Float momentum()
        Get the momentum property: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1].
        Returns:
        the momentum value.
      • withMomentum

        public ImageModelSettings withMomentum​(Float momentum)
        Set the momentum property: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1].
        Parameters:
        momentum - the momentum value to set.
        Returns:
        the ImageModelSettings object itself.
      • nesterov

        public Boolean nesterov()
        Get the nesterov property: Enable nesterov when optimizer is 'sgd'.
        Returns:
        the nesterov value.
      • withNesterov

        public ImageModelSettings withNesterov​(Boolean nesterov)
        Set the nesterov property: Enable nesterov when optimizer is 'sgd'.
        Parameters:
        nesterov - the nesterov value to set.
        Returns:
        the ImageModelSettings object itself.
      • numberOfEpochs

        public Integer numberOfEpochs()
        Get the numberOfEpochs property: Number of training epochs. Must be a positive integer.
        Returns:
        the numberOfEpochs value.
      • withNumberOfEpochs

        public ImageModelSettings withNumberOfEpochs​(Integer numberOfEpochs)
        Set the numberOfEpochs property: Number of training epochs. Must be a positive integer.
        Parameters:
        numberOfEpochs - the numberOfEpochs value to set.
        Returns:
        the ImageModelSettings object itself.
      • numberOfWorkers

        public Integer numberOfWorkers()
        Get the numberOfWorkers property: Number of data loader workers. Must be a non-negative integer.
        Returns:
        the numberOfWorkers value.
      • withNumberOfWorkers

        public ImageModelSettings withNumberOfWorkers​(Integer numberOfWorkers)
        Set the numberOfWorkers property: Number of data loader workers. Must be a non-negative integer.
        Parameters:
        numberOfWorkers - the numberOfWorkers value to set.
        Returns:
        the ImageModelSettings object itself.
      • optimizer

        public StochasticOptimizer optimizer()
        Get the optimizer property: Type of optimizer.
        Returns:
        the optimizer value.
      • withOptimizer

        public ImageModelSettings withOptimizer​(StochasticOptimizer optimizer)
        Set the optimizer property: Type of optimizer.
        Parameters:
        optimizer - the optimizer value to set.
        Returns:
        the ImageModelSettings object itself.
      • randomSeed

        public Integer randomSeed()
        Get the randomSeed property: Random seed to be used when using deterministic training.
        Returns:
        the randomSeed value.
      • withRandomSeed

        public ImageModelSettings withRandomSeed​(Integer randomSeed)
        Set the randomSeed property: Random seed to be used when using deterministic training.
        Parameters:
        randomSeed - the randomSeed value to set.
        Returns:
        the ImageModelSettings object itself.
      • splitRatio

        public Float splitRatio()
        Get the splitRatio property: If validation data is not defined, this specifies the split ratio for splitting train data into random train and validation subsets. Must be a float in the range [0, 1].
        Returns:
        the splitRatio value.
      • withSplitRatio

        public ImageModelSettings withSplitRatio​(Float splitRatio)
        Set the splitRatio property: If validation data is not defined, this specifies the split ratio for splitting train data into random train and validation subsets. Must be a float in the range [0, 1].
        Parameters:
        splitRatio - the splitRatio value to set.
        Returns:
        the ImageModelSettings object itself.
      • stepLRGamma

        public Float stepLRGamma()
        Get the stepLRGamma property: Value of gamma when learning rate scheduler is 'step'. Must be a float in the range [0, 1].
        Returns:
        the stepLRGamma value.
      • withStepLRGamma

        public ImageModelSettings withStepLRGamma​(Float stepLRGamma)
        Set the stepLRGamma property: Value of gamma when learning rate scheduler is 'step'. Must be a float in the range [0, 1].
        Parameters:
        stepLRGamma - the stepLRGamma value to set.
        Returns:
        the ImageModelSettings object itself.
      • stepLRStepSize

        public Integer stepLRStepSize()
        Get the stepLRStepSize property: Value of step size when learning rate scheduler is 'step'. Must be a positive integer.
        Returns:
        the stepLRStepSize value.
      • withStepLRStepSize

        public ImageModelSettings withStepLRStepSize​(Integer stepLRStepSize)
        Set the stepLRStepSize property: Value of step size when learning rate scheduler is 'step'. Must be a positive integer.
        Parameters:
        stepLRStepSize - the stepLRStepSize value to set.
        Returns:
        the ImageModelSettings object itself.
      • trainingBatchSize

        public Integer trainingBatchSize()
        Get the trainingBatchSize property: Training batch size. Must be a positive integer.
        Returns:
        the trainingBatchSize value.
      • withTrainingBatchSize

        public ImageModelSettings withTrainingBatchSize​(Integer trainingBatchSize)
        Set the trainingBatchSize property: Training batch size. Must be a positive integer.
        Parameters:
        trainingBatchSize - the trainingBatchSize value to set.
        Returns:
        the ImageModelSettings object itself.
      • validationBatchSize

        public Integer validationBatchSize()
        Get the validationBatchSize property: Validation batch size. Must be a positive integer.
        Returns:
        the validationBatchSize value.
      • withValidationBatchSize

        public ImageModelSettings withValidationBatchSize​(Integer validationBatchSize)
        Set the validationBatchSize property: Validation batch size. Must be a positive integer.
        Parameters:
        validationBatchSize - the validationBatchSize value to set.
        Returns:
        the ImageModelSettings object itself.
      • warmupCosineLRCycles

        public Float warmupCosineLRCycles()
        Get the warmupCosineLRCycles property: Value of cosine cycle when learning rate scheduler is 'warmup_cosine'. Must be a float in the range [0, 1].
        Returns:
        the warmupCosineLRCycles value.
      • withWarmupCosineLRCycles

        public ImageModelSettings withWarmupCosineLRCycles​(Float warmupCosineLRCycles)
        Set the warmupCosineLRCycles property: Value of cosine cycle when learning rate scheduler is 'warmup_cosine'. Must be a float in the range [0, 1].
        Parameters:
        warmupCosineLRCycles - the warmupCosineLRCycles value to set.
        Returns:
        the ImageModelSettings object itself.
      • warmupCosineLRWarmupEpochs

        public Integer warmupCosineLRWarmupEpochs()
        Get the warmupCosineLRWarmupEpochs property: Value of warmup epochs when learning rate scheduler is 'warmup_cosine'. Must be a positive integer.
        Returns:
        the warmupCosineLRWarmupEpochs value.
      • withWarmupCosineLRWarmupEpochs

        public ImageModelSettings withWarmupCosineLRWarmupEpochs​(Integer warmupCosineLRWarmupEpochs)
        Set the warmupCosineLRWarmupEpochs property: Value of warmup epochs when learning rate scheduler is 'warmup_cosine'. Must be a positive integer.
        Parameters:
        warmupCosineLRWarmupEpochs - the warmupCosineLRWarmupEpochs value to set.
        Returns:
        the ImageModelSettings object itself.
      • weightDecay

        public Float weightDecay()
        Get the weightDecay property: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be a float in the range[0, 1].
        Returns:
        the weightDecay value.
      • withWeightDecay

        public ImageModelSettings withWeightDecay​(Float weightDecay)
        Set the weightDecay property: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be a float in the range[0, 1].
        Parameters:
        weightDecay - the weightDecay value to set.
        Returns:
        the ImageModelSettings object itself.
      • validate

        public void validate()
        Validates the instance.
        Throws:
        IllegalArgumentException - thrown if the instance is not valid.