ImageModelSettingsObjectDetection Class

Model settings for AutoML Image Object Detection Task.

Defining the automl image object detection or instance segmentation model settings.


   from azure.ai.ml import automl

   object_detection_model_settings = automl.ImageModelSettingsObjectDetection(min_size=600, max_size=1333)

Inheritance
azure.ai.ml.entities._job.automl.image.image_model_settings.ImageModelDistributionSettings
ImageModelSettingsObjectDetection

Constructor

ImageModelSettingsObjectDetection(*, advanced_settings: str | None = None, ams_gradient: bool | None = None, beta1: float | None = None, beta2: float | None = None, checkpoint_frequency: int | None = None, checkpoint_run_id: str | None = None, distributed: bool | None = None, early_stopping: bool | None = None, early_stopping_delay: int | None = None, early_stopping_patience: int | None = None, enable_onnx_normalization: bool | None = None, evaluation_frequency: int | None = None, gradient_accumulation_step: int | None = None, layers_to_freeze: int | None = None, learning_rate: float | None = None, learning_rate_scheduler: LearningRateScheduler | None = None, model_name: str | None = None, momentum: float | None = None, nesterov: bool | None = None, number_of_epochs: int | None = None, number_of_workers: int | None = None, optimizer: StochasticOptimizer | None = None, random_seed: int | None = None, step_lr_gamma: float | None = None, step_lr_step_size: int | None = None, training_batch_size: int | None = None, validation_batch_size: int | None = None, warmup_cosine_lr_cycles: float | None = None, warmup_cosine_lr_warmup_epochs: int | None = None, weight_decay: float | None = None, box_detections_per_image: int | None = None, box_score_threshold: float | None = None, image_size: int | None = None, max_size: int | None = None, min_size: int | None = None, model_size: ModelSize | None = None, multi_scale: bool | None = None, nms_iou_threshold: float | None = None, tile_grid_size: str | None = None, tile_overlap_ratio: float | None = None, tile_predictions_nms_threshold: float | None = None, validation_iou_threshold: float | None = None, validation_metric_type: ValidationMetricType | None = None, log_training_metrics: LogTrainingMetrics | None = None, log_validation_loss: LogValidationLoss | None = None, **kwargs: Any)

Parameters

Name Description
advanced_settings
Required
str

Settings for advanced scenarios.

ams_gradient
Required

Enable AMSGrad when optimizer is 'adam' or 'adamw'.

beta1
Required

Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1].

beta2
Required

Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1].

checkpoint_frequency
Required
int

Frequency to store model checkpoints. Must be a positive integer.

checkpoint_run_id
Required
str

The id of a previous run that has a pretrained checkpoint for incremental training.

distributed
Required

Whether to use distributed training.

early_stopping
Required

Enable early stopping logic during training.

early_stopping_delay
Required
int

Minimum number of epochs or validation evaluations to wait before primary metric improvement is tracked for early stopping. Must be a positive integer.

early_stopping_patience
Required
int

Minimum number of epochs or validation evaluations with no primary metric improvement before the run is stopped. Must be a positive integer.

enable_onnx_normalization
Required

Enable normalization when exporting ONNX model.

evaluation_frequency
Required
int

Frequency to evaluate validation dataset to get metric scores. Must be a positive integer.

gradient_accumulation_step
Required
int

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.

layers_to_freeze
Required
int

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.

learning_rate
Required

Initial learning rate. Must be a float in the range [0, 1].

learning_rate_scheduler
Required

Type of learning rate scheduler. Must be 'warmup_cosine' or 'step'. Possible values include: "None", "WarmupCosine", "Step".

model_name
Required
str

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.

momentum
Required

Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1].

nesterov
Required

Enable nesterov when optimizer is 'sgd'.

number_of_epochs
Required
int

Number of training epochs. Must be a positive integer.

number_of_workers
Required
int

Number of data loader workers. Must be a non-negative integer.

optimizer
Required

Type of optimizer. Possible values include: "None", "Sgd", "Adam", "Adamw".

random_seed
Required
int

Random seed to be used when using deterministic training.

step_lr_gamma
Required

Value of gamma when learning rate scheduler is 'step'. Must be a float in the range [0, 1].

step_lr_step_size
Required
int

Value of step size when learning rate scheduler is 'step'. Must be a positive integer.

training_batch_size
Required
int

