Skip to content

Commit 81bb715

Browse files
Merge pull request #220848 from rdondera-microsoft/patch-3
Relocate paragraphs on primary metric, job limits and data augmentation
2 parents 89085e4 + 5b5886b commit 81bb715

File tree

1 file changed

+57
-58
lines changed

1 file changed

+57
-58
lines changed

articles/machine-learning/how-to-auto-train-image-models.md

Lines changed: 57 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,52 @@ For computer vision tasks, you can launch either [individual runs](#individual-r
270270

271271
Automatic sweeps can yield competitive results for many datasets. Additionally, they do not require advanced knowledge of model architectures, they take into account hyperparameter correlations and they work seamlessly across different hardware setups. All these reasons make them a strong option for the early stage of your experimentation process.
272272

273-
## Automatically sweeping model hyperparameters (AutoMode)
273+
### Primary metric
274+
275+
An AutoML training job uses a primary metric for model optimization and hyperparameter tuning. The primary metric depends on the task type as shown below; other primary metric values are currently not supported.
276+
277+
* `accuracy` for IMAGE_CLASSIFICATION
278+
* `iou` for IMAGE_CLASSIFICATION_MULTILABEL
279+
* `mean_average_precision` for IMAGE_OBJECT_DETECTION
280+
* `mean_average_precision` for IMAGE_INSTANCE_SEGMENTATION
281+
282+
### Job limits
283+
284+
You can control the resources spent on your AutoML Image training job by specifying the `timeout_minutes`, `max_trials` and the `max_concurrent_trials` for the job in limit settings as described in the below example.
285+
286+
Parameter | Detail
287+
-----|----
288+
`max_trials` | Parameter for maximum number of configurations to sweep. Must be an integer between 1 and 1000. When exploring just the default hyperparameters for a given model algorithm, set this parameter to 1. The default value is 1.
289+
`max_concurrent_trials`| Maximum number of runs that can run concurrently. If specified, must be an integer between 1 and 100. The default value is 1. <br><br> **NOTE:** <li> The number of concurrent runs is gated on the resources available in the specified compute target. Ensure that the compute target has the available resources for the desired concurrency. <li> `max_concurrent_trials` is capped at `max_trials` internally. For example, if user sets `max_concurrent_trials=4`, `max_trials=2`, values would be internally updated as `max_concurrent_trials=2`, `max_trials=2`.
290+
`timeout_minutes`| The amount of time in minutes before the experiment terminates. If none specified, default experiment timeout_minutes is seven days (maximum 60 days)
291+
292+
# [Azure CLI](#tab/cli)
293+
294+
[!INCLUDE [cli v2](../../includes/machine-learning-cli-v2.md)]
295+
296+
```yaml
297+
limits:
298+
timeout_minutes: 60
299+
max_trials: 10
300+
max_concurrent_trials: 2
301+
```
302+
303+
# [Python SDK](#tab/python)
304+
305+
[!INCLUDE [sdk v2](../../includes/machine-learning-sdk-v2.md)]
306+
307+
[!Notebook-python[] (~/azureml-examples-main/sdk/python/jobs/automl-standalone-jobs/automl-image-object-detection-task-fridge-items/automl-image-object-detection-task-fridge-items.ipynb?name=limit-settings)]
308+
309+
---
310+
311+
### Automatically sweeping model hyperparameters (AutoMode)
274312

275313
> [!IMPORTANT]
276314
> This feature is currently in public preview. This preview version is provided without a service-level agreement. Certain features might not be supported or might have constrained capabilities. For more information, see [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/).
277315

278316
It is generally hard to predict the best model architecture and hyperparameters for a dataset. Also, in some cases the human time allocated to tuning hyperparameters may be limited. For computer vision tasks, you can specify a number of runs and the system will automatically determine the region of the hyperparameter space to sweep. You do not have to define a hyperparameter search space, a sampling method or an early termination policy.
279317

280-
### Triggering AutoMode
318+
#### Triggering AutoMode
281319

282320
You can run automatic sweeps by setting `max_trials` to a value greater than 1 in `limits` and by not specifying the search space, sampling method and termination policy. We call this functionality AutoMode; please see an example below.
283321

@@ -306,11 +344,11 @@ A number of runs between 10 and 20 will likely work well on many datasets. The [
306344
> Launching automatic sweeps via the UI is not supported at this time.
307345

308346

309-
## Individual runs
347+
### Individual runs
310348

311349
In individual runs, you directly control the model algorithm and hyperparameters. The model algorithm is passed via the `model_name` parameter.
312350

313-
### Supported model algorithms
351+
#### Supported model algorithms
314352

315353
The following table summarizes the supported models for each computer vision task.
316354

@@ -344,55 +382,7 @@ image_object_detection_job.set_training_parameters(model_name="yolov5")
344382
```
345383
---
346384

347-
### Data augmentation
348-
349-
In general, deep learning model performance can often improve with more data. Data augmentation is a practical technique to amplify the data size and variability of a dataset which helps to prevent overfitting and improve the model’s generalization ability on unseen data. Automated ML applies different data augmentation techniques based on the computer vision task, before feeding input images to the model. Currently, there's no exposed hyperparameter to control data augmentations.
350-
351-
|Task | Impacted dataset | Data augmentation technique(s) applied |
352-
|-------|----------|---------|
353-
|Image classification (multi-class and multi-label) | Training <br><br><br> Validation & Test| Random resize and crop, horizontal flip, color jitter (brightness, contrast, saturation, and hue), normalization using channel-wise ImageNet’s mean and standard deviation <br><br><br>Resize, center crop, normalization |
354-
|Object detection, instance segmentation| Training <br><br> Validation & Test |Random crop around bounding boxes, expand, horizontal flip, normalization, resize <br><br><br>Normalization, resize
355-
|Object detection using yolov5| Training <br><br> Validation & Test |Mosaic, random affine (rotation, translation, scale, shear), horizontal flip <br><br><br> Letterbox resizing|
356-
357-
### Primary metric
358-
359-
The primary metric used for model optimization and hyperparameter tuning depends on the task type. Using other primary metric values is currently not supported.
360-
361-
* `accuracy` for IMAGE_CLASSIFICATION
362-
* `iou` for IMAGE_CLASSIFICATION_MULTILABEL
363-
* `mean_average_precision` for IMAGE_OBJECT_DETECTION
364-
* `mean_average_precision` for IMAGE_INSTANCE_SEGMENTATION
365-
366-
### Job Limits
367-
368-
You can control the resources spent on your AutoML Image training job by specifying the `timeout_minutes`, `max_trials` and the `max_concurrent_trials` for the job in limit settings as described in the below example.
369-
370-
Parameter | Detail
371-
-----|----
372-
`max_trials` | Parameter for maximum number of configurations to sweep. Must be an integer between 1 and 1000. When exploring just the default hyperparameters for a given model algorithm, set this parameter to 1. The default value is 1.
373-
`max_concurrent_trials`| Maximum number of runs that can run concurrently. If specified, must be an integer between 1 and 100. The default value is 1. <br><br> **NOTE:** <li> The number of concurrent runs is gated on the resources available in the specified compute target. Ensure that the compute target has the available resources for the desired concurrency. <li> `max_concurrent_trials` is capped at `max_trials` internally. For example, if user sets `max_concurrent_trials=4`, `max_trials=2`, values would be internally updated as `max_concurrent_trials=2`, `max_trials=2`.
374-
`timeout_minutes`| The amount of time in minutes before the experiment terminates. If none specified, default experiment timeout_minutes is seven days (maximum 60 days)
375-
376-
# [Azure CLI](#tab/cli)
377-
378-
[!INCLUDE [cli v2](../../includes/machine-learning-cli-v2.md)]
379-
380-
```yaml
381-
limits:
382-
timeout_minutes: 60
383-
max_trials: 10
384-
max_concurrent_trials: 2
385-
```
386-
387-
# [Python SDK](#tab/python)
388-
389-
[!INCLUDE [sdk v2](../../includes/machine-learning-sdk-v2.md)]
390-
391-
[!Notebook-python[] (~/azureml-examples-main/sdk/python/jobs/automl-standalone-jobs/automl-image-object-detection-task-fridge-items/automl-image-object-detection-task-fridge-items.ipynb?name=limit-settings)]
392-
393-
---
394-
395-
## Manually sweeping model hyperparameters
385+
### Manually sweeping model hyperparameters
396386

397387
When training computer vision models, model performance depends heavily on the hyperparameter values selected. Often, you might want to tune the hyperparameters to get optimal performance. For computer vision tasks, you can sweep hyperparameters to find the optimal settings for your model. This feature applies the hyperparameter tuning capabilities in Azure Machine Learning. [Learn how to tune hyperparameters](how-to-tune-hyperparameters.md).
398388

@@ -436,15 +426,15 @@ search_space:
436426

437427
---
438428

439-
### Define the parameter search space
429+
#### Define the parameter search space
440430

441431
You can define the model algorithms and hyperparameters to sweep in the parameter space. You can either specify a single model algorithm or multiple ones.
442432

443433
* See [Individual runs](#individual-runs) for the list of supported model algorithms for each task type.
444434
* See [Hyperparameters for computer vision tasks](reference-automl-images-hyperparameters.md) hyperparameters for each computer vision task type.
445435
* See [details on supported distributions for discrete and continuous hyperparameters](how-to-tune-hyperparameters.md#define-the-search-space).
446436

447-
### Sampling methods for the sweep
437+
#### Sampling methods for the sweep
448438

449439
When sweeping hyperparameters, you need to specify the sampling method to use for sweeping over the defined parameter space. Currently, the following sampling methods are supported with the `sampling_algorithm` parameter:
450440

@@ -457,7 +447,7 @@ When sweeping hyperparameters, you need to specify the sampling method to use fo
457447
> [!NOTE]
458448
> Currently only random and grid sampling support conditional hyperparameter spaces.
459449

460-
### Early termination policies
450+
#### Early termination policies
461451

462452
You can automatically end poorly performing runs with an early termination policy. Early termination improves computational efficiency, saving compute resources that would have been otherwise spent on less promising configurations. Automated ML for images supports the following early termination policies using the `early_termination` parameter. If no termination policy is specified, all configurations are run to completion.
463453

@@ -498,8 +488,7 @@ sweep:
498488

499489
---
500490

501-
502-
### Fixed settings
491+
#### Fixed settings
503492

504493
You can pass fixed settings or parameters that don't change during the parameter space sweep as shown below.
505494

@@ -523,6 +512,16 @@ training_parameters:
523512

524513
---
525514

515+
## Data augmentation
516+
517+
In general, deep learning model performance can often improve with more data. Data augmentation is a practical technique to amplify the data size and variability of a dataset which helps to prevent overfitting and improve the model’s generalization ability on unseen data. Automated ML applies different data augmentation techniques based on the computer vision task, before feeding input images to the model. Currently, there's no exposed hyperparameter to control data augmentations.
518+
519+
|Task | Impacted dataset | Data augmentation technique(s) applied |
520+
|-------|----------|---------|
521+
|Image classification (multi-class and multi-label) | Training <br><br><br> Validation & Test| Random resize and crop, horizontal flip, color jitter (brightness, contrast, saturation, and hue), normalization using channel-wise ImageNet’s mean and standard deviation <br><br><br>Resize, center crop, normalization |
522+
|Object detection, instance segmentation| Training <br><br> Validation & Test |Random crop around bounding boxes, expand, horizontal flip, normalization, resize <br><br><br>Normalization, resize
523+
|Object detection using yolov5| Training <br><br> Validation & Test |Mosaic, random affine (rotation, translation, scale, shear), horizontal flip <br><br><br> Letterbox resizing|
524+
526525
## Incremental training (optional)
527526

528527
Once the training run is done, you have the option to further train the model by loading the trained model checkpoint. You can either use the same dataset or a different one for incremental training.

0 commit comments

Comments
 (0)