Skip to content

Commit 95db5d6

Browse files
committed
toc entry + PM edits
1 parent a09cc70 commit 95db5d6

File tree

2 files changed

+75
-5
lines changed

2 files changed

+75
-5
lines changed

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

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ automl_image_config = AutoMLImageConfig(compute_target=compute_target)
186186

187187
With support for computer vision tasks, you can control the model algorithm and sweep hyperparameters. These model algorithms and hyperparameters are passed in as the parameter space for the sweep.
188188

189-
The model algorithm is required and is passed in via `model_name` parameter. You can either specify a single `model_name` or choose between multiple. In addition to controlling the model algorithm, you can also tune hyperparameters used for model training. While many of the hyperparameters exposed are model-agnostic, there are instances where hyperparameters are task-specific or model-specific. [Learn more about the available hyperparameters for these instances]().
189+
The model algorithm is required and is passed in via `model_name` parameter. You can either specify a single `model_name` or choose between multiple. In addition to controlling the model algorithm, you can also tune hyperparameters used for model training. While many of the hyperparameters exposed are model-agnostic, there are instances where hyperparameters are task-specific or model-specific. [Learn more about the available hyperparameters for these instances](reference-automl-images-hyperparameter.md).
190190

191191
### Supported model algorithms
192192

@@ -198,7 +198,6 @@ Image classification<br> (multi-class and multi-label)| **MobileNet**: Light-wei
198198
Object detection | **YOLOv5**: One stage object detection model <br> **Faster RCNN ResNet FPN**: Two stage object detection models <br> **RetinaNet ResNet FPN**: address class imbalance with Focal Loss <br> <br>*Note: Refer to [`model_size` hyperparameter](#model-specific-hyperparameters) for YOLOv5 model sizes.*| ***`yolov5`\**** <br> `fasterrcnn_resnet18_fpn` <br> `fasterrcnn_resnet34_fpn` <br> `fasterrcnn_resnet50_fpn` <br> `fasterrcnn_resnet101_fpn` <br> `fasterrcnn_resnet152_fpn` <br> `retinanet_resnet50_fpn`
199199
Instance segmentation | **MaskRCNN ResNet FPN**| `maskrcnn_resnet18_fpn` <br> `maskrcnn_resnet34_fpn` <br> ***`maskrcnn_resnet50_fpn`\**** <br> `maskrcnn_resnet101_fpn` <br> `maskrcnn_resnet152_fpn` <br>`maskrcnn_resnet50_fpn`
200200

201-
202201
### Data augmentation
203202

204203
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 is no exposed hyperparameter to control data augmentations.
@@ -243,15 +242,19 @@ The primary metric used for model optimization and hyperparameter tuning depends
243242

244243
You can optionally specify the maximum time budget for your AutoML Vision experiment using `experiment_timeout_hours` - the amount of time in hours before the experiment terminates. If none specified, default experiment timeout is seven days (maximum 60 days).
245244

245+
246246
## Sweeping hyperparameters for your model
247247

248248
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.
249249
With support for computer vision tasks in automated ML, 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).
250250

251251
### Define the parameter search space
252252

