Class ImageModelSettingsClassification
java.lang.Object
com.azure.resourcemanager.machinelearning.models.ImageModelSettings
com.azure.resourcemanager.machinelearning.models.ImageModelSettingsClassification
- All Implemented Interfaces:
com.azure.json.JsonSerializable<ImageModelSettings>
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 Summary
ConstructorsConstructorDescriptionCreates an instance of ImageModelSettingsClassification class. -
Method Summary
Modifier and TypeMethodDescriptionfromJson(com.azure.json.JsonReader jsonReader) Reads an instance of ImageModelSettingsClassification from the JsonReader.com.azure.json.JsonWritertoJson(com.azure.json.JsonWriter jsonWriter) Get the trainingCropSize property: Image crop size that is input to the neural network for the training dataset.voidvalidate()Validates the instance.Get the validationCropSize property: Image crop size that is input to the neural network for the validation dataset.Get the validationResizeSize property: Image size to which to resize before cropping for validation dataset.Get the weightedLoss property: Weighted loss.withAdvancedSettings(String advancedSettings) Set the advancedSettings property: Settings for advanced scenarios.withAmsGradient(Boolean amsGradient) Set the amsGradient property: Enable AMSGrad when optimizer is 'adam' or 'adamw'.withAugmentations(String augmentations) Set the augmentations property: Settings for using Augmentations.Set the beta1 property: Value of 'beta1' when optimizer is 'adam' or 'adamw'.Set the beta2 property: Value of 'beta2' when optimizer is 'adam' or 'adamw'.withCheckpointFrequency(Integer checkpointFrequency) Set the checkpointFrequency property: Frequency to store model checkpoints.withCheckpointModel(MLFlowModelJobInput checkpointModel) Set the checkpointModel property: The pretrained checkpoint model for incremental training.withCheckpointRunId(String checkpointRunId) Set the checkpointRunId property: The id of a previous run that has a pretrained checkpoint for incremental training.withDistributed(Boolean distributed) Set the distributed property: Whether to use distributed training.withEarlyStopping(Boolean earlyStopping) Set the earlyStopping property: Enable early stopping logic during training.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.withEarlyStoppingPatience(Integer earlyStoppingPatience) Set the earlyStoppingPatience property: Minimum number of epochs or validation evaluations with no primary metric improvement before the run is stopped.withEnableOnnxNormalization(Boolean enableOnnxNormalization) Set the enableOnnxNormalization property: Enable normalization when exporting ONNX model.withEvaluationFrequency(Integer evaluationFrequency) Set the evaluationFrequency property: Frequency to evaluate validation dataset to get metric scores.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.withLayersToFreeze(Integer layersToFreeze) Set the layersToFreeze property: Number of layers to freeze for the model.withLearningRate(Float learningRate) Set the learningRate property: Initial learning rate.withLearningRateScheduler(LearningRateScheduler learningRateScheduler) Set the learningRateScheduler property: Type of learning rate scheduler.withModelName(String modelName) Set the modelName property: Name of the model to use for training.withMomentum(Float momentum) Set the momentum property: Value of momentum when optimizer is 'sgd'.withNesterov(Boolean nesterov) Set the nesterov property: Enable nesterov when optimizer is 'sgd'.withNumberOfEpochs(Integer numberOfEpochs) Set the numberOfEpochs property: Number of training epochs.withNumberOfWorkers(Integer numberOfWorkers) Set the numberOfWorkers property: Number of data loader workers.withOptimizer(StochasticOptimizer optimizer) Set the optimizer property: Type of optimizer.withRandomSeed(Integer randomSeed) Set the randomSeed property: Random seed to be used when using deterministic training.withStepLRGamma(Float stepLRGamma) Set the stepLRGamma property: Value of gamma when learning rate scheduler is 'step'.withStepLRStepSize(Integer stepLRStepSize) Set the stepLRStepSize property: Value of step size when learning rate scheduler is 'step'.withTrainingBatchSize(Integer trainingBatchSize) Set the trainingBatchSize property: Training batch size.withTrainingCropSize(Integer trainingCropSize) Set the trainingCropSize property: Image crop size that is input to the neural network for the training dataset.withValidationBatchSize(Integer validationBatchSize) Set the validationBatchSize property: Validation batch size.withValidationCropSize(Integer validationCropSize) Set the validationCropSize property: Image crop size that is input to the neural network for the validation dataset.withValidationResizeSize(Integer validationResizeSize) Set the validationResizeSize property: Image size to which to resize before cropping for validation dataset.withWarmupCosineLRCycles(Float warmupCosineLRCycles) Set the warmupCosineLRCycles property: Value of cosine cycle when learning rate scheduler is 'warmup_cosine'.withWarmupCosineLRWarmupEpochs(Integer warmupCosineLRWarmupEpochs) Set the warmupCosineLRWarmupEpochs property: Value of warmup epochs when learning rate scheduler is 'warmup_cosine'.withWeightDecay(Float weightDecay) Set the weightDecay property: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'.withWeightedLoss(Integer weightedLoss) Set the weightedLoss property: Weighted loss.Methods inherited from class com.azure.resourcemanager.machinelearning.models.ImageModelSettings
advancedSettings, amsGradient, augmentations, beta1, beta2, checkpointFrequency, checkpointModel, checkpointRunId, distributed, earlyStopping, earlyStoppingDelay, earlyStoppingPatience, enableOnnxNormalization, evaluationFrequency, gradientAccumulationStep, layersToFreeze, learningRate, learningRateScheduler, modelName, momentum, nesterov, numberOfEpochs, numberOfWorkers, optimizer, randomSeed, stepLRGamma, stepLRStepSize, trainingBatchSize, validationBatchSize, warmupCosineLRCycles, warmupCosineLRWarmupEpochs, weightDecayMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.azure.json.JsonSerializable
toJson, toJson, toJsonBytes, toJsonString
-
Constructor Details
-
ImageModelSettingsClassification
public ImageModelSettingsClassification()Creates an instance of ImageModelSettingsClassification class.
-
-
Method Details
-
trainingCropSize
Get the trainingCropSize property: Image crop size that is input to the neural network for the training dataset. Must be a positive integer.- Returns:
- the trainingCropSize value.
-
withTrainingCropSize
Set the trainingCropSize property: Image crop size that is input to the neural network for the training dataset. Must be a positive integer.- Parameters:
trainingCropSize- the trainingCropSize value to set.- Returns:
- the ImageModelSettingsClassification object itself.
-
validationCropSize
Get the validationCropSize property: Image crop size that is input to the neural network for the validation dataset. Must be a positive integer.- Returns:
- the validationCropSize value.
-
withValidationCropSize
Set the validationCropSize property: Image crop size that is input to the neural network for the validation dataset. Must be a positive integer.- Parameters:
validationCropSize- the validationCropSize value to set.- Returns:
- the ImageModelSettingsClassification object itself.
-
validationResizeSize
Get the validationResizeSize property: Image size to which to resize before cropping for validation dataset. Must be a positive integer.- Returns:
- the validationResizeSize value.
-
withValidationResizeSize
Set the validationResizeSize property: Image size to which to resize before cropping for validation dataset. Must be a positive integer.- Parameters:
validationResizeSize- the validationResizeSize value to set.- Returns:
- the ImageModelSettingsClassification object itself.
-
weightedLoss
Get the weightedLoss property: Weighted loss. The accepted values are 0 for no weighted loss. 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be 0 or 1 or 2.- Returns:
- the weightedLoss value.
-
withWeightedLoss
Set the weightedLoss property: Weighted loss. The accepted values are 0 for no weighted loss. 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be 0 or 1 or 2.- Parameters:
weightedLoss- the weightedLoss value to set.- Returns:
- the ImageModelSettingsClassification object itself.
-
withAmsGradient
Set the amsGradient property: Enable AMSGrad when optimizer is 'adam' or 'adamw'.- Overrides:
withAmsGradientin classImageModelSettings- Parameters:
amsGradient- the amsGradient value to set.- Returns:
- the ImageModelSettings object itself.
-
withAdvancedSettings
Set the advancedSettings property: Settings for advanced scenarios.- Overrides:
withAdvancedSettingsin classImageModelSettings- Parameters:
advancedSettings- the advancedSettings value to set.- Returns:
- the ImageModelSettings object itself.
-
withAugmentations
Set the augmentations property: Settings for using Augmentations.- Overrides:
withAugmentationsin classImageModelSettings- Parameters:
augmentations- the augmentations value to set.- Returns:
- the ImageModelSettings object itself.
-
withBeta1
Set the beta1 property: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1].- Overrides:
withBeta1in classImageModelSettings- Parameters:
beta1- the beta1 value to set.- Returns:
- the ImageModelSettings object itself.
-
withBeta2
Set the beta2 property: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1].- Overrides:
withBeta2in classImageModelSettings- Parameters:
beta2- the beta2 value to set.- Returns:
- the ImageModelSettings object itself.
-
withCheckpointFrequency
Set the checkpointFrequency property: Frequency to store model checkpoints. Must be a positive integer.- Overrides:
withCheckpointFrequencyin classImageModelSettings- Parameters:
checkpointFrequency- the checkpointFrequency value to set.- Returns:
- the ImageModelSettings object itself.
-
withCheckpointRunId
Set the checkpointRunId property: The id of a previous run that has a pretrained checkpoint for incremental training.- Overrides:
withCheckpointRunIdin classImageModelSettings- Parameters:
checkpointRunId- the checkpointRunId value to set.- Returns:
- the ImageModelSettings object itself.
-
withCheckpointModel
Set the checkpointModel property: The pretrained checkpoint model for incremental training.- Overrides:
withCheckpointModelin classImageModelSettings- Parameters:
checkpointModel- the checkpointModel value to set.- Returns:
- the ImageModelSettings object itself.
-
withDistributed
Set the distributed property: Whether to use distributed training.- Overrides:
withDistributedin classImageModelSettings- Parameters:
distributed- the distributed value to set.- Returns:
- the ImageModelSettings object itself.
-
withEarlyStopping
Set the earlyStopping property: Enable early stopping logic during training.- Overrides:
withEarlyStoppingin classImageModelSettings- Parameters:
earlyStopping- the earlyStopping value to set.- Returns:
- the ImageModelSettings object itself.
-
withEarlyStoppingDelay
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.- Overrides:
withEarlyStoppingDelayin classImageModelSettings- Parameters:
earlyStoppingDelay- the earlyStoppingDelay value to set.- Returns:
- the ImageModelSettings object itself.
-
withEarlyStoppingPatience
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.- Overrides:
withEarlyStoppingPatiencein classImageModelSettings- Parameters:
earlyStoppingPatience- the earlyStoppingPatience value to set.- Returns:
- the ImageModelSettings object itself.
-
withEvaluationFrequency
Set the evaluationFrequency property: Frequency to evaluate validation dataset to get metric scores. Must be a positive integer.- Overrides:
withEvaluationFrequencyin classImageModelSettings- Parameters:
evaluationFrequency- the evaluationFrequency value to set.- Returns:
- the ImageModelSettings object itself.
-
withEnableOnnxNormalization
public ImageModelSettingsClassification withEnableOnnxNormalization(Boolean enableOnnxNormalization) Set the enableOnnxNormalization property: Enable normalization when exporting ONNX model.- Overrides:
withEnableOnnxNormalizationin classImageModelSettings- Parameters:
enableOnnxNormalization- the enableOnnxNormalization value to set.- Returns:
- the ImageModelSettings object itself.
-
withGradientAccumulationStep
public ImageModelSettingsClassification 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.- Overrides:
withGradientAccumulationStepin classImageModelSettings- Parameters:
gradientAccumulationStep- the gradientAccumulationStep value to set.- Returns:
- the ImageModelSettings object itself.
-
withLayersToFreeze
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.- Overrides:
withLayersToFreezein classImageModelSettings- Parameters:
layersToFreeze- the layersToFreeze value to set.- Returns:
- the ImageModelSettings object itself.
-
withLearningRate
Set the learningRate property: Initial learning rate. Must be a float in the range [0, 1].- Overrides:
withLearningRatein classImageModelSettings- Parameters:
learningRate- the learningRate value to set.- Returns:
- the ImageModelSettings object itself.
-
withLearningRateScheduler
public ImageModelSettingsClassification withLearningRateScheduler(LearningRateScheduler learningRateScheduler) Set the learningRateScheduler property: Type of learning rate scheduler. Must be 'warmup_cosine' or 'step'.- Overrides:
withLearningRateSchedulerin classImageModelSettings- Parameters:
learningRateScheduler- the learningRateScheduler value to set.- Returns:
- the ImageModelSettings object itself.
-
withModelName
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.- Overrides:
withModelNamein classImageModelSettings- Parameters:
modelName- the modelName value to set.- Returns:
- the ImageModelSettings object itself.
-
withMomentum
Set the momentum property: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1].- Overrides:
withMomentumin classImageModelSettings- Parameters:
momentum- the momentum value to set.- Returns:
- the ImageModelSettings object itself.
-
withNesterov
Set the nesterov property: Enable nesterov when optimizer is 'sgd'.- Overrides:
withNesterovin classImageModelSettings- Parameters:
nesterov- the nesterov value to set.- Returns:
- the ImageModelSettings object itself.
-
withNumberOfEpochs
Set the numberOfEpochs property: Number of training epochs. Must be a positive integer.- Overrides:
withNumberOfEpochsin classImageModelSettings- Parameters:
numberOfEpochs- the numberOfEpochs value to set.- Returns:
- the ImageModelSettings object itself.
-
withNumberOfWorkers
Set the numberOfWorkers property: Number of data loader workers. Must be a non-negative integer.- Overrides:
withNumberOfWorkersin classImageModelSettings- Parameters:
numberOfWorkers- the numberOfWorkers value to set.- Returns:
- the ImageModelSettings object itself.
-
withOptimizer
Set the optimizer property: Type of optimizer.- Overrides:
withOptimizerin classImageModelSettings- Parameters:
optimizer- the optimizer value to set.- Returns:
- the ImageModelSettings object itself.
-
withRandomSeed
Set the randomSeed property: Random seed to be used when using deterministic training.- Overrides:
withRandomSeedin classImageModelSettings- Parameters:
randomSeed- the randomSeed value to set.- Returns:
- the ImageModelSettings object itself.
-
withStepLRGamma
Set the stepLRGamma property: Value of gamma when learning rate scheduler is 'step'. Must be a float in the range [0, 1].- Overrides:
withStepLRGammain classImageModelSettings- Parameters:
stepLRGamma- the stepLRGamma value to set.- Returns:
- the ImageModelSettings object itself.
-
withStepLRStepSize
Set the stepLRStepSize property: Value of step size when learning rate scheduler is 'step'. Must be a positive integer.- Overrides:
withStepLRStepSizein classImageModelSettings- Parameters:
stepLRStepSize- the stepLRStepSize value to set.- Returns:
- the ImageModelSettings object itself.
-
withTrainingBatchSize
Set the trainingBatchSize property: Training batch size. Must be a positive integer.- Overrides:
withTrainingBatchSizein classImageModelSettings- Parameters:
trainingBatchSize- the trainingBatchSize value to set.- Returns:
- the ImageModelSettings object itself.
-
withValidationBatchSize
Set the validationBatchSize property: Validation batch size. Must be a positive integer.- Overrides:
withValidationBatchSizein classImageModelSettings- Parameters:
validationBatchSize- the validationBatchSize value to set.- Returns:
- the ImageModelSettings object itself.
-
withWarmupCosineLRCycles
Set the warmupCosineLRCycles property: Value of cosine cycle when learning rate scheduler is 'warmup_cosine'. Must be a float in the range [0, 1].- Overrides:
withWarmupCosineLRCyclesin classImageModelSettings- Parameters:
warmupCosineLRCycles- the warmupCosineLRCycles value to set.- Returns:
- the ImageModelSettings object itself.
-
withWarmupCosineLRWarmupEpochs
public ImageModelSettingsClassification withWarmupCosineLRWarmupEpochs(Integer warmupCosineLRWarmupEpochs) Set the warmupCosineLRWarmupEpochs property: Value of warmup epochs when learning rate scheduler is 'warmup_cosine'. Must be a positive integer.- Overrides:
withWarmupCosineLRWarmupEpochsin classImageModelSettings- Parameters:
warmupCosineLRWarmupEpochs- the warmupCosineLRWarmupEpochs value to set.- Returns:
- the ImageModelSettings object itself.
-
withWeightDecay
Set the weightDecay property: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be a float in the range[0, 1].- Overrides:
withWeightDecayin classImageModelSettings- Parameters:
weightDecay- the weightDecay value to set.- Returns:
- the ImageModelSettings object itself.
-
validate
public void validate()Validates the instance.- Overrides:
validatein classImageModelSettings- Throws:
IllegalArgumentException- thrown if the instance is not valid.
-
toJson
- Specified by:
toJsonin interfacecom.azure.json.JsonSerializable<ImageModelSettings>- Overrides:
toJsonin classImageModelSettings- Throws:
IOException
-
fromJson
public static ImageModelSettingsClassification fromJson(com.azure.json.JsonReader jsonReader) throws IOException Reads an instance of ImageModelSettingsClassification from the JsonReader.- Parameters:
jsonReader- The JsonReader being read.- Returns:
- An instance of ImageModelSettingsClassification if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
- Throws:
IOException- If an error occurs while reading the ImageModelSettingsClassification.
-