aboutsummaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical
diff options
context:
space:
mode:
authorS. Solomon Darnell2025-03-28 21:52:21 -0500
committerS. Solomon Darnell2025-03-28 21:52:21 -0500
commit4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch)
treeee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical
parentcc961e04ba734dd72309fb548a2f97d67d578813 (diff)
downloadgn-ai-master.tar.gz
two version of R2R are hereHEADmaster
Diffstat (limited to '.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical')
-rw-r--r--.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/__init__.py5
-rw-r--r--.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_classification.py66
-rw-r--r--.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_limit_settings.py21
-rw-r--r--.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_model_distribution_settings.py216
-rw-r--r--.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_model_settings.py96
-rw-r--r--.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_object_detection.py66
-rw-r--r--.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_sweep_settings.py27
-rw-r--r--.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_vertical.py19
8 files changed, 516 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/__init__.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/__init__.py
new file mode 100644
index 00000000..29a4fcd3
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/__init__.py
@@ -0,0 +1,5 @@
+# ---------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# ---------------------------------------------------------
+
+__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_classification.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_classification.py
new file mode 100644
index 00000000..c539f037
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_classification.py
@@ -0,0 +1,66 @@
+# ---------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# ---------------------------------------------------------
+
+# pylint: disable=unused-argument
+
+from typing import Any, Dict
+
+from marshmallow import fields, post_load
+
+from azure.ai.ml._restclient.v2023_04_01_preview.models import (
+ ClassificationMultilabelPrimaryMetrics,
+ ClassificationPrimaryMetrics,
+ TaskType,
+)
+from azure.ai.ml._schema.automl.image_vertical.image_model_distribution_settings import (
+ ImageModelDistributionSettingsClassificationSchema,
+)
+from azure.ai.ml._schema.automl.image_vertical.image_model_settings import ImageModelSettingsClassificationSchema
+from azure.ai.ml._schema.automl.image_vertical.image_vertical import ImageVerticalSchema
+from azure.ai.ml._schema.core.fields import NestedField, StringTransformedEnum
+from azure.ai.ml._utils.utils import camel_to_snake
+from azure.ai.ml.constants._job.automl import AutoMLConstants
+
+
+class ImageClassificationBaseSchema(ImageVerticalSchema):
+ training_parameters = NestedField(ImageModelSettingsClassificationSchema())
+ search_space = fields.List(NestedField(ImageModelDistributionSettingsClassificationSchema()))
+
+
+class ImageClassificationSchema(ImageClassificationBaseSchema):
+ task_type = StringTransformedEnum(
+ allowed_values=TaskType.IMAGE_CLASSIFICATION,
+ casing_transform=camel_to_snake,
+ data_key=AutoMLConstants.TASK_TYPE_YAML,
+ required=True,
+ )
+ primary_metric = StringTransformedEnum(
+ allowed_values=[o.value for o in ClassificationPrimaryMetrics],
+ casing_transform=camel_to_snake,
+ load_default=camel_to_snake(ClassificationPrimaryMetrics.Accuracy),
+ )
+
+ @post_load
+ def make(self, data, **kwargs) -> Dict[str, Any]:
+ data.pop("task_type")
+ return data
+
+
+class ImageClassificationMultilabelSchema(ImageClassificationBaseSchema):
+ task_type = StringTransformedEnum(
+ allowed_values=TaskType.IMAGE_CLASSIFICATION_MULTILABEL,
+ casing_transform=camel_to_snake,
+ data_key=AutoMLConstants.TASK_TYPE_YAML,
+ required=True,
+ )
+ primary_metric = StringTransformedEnum(
+ allowed_values=[o.value for o in ClassificationMultilabelPrimaryMetrics],
+ casing_transform=camel_to_snake,
+ load_default=camel_to_snake(ClassificationMultilabelPrimaryMetrics.IOU),
+ )
+
+ @post_load
+ def make(self, data, **kwargs) -> Dict[str, Any]:
+ data.pop("task_type")
+ return data
diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_limit_settings.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_limit_settings.py
new file mode 100644
index 00000000..3f5c73e8
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_limit_settings.py
@@ -0,0 +1,21 @@
+# ---------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# ---------------------------------------------------------
+
+# pylint: disable=unused-argument
+
+from marshmallow import fields, post_load
+
+from azure.ai.ml._schema.core.schema import PatchedSchemaMeta
+
+
+class ImageLimitsSchema(metaclass=PatchedSchemaMeta):
+ max_concurrent_trials = fields.Int()
+ max_trials = fields.Int()
+ timeout_minutes = fields.Int() # type duration
+
+ @post_load
+ def make(self, data, **kwargs):
+ from azure.ai.ml.automl import ImageLimitSettings
+
+ return ImageLimitSettings(**data)
diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_model_distribution_settings.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_model_distribution_settings.py
new file mode 100644
index 00000000..9f784038
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_model_distribution_settings.py
@@ -0,0 +1,216 @@
+# ---------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# ---------------------------------------------------------
+
+# pylint: disable=unused-argument
+
+from marshmallow import fields, post_dump, post_load, pre_load
+
+from azure.ai.ml._restclient.v2023_04_01_preview.models import (
+ LearningRateScheduler,
+ ModelSize,
+ StochasticOptimizer,
+ ValidationMetricType,
+)
+from azure.ai.ml._schema._sweep.search_space import (
+ ChoiceSchema,
+ IntegerQNormalSchema,
+ IntegerQUniformSchema,
+ NormalSchema,
+ QNormalSchema,
+ QUniformSchema,
+ RandintSchema,
+ UniformSchema,
+)
+from azure.ai.ml._schema.core.fields import (
+ DumpableIntegerField,
+ DumpableStringField,
+ NestedField,
+ StringTransformedEnum,
+ UnionField,
+)
+from azure.ai.ml._schema.core.schema import PatchedSchemaMeta
+from azure.ai.ml._utils.utils import camel_to_snake
+
+
+def choice_schema_of_type(cls, **kwargs):
+ class CustomChoiceSchema(ChoiceSchema):
+ values = fields.List(cls(**kwargs))
+
+ return CustomChoiceSchema()
+
+
+def choice_and_single_value_schema_of_type(cls, **kwargs):
+ # Reshuffling the order of fields for allowing choice of booleans.
+ # The reason is, while dumping [Bool, Choice[Bool]] is parsing even dict as True.
+ # Since all unionFields are parsed sequentially, to avoid this, we are giving the "type" field at the end.
+ return UnionField([NestedField(choice_schema_of_type(cls, **kwargs)), cls(**kwargs)])
+
+
+FLOAT_SEARCH_SPACE_DISTRIBUTION_FIELD = UnionField(
+ [
+ fields.Float(),
+ DumpableIntegerField(strict=True),
+ NestedField(choice_schema_of_type(DumpableIntegerField, strict=True)),
+ NestedField(choice_schema_of_type(fields.Float)),
+ NestedField(UniformSchema()),
+ NestedField(QUniformSchema()),
+ NestedField(NormalSchema()),
+ NestedField(QNormalSchema()),
+ NestedField(RandintSchema()),
+ ]
+)
+
+INT_SEARCH_SPACE_DISTRIBUTION_FIELD = UnionField(
+ [
+ DumpableIntegerField(strict=True),
+ NestedField(choice_schema_of_type(DumpableIntegerField, strict=True)),
+ NestedField(RandintSchema()),
+ NestedField(IntegerQUniformSchema()),
+ NestedField(IntegerQNormalSchema()),
+ ]
+)
+
+STRING_SEARCH_SPACE_DISTRIBUTION_FIELD = choice_and_single_value_schema_of_type(DumpableStringField)
+BOOL_SEARCH_SPACE_DISTRIBUTION_FIELD = choice_and_single_value_schema_of_type(fields.Bool)
+
+model_size_enum_args = {"allowed_values": [o.value for o in ModelSize], "casing_transform": camel_to_snake}
+learning_rate_scheduler_enum_args = {
+ "allowed_values": [o.value for o in LearningRateScheduler],
+ "casing_transform": camel_to_snake,
+}
+optimizer_enum_args = {"allowed_values": [o.value for o in StochasticOptimizer], "casing_transform": camel_to_snake}
+validation_metric_enum_args = {
+ "allowed_values": [o.value for o in ValidationMetricType],
+ "casing_transform": camel_to_snake,
+}
+
+
+MODEL_SIZE_DISTRIBUTION_FIELD = choice_and_single_value_schema_of_type(StringTransformedEnum, **model_size_enum_args)
+LEARNING_RATE_SCHEDULER_DISTRIBUTION_FIELD = choice_and_single_value_schema_of_type(
+ StringTransformedEnum, **learning_rate_scheduler_enum_args
+)
+OPTIMIZER_DISTRIBUTION_FIELD = choice_and_single_value_schema_of_type(StringTransformedEnum, **optimizer_enum_args)
+VALIDATION_METRIC_DISTRIBUTION_FIELD = choice_and_single_value_schema_of_type(
+ StringTransformedEnum, **validation_metric_enum_args
+)
+
+
+class ImageModelDistributionSettingsSchema(metaclass=PatchedSchemaMeta):
+ ams_gradient = BOOL_SEARCH_SPACE_DISTRIBUTION_FIELD
+ augmentations = STRING_SEARCH_SPACE_DISTRIBUTION_FIELD
+ beta1 = FLOAT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ beta2 = FLOAT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ distributed = BOOL_SEARCH_SPACE_DISTRIBUTION_FIELD
+ early_stopping = BOOL_SEARCH_SPACE_DISTRIBUTION_FIELD
+ early_stopping_delay = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ early_stopping_patience = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ evaluation_frequency = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ enable_onnx_normalization = BOOL_SEARCH_SPACE_DISTRIBUTION_FIELD
+ gradient_accumulation_step = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ layers_to_freeze = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ learning_rate = FLOAT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ learning_rate_scheduler = LEARNING_RATE_SCHEDULER_DISTRIBUTION_FIELD
+ momentum = FLOAT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ nesterov = BOOL_SEARCH_SPACE_DISTRIBUTION_FIELD
+ number_of_epochs = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ number_of_workers = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ optimizer = OPTIMIZER_DISTRIBUTION_FIELD
+ random_seed = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ step_lr_gamma = FLOAT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ step_lr_step_size = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ training_batch_size = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ validation_batch_size = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ warmup_cosine_lr_cycles = FLOAT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ warmup_cosine_lr_warmup_epochs = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ weight_decay = FLOAT_SEARCH_SPACE_DISTRIBUTION_FIELD
+
+
+# pylint: disable-next=name-too-long
+class ImageModelDistributionSettingsClassificationSchema(ImageModelDistributionSettingsSchema):
+ model_name = STRING_SEARCH_SPACE_DISTRIBUTION_FIELD
+ training_crop_size = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ validation_crop_size = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ validation_resize_size = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ weighted_loss = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+
+ @post_dump
+ def conversion(self, data, **kwargs):
+ if self.context.get("inside_pipeline", False): # pylint: disable=no-member
+ # AutoML job inside pipeline does load(dump) instead of calling to_rest_object
+ # explicitly for creating the autoRest Object from sdk job.
+ # Hence for pipeline job, we explicitly convert Sweep Distribution dict to str after dump in this method.
+ # For standalone automl job, same conversion happens in image_classification_job._to_rest_object()
+ from azure.ai.ml.entities._job.automl.search_space_utils import _convert_sweep_dist_dict_to_str_dict
+
+ data = _convert_sweep_dist_dict_to_str_dict(data)
+ return data
+
+ @pre_load
+ def before_make(self, data, **kwargs):
+ if self.context.get("inside_pipeline", False): # pylint: disable=no-member
+ from azure.ai.ml.entities._job.automl.search_space_utils import _convert_sweep_dist_str_to_dict
+
+ # Converting Sweep Distribution str to Sweep Distribution dict for complying with search_space schema.
+ data = _convert_sweep_dist_str_to_dict(data)
+ return data
+
+ @post_load
+ def make(self, data, **kwargs):
+ from azure.ai.ml.automl import ImageClassificationSearchSpace
+
+ return ImageClassificationSearchSpace(**data)
+
+
+# pylint: disable-next=name-too-long
+class ImageModelDistributionSettingsDetectionCommonSchema(ImageModelDistributionSettingsSchema):
+ box_detections_per_image = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ box_score_threshold = FLOAT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ image_size = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ max_size = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ min_size = INT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ model_size = MODEL_SIZE_DISTRIBUTION_FIELD
+ multi_scale = BOOL_SEARCH_SPACE_DISTRIBUTION_FIELD
+ nms_iou_threshold = FLOAT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ tile_grid_size = STRING_SEARCH_SPACE_DISTRIBUTION_FIELD
+ tile_overlap_ratio = FLOAT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ tile_predictions_nms_threshold = FLOAT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ validation_iou_threshold = FLOAT_SEARCH_SPACE_DISTRIBUTION_FIELD
+ validation_metric_type = VALIDATION_METRIC_DISTRIBUTION_FIELD
+
+ @post_dump
+ def conversion(self, data, **kwargs):
+ if self.context.get("inside_pipeline", False): # pylint: disable=no-member
+ # AutoML job inside pipeline does load(dump) instead of calling to_rest_object
+ # explicitly for creating the autoRest Object from sdk job object.
+ # Hence for pipeline job, we explicitly convert Sweep Distribution dict to str after dump in this method.
+ # For standalone automl job, same conversion happens in image_object_detection_job._to_rest_object()
+ from azure.ai.ml.entities._job.automl.search_space_utils import _convert_sweep_dist_dict_to_str_dict
+
+ data = _convert_sweep_dist_dict_to_str_dict(data)
+ return data
+
+ @pre_load
+ def before_make(self, data, **kwargs):
+ if self.context.get("inside_pipeline", False): # pylint: disable=no-member
+ from azure.ai.ml.entities._job.automl.search_space_utils import _convert_sweep_dist_str_to_dict
+
+ # Converting Sweep Distribution str to Sweep Distribution dict for complying with search_space schema.
+ data = _convert_sweep_dist_str_to_dict(data)
+ return data
+
+ @post_load
+ def make(self, data, **kwargs):
+ from azure.ai.ml.automl import ImageObjectDetectionSearchSpace
+
+ return ImageObjectDetectionSearchSpace(**data)
+
+
+# pylint: disable-next=name-too-long
+class ImageModelDistributionSettingsObjectDetectionSchema(ImageModelDistributionSettingsDetectionCommonSchema):
+ model_name = STRING_SEARCH_SPACE_DISTRIBUTION_FIELD
+
+
+# pylint: disable-next=name-too-long
+class ImageModelDistributionSettingsInstanceSegmentationSchema(ImageModelDistributionSettingsObjectDetectionSchema):
+ model_name = STRING_SEARCH_SPACE_DISTRIBUTION_FIELD
diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_model_settings.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_model_settings.py
new file mode 100644
index 00000000..7c88e628
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_model_settings.py
@@ -0,0 +1,96 @@
+# ---------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# ---------------------------------------------------------
+
+# pylint: disable=unused-argument
+
+from marshmallow import fields, post_load
+
+from azure.ai.ml._restclient.v2023_04_01_preview.models import (
+ LearningRateScheduler,
+ ModelSize,
+ StochasticOptimizer,
+ ValidationMetricType,
+)
+from azure.ai.ml._schema.core.fields import StringTransformedEnum
+from azure.ai.ml._schema.core.schema import PatchedSchemaMeta
+from azure.ai.ml._utils.utils import camel_to_snake
+
+
+class ImageModelSettingsSchema(metaclass=PatchedSchemaMeta):
+ ams_gradient = fields.Bool()
+ advanced_settings = fields.Str()
+ beta1 = fields.Float()
+ beta2 = fields.Float()
+ checkpoint_frequency = fields.Int()
+ checkpoint_run_id = fields.Str()
+ distributed = fields.Bool()
+ early_stopping = fields.Bool()
+ early_stopping_delay = fields.Int()
+ early_stopping_patience = fields.Int()
+ evaluation_frequency = fields.Int()
+ enable_onnx_normalization = fields.Bool()
+ gradient_accumulation_step = fields.Int()
+ layers_to_freeze = fields.Int()
+ learning_rate = fields.Float()
+ learning_rate_scheduler = StringTransformedEnum(
+ allowed_values=[o.value for o in LearningRateScheduler],
+ casing_transform=camel_to_snake,
+ )
+ model_name = fields.Str()
+ momentum = fields.Float()
+ nesterov = fields.Bool()
+ number_of_epochs = fields.Int()
+ number_of_workers = fields.Int()
+ optimizer = StringTransformedEnum(
+ allowed_values=[o.value for o in StochasticOptimizer],
+ casing_transform=camel_to_snake,
+ )
+ random_seed = fields.Int()
+ step_lr_gamma = fields.Float()
+ step_lr_step_size = fields.Int()
+ training_batch_size = fields.Int()
+ validation_batch_size = fields.Int()
+ warmup_cosine_lr_cycles = fields.Float()
+ warmup_cosine_lr_warmup_epochs = fields.Int()
+ weight_decay = fields.Float()
+
+
+class ImageModelSettingsClassificationSchema(ImageModelSettingsSchema):
+ training_crop_size = fields.Int()
+ validation_crop_size = fields.Int()
+ validation_resize_size = fields.Int()
+ weighted_loss = fields.Int()
+
+ @post_load
+ def make(self, data, **kwargs):
+ from azure.ai.ml.entities._job.automl.image.image_model_settings import ImageModelSettingsClassification
+
+ return ImageModelSettingsClassification(**data)
+
+
+class ImageModelSettingsObjectDetectionSchema(ImageModelSettingsSchema):
+ box_detections_per_image = fields.Int()
+ box_score_threshold = fields.Float()
+ image_size = fields.Int()
+ max_size = fields.Int()
+ min_size = fields.Int()
+ model_size = StringTransformedEnum(allowed_values=[o.value for o in ModelSize], casing_transform=camel_to_snake)
+ multi_scale = fields.Bool()
+ nms_iou_threshold = fields.Float()
+ tile_grid_size = fields.Str()
+ tile_overlap_ratio = fields.Float()
+ tile_predictions_nms_threshold = fields.Float()
+ validation_iou_threshold = fields.Float()
+ validation_metric_type = StringTransformedEnum(
+ allowed_values=[o.value for o in ValidationMetricType],
+ casing_transform=camel_to_snake,
+ )
+ log_training_metrics = fields.Str()
+ log_validation_loss = fields.Str()
+
+ @post_load
+ def make(self, data, **kwargs):
+ from azure.ai.ml.entities._job.automl.image.image_model_settings import ImageModelSettingsObjectDetection
+
+ return ImageModelSettingsObjectDetection(**data)
diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_object_detection.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_object_detection.py
new file mode 100644
index 00000000..cb753882
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_object_detection.py
@@ -0,0 +1,66 @@
+# ---------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# ---------------------------------------------------------
+
+# pylint: disable=unused-argument
+
+from typing import Any, Dict
+
+from marshmallow import fields, post_load
+
+from azure.ai.ml._restclient.v2023_04_01_preview.models import (
+ InstanceSegmentationPrimaryMetrics,
+ ObjectDetectionPrimaryMetrics,
+ TaskType,
+)
+from azure.ai.ml._schema.automl.image_vertical.image_model_distribution_settings import (
+ ImageModelDistributionSettingsInstanceSegmentationSchema,
+ ImageModelDistributionSettingsObjectDetectionSchema,
+)
+from azure.ai.ml._schema.automl.image_vertical.image_model_settings import ImageModelSettingsObjectDetectionSchema
+from azure.ai.ml._schema.automl.image_vertical.image_vertical import ImageVerticalSchema
+from azure.ai.ml._schema.core.fields import NestedField, StringTransformedEnum
+from azure.ai.ml._utils.utils import camel_to_snake
+from azure.ai.ml.constants._job.automl import AutoMLConstants
+
+
+class ImageObjectDetectionSchema(ImageVerticalSchema):
+ task_type = StringTransformedEnum(
+ allowed_values=TaskType.IMAGE_OBJECT_DETECTION,
+ casing_transform=camel_to_snake,
+ data_key=AutoMLConstants.TASK_TYPE_YAML,
+ required=True,
+ )
+ primary_metric = StringTransformedEnum(
+ allowed_values=ObjectDetectionPrimaryMetrics.MEAN_AVERAGE_PRECISION,
+ casing_transform=camel_to_snake,
+ load_default=camel_to_snake(ObjectDetectionPrimaryMetrics.MEAN_AVERAGE_PRECISION),
+ )
+ training_parameters = NestedField(ImageModelSettingsObjectDetectionSchema())
+ search_space = fields.List(NestedField(ImageModelDistributionSettingsObjectDetectionSchema()))
+
+ @post_load
+ def make(self, data, **kwargs) -> Dict[str, Any]:
+ data.pop("task_type")
+ return data
+
+
+class ImageInstanceSegmentationSchema(ImageVerticalSchema):
+ task_type = StringTransformedEnum(
+ allowed_values=TaskType.IMAGE_INSTANCE_SEGMENTATION,
+ casing_transform=camel_to_snake,
+ data_key=AutoMLConstants.TASK_TYPE_YAML,
+ required=True,
+ )
+ primary_metric = StringTransformedEnum(
+ allowed_values=[InstanceSegmentationPrimaryMetrics.MEAN_AVERAGE_PRECISION],
+ casing_transform=camel_to_snake,
+ load_default=camel_to_snake(InstanceSegmentationPrimaryMetrics.MEAN_AVERAGE_PRECISION),
+ )
+ training_parameters = NestedField(ImageModelSettingsObjectDetectionSchema())
+ search_space = fields.List(NestedField(ImageModelDistributionSettingsInstanceSegmentationSchema()))
+
+ @post_load
+ def make(self, data, **kwargs) -> Dict[str, Any]:
+ data.pop("task_type")
+ return data
diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_sweep_settings.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_sweep_settings.py
new file mode 100644
index 00000000..66dfd7ae
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_sweep_settings.py
@@ -0,0 +1,27 @@
+# ---------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# ---------------------------------------------------------
+
+# pylint: disable=unused-argument,protected-access
+
+from marshmallow import post_load, pre_dump
+
+from azure.ai.ml._schema._sweep.sweep_fields_provider import EarlyTerminationField, SamplingAlgorithmField
+from azure.ai.ml._schema.core.schema import PatchedSchemaMeta
+
+
+class ImageSweepSettingsSchema(metaclass=PatchedSchemaMeta):
+ sampling_algorithm = SamplingAlgorithmField()
+ early_termination = EarlyTerminationField()
+
+ @pre_dump
+ def conversion(self, data, **kwargs):
+ rest_obj = data._to_rest_object()
+ rest_obj.early_termination = data.early_termination
+ return rest_obj
+
+ @post_load
+ def make(self, data, **kwargs):
+ from azure.ai.ml.automl import ImageSweepSettings
+
+ return ImageSweepSettings(**data)
diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_vertical.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_vertical.py
new file mode 100644
index 00000000..fdfaa79f
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_schema/automl/image_vertical/image_vertical.py
@@ -0,0 +1,19 @@
+# ---------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# ---------------------------------------------------------
+
+from azure.ai.ml._schema.automl.automl_vertical import AutoMLVerticalSchema
+from azure.ai.ml._schema.automl.image_vertical.image_limit_settings import ImageLimitsSchema
+from azure.ai.ml._schema.automl.image_vertical.image_sweep_settings import ImageSweepSettingsSchema
+from azure.ai.ml._schema.core.fields import NestedField, UnionField, fields
+from azure.ai.ml._schema.job.input_output_entry import MLTableInputSchema
+
+
+class ImageVerticalSchema(AutoMLVerticalSchema):
+ limits = NestedField(ImageLimitsSchema())
+ sweep = NestedField(ImageSweepSettingsSchema())
+ target_column_name = fields.Str(required=True)
+ test_data = UnionField([NestedField(MLTableInputSchema)])
+ test_data_size = fields.Float()
+ validation_data = UnionField([NestedField(MLTableInputSchema)])
+ validation_data_size = fields.Float()