You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/machine-learning/how-to-auto-train-image-models.md
+7-54Lines changed: 7 additions & 54 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,8 @@ services: machine-learning
6
6
author: swatig007
7
7
ms.author: swatig
8
8
ms.service: machine-learning
9
-
ms.subservice: core
9
+
ms.subservice: automl
10
10
ms.topic: how-to
11
-
ms.custom: automl
12
11
ms.date: 10/06/2021
13
12
14
13
# Customer intent: I'm a data scientist with ML knowledge in the computer vision space, looking to build ML models using image data in Azure Machine Learning with full control of the model algorithm, hyperparameters, and training and deployment environments.
This task type is a required parameter and is passed in using the `task` parameter in the `AutoMLImageConfig`.
53
+
This task type is a required parameter and is passed in using the `task` parameter in the [`AutoMLImageConfig`](/python/api/azureml-train-automl-client/azureml.train.automl.automlimageconfig.automlimageconfig).
54
+
55
55
For example:
56
56
57
57
```python
@@ -192,63 +192,28 @@ The model algorithm is required and is passed in via `model_name` parameter. You
192
192
193
193
### Supported model algorithms
194
194
195
-
The following table summarizes the supported models for each computer vision task.
195
+
The following table summarizes the supported models for each computer vision task. See the reference documentation for model specific hyperparameters.
196
196
197
197
Task | Model algorithms | String literal syntax<br> ***`default_model`\**** denoted with \*
The following table describes the hyperparameters that are model agnostic.
207
-
208
-
| Parameter name | Description | Default|
209
-
| ------------ | ------------- | ------------ |
210
-
|`number_of_epochs`| Number of training epochs. <br>Must be a positive integer. | 15 <br> (except `yolov5`: 30) |
211
-
|`training_batch_size`| Training batch size.<br> Must be a positive integer. | Multi-class/multi-label: 78 <br>(except *vit-variants*: <br> `vits16r224`: 128 <br>`vitb16r224`: 48 <br>`vitl16r224`:10)<br><br>Object detection: 2 <br>(except `yolov5`: 16) <br><br> Instance segmentation: 2 <br> <br> *Note: The defaults are largest batch size that can be used on 12 GiB GPU memory*.|
212
-
|`validation_batch_size`| Validation batch size.<br> Must be a positive integer. | Multi-class/multi-label: 78 <br>(except *vit-variants*: <br> `vits16r224`: 128 <br>`vitb16r224`: 48 <br>`vitl16r224`:10)<br><br>Object detection: 1 <br>(except `yolov5`: 16) <br><br> Instance segmentation: 1 <br> <br> *Note: The defaults are largest batch size that can be used on 12 GiB GPU memory*.|
213
-
|`grad_accumulation_step`| Gradient accumulation means running a configured number of `grad_accumulation_step` without updating the model weights while accumulating the gradients of those steps, and then using the accumulated gradients to compute the weight updates. <br> Must be a positive integer. | 1 |
214
-
|`early_stopping`| Enable early stopping logic during training. <br> Must be 0 or 1.| 1 |
215
-
|`early_stopping_patience`| Minimum number of epochs or validation evaluations with<br>no primary metric improvement before the run is stopped.<br> Must be a positive integer. | 5 |
216
-
|`early_stopping_delay`| Minimum number of epochs or validation evaluations to wait<br>before primary metric improvement is tracked for early stopping.<br> Must be a positive integer. | 5 |
217
-
|`learning_rate`| Initial learning rate. <br>Must be a float in the range [0, 1]. | Multi-class: 0.01 <br>(except *vit-variants*: <br> `vits16r224`: 0.0125<br>`vitb16r224`: 0.0125<br>`vitl16r224`: 0.001) <br><br> Multi-label: 0.035 <br>(except *vit-variants*:<br>`vits16r224`: 0.025<br>`vitb16r224`: 0.025 <br>`vitl16r224`: 0.002) <br><br> Object detection: 0.005 <br>(except `yolov5`: 0.01) <br><br> Instance segmentation: 0.005 |
218
-
|`lr_scheduler`| Type of learning rate scheduler. <br> Must be `warmup_cosine` or `step`. |`warmup_cosine`|
219
-
|`step_lr_gamma`| Value of gamma when learning rate scheduler is `step`.<br> Must be a float in the range [0, 1]. | 0.5 |
220
-
|`step_lr_step_size`| Value of step size when learning rate scheduler is `step`.<br> Must be a positive integer. | 5 |
221
-
|`warmup_cosine_lr_cycles`| Value of cosine cycle when learning rate scheduler is `warmup_cosine`. <br> Must be a float in the range [0, 1]. | 0.45 |
222
-
|`warmup_cosine_lr_warmup_epochs`| Value of warmup epochs when learning rate scheduler is `warmup_cosine`. <br> Must be a positive integer. | 2 |
223
-
|`optimizer`| Type of optimizer. <br> Must be either `sgd`, `adam`, `adamw`. |`sgd`|
224
-
|`momentum`| Value of momentum when optimizer is `sgd`. <br> Must be a float in the range [0, 1]. | 0.9 |
225
-
|`weight_decay`| Value of weight decay when optimizer is `sgd`, `adam`, or `adamw`. <br> Must be a float in the range [0, 1]. | 1e-4 |
226
-
|`nesterov`| Enable `nesterov` when optimizer is `sgd`. <br> Must be 0 or 1.| 1 |
227
-
|`beta1`| Value of `beta1` when optimizer is `adam` or `adamw`. <br> Must be a float in the range [0, 1]. | 0.9 |
228
-
|`beta2`| Value of `beta2` when optimizer is `adam` or `adamw`.<br> Must be a float in the range [0, 1]. | 0.999 |
229
-
|`amsgrad`| Enable `amsgrad` when optimizer is `adam` or `adamw`.<br> Must be 0 or 1. | 0 |
230
-
|`evaluation_frequency`| Frequency to evaluate validation dataset to get metric scores. <br> Must be a positive integer. | 1 |
231
-
|`split_ratio`| If validation data is not defined, this specifies the split ratio for splitting train data into random train and validation subsets. <br> Must be a float in the range [0, 1].| 0.2 |
232
-
|`checkpoint_frequency`| Frequency to store model checkpoints. <br> Must be a positive integer. | Checkpoint at epoch with best primary metric on validation.|
233
-
|`layers_to_freeze`| How many layers to freeze for your model. For instance, passing 2 as value for `seresnext` means freezing layer0 and layer1 referring to the below supported model layer info. <br> Must be a positive integer. <br><br>`'resnet': [('conv1.', 'bn1.'), 'layer1.', 'layer2.', 'layer3.', 'layer4.'],`<br>`'mobilenetv2': ['features.0.', 'features.1.', 'features.2.', 'features.3.', 'features.4.', 'features.5.', 'features.6.', 'features.7.', 'features.8.', 'features.9.', 'features.10.', 'features.11.', 'features.12.', 'features.13.', 'features.14.', 'features.15.', 'features.16.', 'features.17.', 'features.18.'],`<br>`'seresnext': ['layer0.', 'layer1.', 'layer2.', 'layer3.', 'layer4.'],`<br>`'vit': ['patch_embed', 'blocks.0.', 'blocks.1.', 'blocks.2.', 'blocks.3.', 'blocks.4.', 'blocks.5.', 'blocks.6.','blocks.7.', 'blocks.8.', 'blocks.9.', 'blocks.10.', 'blocks.11.'],`<br>`'yolov5_backbone': ['model.0.', 'model.1.', 'model.2.', 'model.3.', 'model.4.','model.5.', 'model.6.', 'model.7.', 'model.8.', 'model.9.'],`<br>`'resnet_backbone': ['backbone.body.conv1.', 'backbone.body.layer1.', 'backbone.body.layer2.','backbone.body.layer3.', 'backbone.body.layer4.']` | no default |
234
-
235
-
236
203
### Task-specific hyperparameters
237
204
238
205
The following table summarizes hyperparmeters for image classification (multi-class and multi-label) tasks.
239
-
240
-
206
+
241
207
| Parameter name | Description | Default |
242
208
| ------------- |-------------|-----|
243
209
|`weighted_loss`| 0 for no weighted loss.<br>1 for weighted loss with sqrt.(class_weights) <br> 2 for weighted loss with class_weights. <br> Must be 0 or 1 or 2. | 0 |
244
210
|`valid_resize_size`| Image size to which to resize before cropping for validation dataset. <br> Must be a positive integer. <br> <br> *Notes: <li> `seresnext` doesn't take an arbitrary size. <li> Training run may get into CUDA OOM if the size is too big*. | 256 |
245
211
|`valid_crop_size`| Image crop size that's input to your neural network for validation dataset. <br> Must be a positive integer. <br> <br> *Notes: <li> `seresnext` doesn't take an arbitrary size. <li> *ViT-variants* should have the same `valid_crop_size` and `train_crop_size`. <li> Training run may get into CUDA OOM if the size is too big*. | 224 |
246
-
|`train_crop_size`| Image crop size that's input to your neural network for train dataset. <br> Must be a positive integer. <br> <br> *Notes: <li> `seresnext` doesn't take an arbitrary size. <li> *ViT-variants* should have the same `valid_crop_size` and `train_crop_size`. <li> Training run may get into CUDA OOM if the size is too big*. | 224 |
247
-
212
+
|`train_crop_size`| Image crop size that's input to your neural network for train dataset. <br> Must be a positive integer. <br> <br> *Notes: <li> `seresnext` doesn't take an arbitrary size. <li> *ViT-variants* should have the same `valid_crop_size` and `train_crop_size`. <li> Training run may get into CUDA OOM if the size is too big*. | 224 |
248
213
249
214
The following hyperparameters are for object detection and instance segmentation tasks.
250
215
251
-
> [!Warning]
216
+
> [!WARNING]
252
217
> These parameters are not supported with the `yolov5` algorithm.
253
218
254
219
| Parameter name | Description | Default |
@@ -263,18 +228,6 @@ The following hyperparameters are for object detection and instance segmentation
263
228
|`tile_overlap_ratio`| Overlap ratio between adjacent tiles in each dimension. <br> Must be float in the range of [0, 1) | 0.25 |
264
229
|`tile_predictions_nms_thresh`| The IOU threshold to use to perform NMS while merging predictions from tiles and image. Used in validation/ inference. <br> Must be float in the range of [0, 1]| 0.25 |
265
230
266
-
### Model-specific hyperparameters
267
-
268
-
This table summarizes hyperparameters specific to the `yolov5` algorithm.
269
-
270
-
| Parameter name | Description | Default |
271
-
| ------------- |-------------|----|
272
-
|`validation_metric_type`| Metric computation method to use for validation metrics. <br> Must be `none`, `coco`, `voc`, or `coco_voc`. |`voc`|
273
-
|`img_size`| Image size for train and validation. <br> Must be a positive integer. <br> <br> *Note: training run may get into CUDA OOM if the size is too big*. | 640 |
274
-
|`model_size`| Model size. <br> Must be `small`, `medium`, `large`, or `xlarge`. <br><br> *Note: training run may get into CUDA OOM if the model size is too big*. |`medium`|
275
-
|`multi_scale`| Enable multi-scale image by varying image size by +/- 50% <br> Must be 0 or 1. <br> <br> *Note: training run may get into CUDA OOM if no sufficient GPU memory*. | 0 |
276
-
|`box_score_thresh`| During inference, only return proposals with a score greater than `box_score_thresh`. The score is the multiplication of the objectness score and classification probability. <br> Must be a float in the range [0, 1]. | 0.1 |
277
-
|`box_iou_thresh`| IoU threshold used during inference in non-maximum suppression post processing. <br> Must be a float in the range [0, 1]. | 0.5 |
0 commit comments