253-
You can define the model algorithms and hyperparameters to sweep in the parameter space. See [Configure model algorithms and hyperparameters](#configure-model-algorithms-and-hyperparameters) for the list of supported model algorithms and hyperparameters for each task type. See [details on supported distributions for discrete and continuous hyperparameters](how-to-tune-hyperparameters.md#define-the-search-space).
253+
You can define the model algorithms and hyperparameters to sweep in the parameter space.
254254

255+
* See [Configure model algorithms and hyperparameters](#configure-model-algorithms-and-hyperparameters) for the list of supported model algorithms for each task type.
256+
* See [Hyperparameters for computer vision tasks](reference-automl-images-hyperparameters.md) hyperparameters for each computer vision task type.
257+
* See [details on supported distributions for discrete and continuous hyperparameters](how-to-tune-hyperparameters.md#define-the-search-space).
255258

256259
### Sampling methods for the sweep
257260

@@ -261,8 +264,8 @@ When sweeping hyperparameters, you need to specify the sampling method to use fo
261264
* [Grid sampling](how-to-tune-hyperparameters.md#grid-sampling)
262265
* [Bayesian sampling](how-to-tune-hyperparameters.md#bayesian-sampling)
263266

264-
It should be noted that currently only random sampling supports conditional hyperparameter spaces
265-
267+
> [!NOTE]
268+
> Currently only random sampling supports conditional hyperparameter spaces.
266269
267270
### Early termination policies
268271

@@ -306,6 +309,70 @@ ws = Workspace.from_config()
306309
experiment = Experiment(ws, "Tutorial-automl-image-object-detection")
307310
automl_image_run = experiment.submit(automl_image_config)
308311
```
312+
313+
## Incremental training (optional)
314+
315+
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.
316+
317+
There are two available options for incremental training. You can,
318+
319+
* Pass the run ID that you want to load the checkpoint from
320+
* Pass the checkpoints through a FileDataset.
321+
322+
### Pass the checkpoint via run ID
323+
To find the run ID from the desired model, you can use the following code.
324+
325+
```python
326+
# find a run id to get a model checkpoint from
327+
target_checkpoint_run = automl_image_run.get_best_child()
328+
```
329+
330+
To pass a checkpoint via the run ID, you need to use the `checkpoint_run_id` parameter.
331+
332+
```python
333+
automl_image_config = AutoMLImageConfig(task='image-object-detection',
334+
compute_target=compute_target,
335+
training_data=training_dataset,
336+
validation_data=validation_dataset,
337+
checkpoint_run_id= target_checkpoint_run.id,
338+
primary_metric='mean_average_precision',
339+
**tuning_settings)
340+
341+
automl_image_run = experiment.submit(automl_image_config)
342+
automl_image_run.wait_for_completion(wait_post_processing=True)
343+
```
344+
345+
### Pass the checkpoint via FileDataset
346+
To pass a checkpoint via a FileDataset, you need to use the `checkpoint_dataset_id` and `checkpoint_filename` parameters.
347+
348+
```python
349+
# download the checkpoint from the previous run
350+
model_name = "outputs/model.pt"
351+
model_local = "checkpoints/model_yolo.pt"
352+
target_checkpoint_run.download_file(name=model_name, output_file_path=model_local)
353+
354+
# upload the checkpoint to the blob store
355+
ds.upload(src_dir="checkpoints", target_path='checkpoints')
356+
357+
# create a FileDatset for the checkpoint and register it with your workspace
358+
ds_path = ds.path('checkpoints/model_yolo.pt')
359+
checkpoint_yolo = Dataset.File.from_files(path=ds_path)
360+
checkpoint_yolo = checkpoint_yolo.register(workspace=ws, name='yolo_checkpoint')
361+
362+
automl_image_config = AutoMLImageConfig(task='image-object-detection',
363+
compute_target=compute_target,
364+
training_data=training_dataset,
365+
validation_data=validation_dataset,
366+
checkpoint_dataset_id= checkpoint_yolo.id,
367+
checkpoint_filename='model_yolo.pt',
368+
primary_metric='mean_average_precision',
369+
**tuning_settings)
370+
371+
automl_image_run = experiment.submit(automl_image_config)
372+
automl_image_run.wait_for_completion(wait_post_processing=True)
373+
374+
```
375+
309376
## Outputs and evaluation metrics
310377

311378
The automated ML training runs generates output model files, evaluation metrics, logs and deployment artifacts like the scoring file and the environment file which can be viewed from the outputs and logs and metrics tab of the child runs.

articles/machine-learning/toc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,9 @@
818818
- name: Image data schemas for AutoML
819819
displayName: automl, schema, data
820820
href: reference-automl-images-schema.md
821+
- name: Hyperparameters for AutoML computer vision tasks
822+
displayName: automl, yolo-5
823+
href: reference-automl-images-hyperparameters.md
821824
- name: Designer module reference
822825
displayName: module, reference, algorithm, studio
823826
href: algorithm-module-reference/module-reference.md

0 commit comments

Comments
 (0)