Training batch size. Must be a positive integer.

validation_batch_size
Required
int

Validation batch size. Must be a positive integer.

warmup_cosine_lr_cycles
Required

Value of cosine cycle when learning rate scheduler is 'warmup_cosine'. Must be a float in the range [0, 1].

warmup_cosine_lr_warmup_epochs
Required
int

Value of warmup epochs when learning rate scheduler is 'warmup_cosine'. Must be a positive integer.

weight_decay
Required

Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be a float in the range[0, 1].

box_detections_per_image
Required
int

Maximum number of detections per image, for all classes. Must be a positive integer. Note: This settings is not supported for the 'yolov5' algorithm.

box_score_threshold
Required

During inference, only return proposals with a classification score greater than BoxScoreThreshold. Must be a float in the range[0, 1].

image_size
Required
int

Image size for train and validation. Must be a positive integer. Note: The training run may get into CUDA OOM if the size is too big. Note: This settings is only supported for the 'yolov5' algorithm.

max_size
Required
int

Maximum size of the image to be rescaled before feeding it to the backbone. Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. Note: This settings is not supported for the 'yolov5' algorithm.

min_size
Required
int

Minimum size of the image to be rescaled before feeding it to the backbone. Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. Note: This settings is not supported for the 'yolov5' algorithm.

model_size
Required

Model size. Must be 'small', 'medium', 'large'. Note: training run may get into CUDA OOM if the model size is too big. Note: This settings is only supported for the 'yolov5' algorithm. Possible values include: "None", "Small", "Medium", "Large", "ExtraLarge".

multi_scale
Required

Enable multi-scale image by varying image size by +/- 50%. Note: training run may get into CUDA OOM if no sufficient GPU memory. Note: This settings is only supported for the 'yolov5' algorithm.

nms_iou_threshold
Required

IOU threshold used during inference in NMS post processing. Must be a float in the range [0, 1].

tile_grid_size
Required
str

The grid size to use for tiling each image. Note: TileGridSize must not be None to enable small object detection logic. A string containing two integers in mxn format. Note: This settings is not supported for the 'yolov5' algorithm.

tile_overlap_ratio
Required

Overlap ratio between adjacent tiles in each dimension. Must be float in the range [0, 1). Note: This settings is not supported for the 'yolov5' algorithm.

tile_predictions_nms_threshold
Required

The IOU threshold to use to perform NMS while merging predictions from tiles and image. Used in validation/ inference. Must be float in the range [0, 1]. Note: This settings is not supported for the 'yolov5' algorithm.

validation_iou_threshold
Required

IOU threshold to use when computing validation metric. Must be float in the range [0, 1].

validation_metric_type
Required

Metric computation method to use for validation metrics. Possible values include: "None", "Coco", "Voc", "CocoVoc".

log_training_metrics
Required
str or <xref:azure.mgmt.machinelearningservices.models.LogTrainingMetrics>

indicates whether or not to log training metrics

log_validation_loss
Required
str or <xref:azure.mgmt.machinelearningservices.models.LogValidationLoss>

indicates whether or not to log validation loss

Keyword-Only Parameters

Name Description
advanced_settings
Required
ams_gradient
Required
beta1
Required
beta2
Required
checkpoint_frequency
Required
checkpoint_run_id
Required
distributed
Required
early_stopping
Required
early_stopping_delay
Required
early_stopping_patience
Required
enable_onnx_normalization
Required
evaluation_frequency
Required
gradient_accumulation_step
Required
layers_to_freeze
Required
learning_rate
Required
learning_rate_scheduler
Required
model_name
Required
momentum
Required
nesterov
Required
number_of_epochs
Required
number_of_workers
Required
optimizer
Required
random_seed
Required
step_lr_gamma
Required
step_lr_step_size
Required
training_batch_size
Required
validation_batch_size
Required
warmup_cosine_lr_cycles
Required
warmup_cosine_lr_warmup_epochs
Required
weight_decay
Required
box_detections_per_image
Required
box_score_threshold
Required
image_size
Required
max_size
Required
min_size
Required
model_size
Required
multi_scale
Required
nms_iou_threshold
Required
tile_grid_size
Required
tile_overlap_ratio
Required
tile_predictions_nms_threshold
Required
validation_iou_threshold
Required
validation_metric_type
Required
log_training_metrics
Required
log_validation_loss
Required