ImageObjectDetectionSearchSpace Class

Search space for AutoML Image Object Detection and Image Instance Segmentation tasks.

Inheritance
azure.ai.ml.entities._mixins.RestTranslatableMixin
ImageObjectDetectionSearchSpace

Constructor

ImageObjectDetectionSearchSpace(*, ams_gradient: bool | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, beta1: float | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, beta2: float | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, distributed: bool | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, early_stopping: bool | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, early_stopping_delay: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, early_stopping_patience: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, enable_onnx_normalization: bool | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, evaluation_frequency: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, gradient_accumulation_step: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, layers_to_freeze: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, learning_rate: float | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, learning_rate_scheduler: str | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, model_name: str | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, momentum: float | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, nesterov: bool | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, number_of_epochs: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, number_of_workers: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, optimizer: str | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, random_seed: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, step_lr_gamma: float | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, step_lr_step_size: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, training_batch_size: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, validation_batch_size: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, warmup_cosine_lr_cycles: float | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, warmup_cosine_lr_warmup_epochs: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, weight_decay: float | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, box_detections_per_image: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, box_score_threshold: float | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, image_size: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, max_size: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, min_size: int | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, model_size: str | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, multi_scale: bool | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, nms_iou_threshold: float | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, tile_grid_size: str | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, tile_overlap_ratio: float | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, tile_predictions_nms_threshold: float | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, validation_iou_threshold: float | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None, validation_metric_type: str | Choice | LogNormal | LogUniform | Normal | QLogNormal | QLogUniform | QNormal | QUniform | Randint | Uniform | None = None)

Parameters

Name Description
ams_gradient
Required
bool or <xref:azure.ai.ml.entities.SweepDistribution>

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

beta1
Required
float or <xref:azure.ai.ml.entities.SweepDistribution>

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

beta2
Required
float or <xref:azure.ai.ml.entities.SweepDistribution>

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

distributed
Required
bool or <xref:azure.ai.ml.entities.SweepDistribution>

Whether to use distributer training.

early_stopping
Required
bool or <xref:azure.ai.ml.entities.SweepDistribution>

Enable early stopping logic during training.

early_stopping_delay
Required
int or <xref:azure.ai.ml.entities.SweepDistribution>

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 or <xref:azure.ai.ml.entities.SweepDistribution>

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
bool or <xref:azure.ai.ml.entities.SweepDistribution>

Enable normalization when exporting ONNX model.

evaluation_frequency
Required
int or <xref:azure.ai.ml.entities.SweepDistribution>

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

gradient_accumulation_step
Required
int or <xref:azure.ai.ml.entities.SweepDistribution>

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 or <xref:azure.ai.ml.entities.SweepDistribution>

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/reference-automl-images-hyperparameters#model-agnostic-hyperparameters. # pylint: disable=line-too-long

learning_rate
Required

Initial learning rate. Must be a float in the range [0, 1]. :type learning_rate: float or ~azure.ai.ml.entities.SweepDistribution

learning_rate_scheduler
Required
str or <xref:azure.ai.ml.entities.SweepDistribution>

Type of learning rate scheduler. Must be 'warmup_cosine' or 'step'.

model_name
Required
str or <xref:azure.ai.ml.entities.SweepDistribution>

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
float or <xref:azure.ai.ml.entities.SweepDistribution>

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

nesterov
Required
bool or <xref:azure.ai.ml.entities.SweepDistribution>

Enable nesterov when optimizer is 'sgd'.

number_of_epochs
Required
int or <xref:azure.ai.ml.entities.SweepDistribution>

Number of training epochs. Must be a positive integer.

number_of_workers
Required
int or <xref:azure.ai.ml.entities.SweepDistribution>

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

optimizer
Required
str or <xref:azure.ai.ml.entities.SweepDistribution>

Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'.

random_seed
Required
int or <xref:azure.ai.ml.entities.SweepDistribution>

Random seed to be used when using deterministic training.

step_lr_gamma
Required
float or <xref:azure.ai.ml.entities.SweepDistribution>

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

step_lr_step_size
Required
int or <xref:azure.ai.ml.entities.SweepDistribution>

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

training_batch_size
Required
int or <xref:azure.ai.ml.entities.SweepDistribution>

Training batch size. Must be a positive integer.

validation_batch_size
Required
int or <xref:azure.ai.ml.entities.SweepDistribution>

Validation batch size. Must be a positive integer.

warmup_cosine_lr_cycles
Required
float or <xref:azure.ai.ml.entities.SweepDistribution>

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 or <xref:azure.ai.ml.entities.SweepDistribution>

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

weight_decay
Required
int or <xref:azure.ai.ml.entities.SweepDistribution>

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 or <xref:azure.ai.ml.entities.SweepDistribution>

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
float or <xref:azure.ai.ml.entities.SweepDistribution>

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 or <xref:azure.ai.ml.entities.SweepDistribution>

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

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. :type max_size: int or ~azure.ai.ml.entities.SweepDistribution

min_size
Required
int or <xref:azure.ai.ml.entities.SweepDistribution>

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
str or <xref:azure.ai.ml.entities.SweepDistribution>

Model size. Must be 'small', 'medium', 'large', or 'extra_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.

multi_scale
Required
bool or <xref:azure.ai.ml.entities.SweepDistribution>

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
float or <xref:azure.ai.ml.entities.SweepDistribution>

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

tile_grid_size
Required
str or <xref:azure.ai.ml.entities.SweepDistribution>

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.

tile_overlap_ratio
Required
float or <xref:azure.ai.ml.entities.SweepDistribution>

Overlap ratio between adjacent tiles in each dimension. Must be float in the range [0, 1).

tile_predictions_nms_threshold
Required
float or <xref:azure.ai.ml.entities.SweepDistribution>

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]. NMS: Non-maximum suppression.

validation_iou_threshold
Required
float or <xref:azure.ai.ml.entities.SweepDistribution>

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

validation_metric_type
Required
str or <xref:azure.ai.ml.entities.SweepDistribution>

Metric computation method to use for validation metrics. Must be 'none', 'coco', 'voc', or 'coco_voc'.

Keyword-Only Parameters

Name Description
ams_gradient
Required
beta1
Required
beta2
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

Examples

Defining an automl image object detection or instance segmentation search space


   from azure.ai.ml import automl
   from azure.ai.ml.sweep import Uniform

   image_detection_search_space = automl.ImageObjectDetectionSearchSpace(
       learning_rate=Uniform(0.005, 0.05),
       model_name="yolov5",
       weight_decay=Uniform(0.01, 0.1),
   )