@@ -15,8 +15,8 @@ ms.date: 07/13/2022
15
15
16
16
# Set up AutoML to train computer vision models
17
17
18
- [ !INCLUDE [ sdk v2] ( ../../includes/machine-learning-sdk -v2.md )]
19
- > [ !div class="op_single_selector" title1="Select the version of Azure Machine Learning CLI extension you are using:"]
18
+ [ !INCLUDE [ dev v2] ( ../../includes/machine-learning-dev -v2.md )]
19
+ > [ !div class="op_single_selector" title1="Select the version of Azure Machine Learning you are using:"]
20
20
> * [ v1] ( v1/how-to-auto-train-image-models-v1.md )
21
21
> * [ v2 (current version)] ( how-to-auto-train-image-models.md )
22
22
@@ -29,12 +29,17 @@ Automated ML supports model training for computer vision tasks like image classi
29
29
30
30
## Prerequisites
31
31
32
- # [ CLI v2] ( #tab/CLI-v2 )
32
+ # [ Azure CLI] ( #tab/cli )
33
+ [ !INCLUDE [ cli v2] ( ../../includes/machine-learning-cli-v2.md )]
34
+
33
35
34
36
* An Azure Machine Learning workspace. To create the workspace, see [ Create workspace resources] ( quickstart-create-resources.md ) .
35
37
* Install and [ set up CLI (v2)] ( how-to-configure-cli.md#prerequisites ) and make sure you install the ` ml ` extension.
36
38
37
- # [ Python SDK v2 (preview)] ( #tab/SDK-v2 )
39
+ # [ Python SDK] ( #tab/python )
40
+
41
+ [ !INCLUDE [ sdk v2] ( ../../includes/machine-learning-sdk-v2.md )]
42
+
38
43
* An Azure Machine Learning workspace. To create the workspace, see [ Create workspace resources] ( quickstart-create-resources.md ) .
39
44
40
45
* The Azure Machine Learning Python SDK v2 (preview) installed.
@@ -68,7 +73,7 @@ image classification multi-label | CLI v2: `image_classification_multilabel` <br
68
73
image object detection | CLI v2: `image_object_detection` < br> SDK v2: `image_object_detection()`
69
74
image instance segmentation| CLI v2: `image_instance_segmentation` < br> SDK v2: `image_instance_segmentation()`
70
75
71
- # [CLI v2 ](#tab/CLI-v2 )
76
+ # [Azure CLI ](#tab/cli )
72
77
73
78
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
74
79
@@ -80,7 +85,11 @@ For example:
80
85
task: image_object_detection
81
86
```
82
87
83
- # [Python SDK v2 (preview)](#tab/SDK-v2)
88
+ # [Python SDK](#tab/python)
89
+
90
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
91
+
92
+
84
93
Based on the task type , you can create AutoML image jobs using task specific `automl` functions.
85
94
86
95
For example:
@@ -189,7 +198,7 @@ Once your data is in JSONL format, you can create training and validation `MLTab
189
198
190
199
Automated ML doesn' t impose any constraints on training or validation data size for computer vision tasks. Maximum dataset size is only limited by the storage layer behind the dataset (i.e. blob store). There' s no minimum number of images or labels. However, we recommend starting with a minimum of 10 - 15 samples per label to ensure the output model is sufficiently trained. The higher the total number of labels/ classes, the more samples you need per label.
191
200
192
- # [CLI v2 ](#tab/CLI-v2 )
201
+ # [Azure CLI ](#tab/cli )
193
202
194
203
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
195
204
@@ -207,7 +216,9 @@ validation_data:
207
216
type : mltable
208
217
```
209
218
210
- # [Python SDK v2 (preview)](#tab/SDK-v2)
219
+ # [Python SDK](#tab/python)
220
+
221
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
211
222
212
223
You can create data inputs from training and validation MLTable from your local directory or cloud storage with the following code:
213
224
@@ -233,15 +244,17 @@ Provide a [compute target](concept-azure-machine-learning-architecture.md#comput
233
244
234
245
The compute target is passed in using the `compute` parameter. For example:
235
246
236
- # [CLI v2 ](#tab/CLI-v2 )
247
+ # [Azure CLI ](#tab/cli )
237
248
238
249
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
239
250
240
251
```yaml
241
252
compute: azureml:gpu- cluster
242
253
```
243
254
244
- # [Python SDK v2 (preview)](#tab/SDK-v2)
255
+ # [Python SDK](#tab/python)
256
+
257
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
245
258
246
259
```python
247
260
from azure.ai.ml import automl
@@ -286,7 +299,7 @@ In general, deep learning model performance can often improve with more data. Da
286
299
287
300
Before doing a large sweep to search for the optimal models and hyperparameters, we recommend trying the default values to get a first baseline. Next, you can explore multiple hyperparameters for the same model before sweeping over multiple models and their parameters. This way, you can employ a more iterative approach, because with multiple models and multiple hyperparameters for each, the search space grows exponentially and you need more iterations to find optimal configurations.
288
301
289
- # [CLI v2 ](#tab/CLI-v2 )
302
+ # [Azure CLI ](#tab/cli )
290
303
291
304
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
292
305
@@ -296,7 +309,9 @@ If you wish to use the default hyperparameter values for a given algorithm (say
296
309
image_model:
297
310
model_name: " yolov5"
298
311
```
299
- # [Python SDK v2 (preview)](#tab/SDK-v2)
312
+ # [Python SDK](#tab/python)
313
+
314
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
300
315
301
316
If you wish to use the default hyperparameter values for a given algorithm (say yolov5), you can specify it using model_name parameter in set_image_model method of the task specific `automl` job. For example,
302
317
@@ -318,7 +333,7 @@ The primary metric used for model optimization and hyperparameter tuning depends
318
333
# ## Experiment budget
319
334
320
335
You can optionally specify the maximum time budget for your AutoML Vision training job using the `timeout` parameter in the `limits` - the amount of time in minutes before the experiment terminates. If none specified, default experiment timeout is seven days (maximum 60 days). For example,
321
- # [CLI v2 ](#tab/CLI-v2 )
336
+ # [Azure CLI ](#tab/cli )
322
337
323
338
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
324
339
@@ -327,7 +342,9 @@ limits:
327
342
timeout: 60
328
343
```
329
344
330
- # [Python SDK v2 (preview)](#tab/SDK-v2)
345
+ # [Python SDK](#tab/python)
346
+
347
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
331
348
332
349
[! Notebook- python[] (~ / azureml- examples- main/ sdk/ jobs/ automl- standalone- jobs/ automl- image- object - detection- task- fridge- items/ automl- image- object - detection- task- fridge- items.ipynb? name = limit- settings)]
333
350
@@ -385,7 +402,7 @@ Parameter | Detail
385
402
386
403
You can configure all the sweep related parameters as shown in the example below.
387
404
388
- # [CLI v2 ](#tab/CLI-v2 )
405
+ # [Azure CLI ](#tab/cli )
389
406
390
407
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
391
408
@@ -402,7 +419,9 @@ sweep:
402
419
delay_evaluation: 6
403
420
```
404
421
405
- # [Python SDK v2 (preview)](#tab/SDK-v2)
422
+ # [Python SDK](#tab/python)
423
+
424
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
406
425
407
426
[! Notebook- python[] (~ / azureml- examples- main/ sdk/ jobs/ automl- standalone- jobs/ automl- image- object - detection- task- fridge- items/ automl- image- object - detection- task- fridge- items.ipynb? name = sweep- settings)]
408
427
@@ -413,7 +432,7 @@ sweep:
413
432
414
433
You can pass fixed settings or parameters that don' t change during the parameter space sweep as shown below.
415
434
416
- # [CLI v2 ](#tab/CLI-v2 )
435
+ # [Azure CLI ](#tab/cli )
417
436
418
437
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
419
438
@@ -424,7 +443,9 @@ image_model:
424
443
```
425
444
426
445
427
- # [Python SDK v2 (preview)](#tab/SDK-v2)
446
+ # [Python SDK](#tab/python)
447
+
448
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
428
449
429
450
[! Notebook- python[] (~ / azureml- examples- main/ sdk/ jobs/ automl- standalone- jobs/ automl- image- object - detection- task- fridge- items/ automl- image- object - detection- task- fridge- items.ipynb? name = pass - arguments)]
430
451
@@ -440,7 +461,7 @@ Once the training run is done, you have the option to further train the model by
440
461
441
462
You can pass the run ID that you want to load the checkpoint from .
442
463
443
- # [CLI v2 ](#tab/CLI-v2 )
464
+ # [Azure CLI ](#tab/cli )
444
465
445
466
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
446
467
@@ -450,7 +471,9 @@ image_model:
450
471
```
451
472
452
473
453
- # [Python SDK v2 (preview)](#tab/SDK-v2)
474
+ # [Python SDK](#tab/python)
475
+
476
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
454
477
455
478
To find the run ID from the desired model, you can use the following code.
456
479
@@ -500,7 +523,7 @@ automl_image_job_incremental = ml_client.jobs.create_or_update(
500
523
501
524
502
525
503
- # [CLI v2 ](#tab/CLI-v2 )
526
+ # [Azure CLI ](#tab/cli )
504
527
505
528
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
506
529
@@ -510,7 +533,9 @@ To submit your AutoML job, you run the following CLI v2 command with the path to
510
533
az ml job create -- file ./ hello- automl- job- basic.yml -- workspace- name [YOUR_AZURE_WORKSPACE ] -- resource- group [YOUR_AZURE_RESOURCE_GROUP ] -- subscription [YOUR_AZURE_SUBSCRIPTION ]
511
534
```
512
535
513
- # [Python SDK v2 (preview)](#tab/SDK-v2)
536
+ # [Python SDK](#tab/python)
537
+
538
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
514
539
515
540
When you' ve configured your AutoML Job to the desired settings, you can submit the job.
516
541
@@ -532,15 +557,17 @@ Once the run completes, you can register the model that was created from the bes
532
557
533
558
# ## Get the best run
534
559
535
-
536
- # [CLI v2](#tab/CLI-v2)
560
+ # [Azure CLI](#tab/cli)
537
561
538
562
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
563
+
539
564
```yaml
540
565
541
566
```
542
567
543
- # [Python SDK v2 (preview)](#tab/SDK-v2)
568
+ # [Python SDK](#tab/python)
569
+
570
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
544
571
545
572
[! Notebook- python[] (~ / azureml- examples- main/ sdk/ jobs/ automl- standalone- jobs/ automl- image- object - detection- task- fridge- items/ automl- image- object - detection- task- fridge- items.ipynb? name = best_run)]
546
573
@@ -553,14 +580,16 @@ Once the run completes, you can register the model that was created from the bes
553
580
554
581
Register the model either using the azureml path or your locally downloaded path.
555
582
556
- # [CLI v2 ](#tab/CLI-v2 )
583
+ # [Azure CLI ](#tab/cli )
557
584
558
585
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
559
586
560
587
```azurecli
561
588
az ml model create -- name od- fridge- items- mlflow- model -- version 1 -- path azureml:// jobs/ $ best_run/ outputs/ artifacts/ outputs/ mlflow- model/ -- type mlflow_model -- workspace- name [YOUR_AZURE_WORKSPACE ] -- resource- group [YOUR_AZURE_RESOURCE_GROUP ] -- subscription [YOUR_AZURE_SUBSCRIPTION ]
562
589
```
563
- # [Python SDK v2 (preview)](#tab/SDK-v2)
590
+ # [Python SDK](#tab/python)
591
+
592
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
564
593
565
594
[! Notebook- python[] (~ / azureml- examples- main/ sdk/ jobs/ automl- standalone- jobs/ automl- image- object - detection- task- fridge- items/ automl- image- object - detection- task- fridge- items.ipynb? name = register_model)]
566
595
-- -
@@ -569,7 +598,7 @@ After you register the model you want to use, you can deploy it using the manage
569
598
570
599
# ## Configure online endpoint
571
600
572
- # [CLI v2 ](#tab/CLI-v2 )
601
+ # [Azure CLI ](#tab/cli )
573
602
574
603
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
575
604
@@ -579,7 +608,9 @@ name: od-fridge-items-endpoint
579
608
auth_mode: key
580
609
```
581
610
582
- # [Python SDK v2 (preview)](#tab/SDK-v2)
611
+ # [Python SDK](#tab/python)
612
+
613
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
583
614
584
615
[! Notebook- python[] (~ / azureml- examples- main/ sdk/ jobs/ automl- standalone- jobs/ automl- image- object - detection- task- fridge- items/ automl- image- object - detection- task- fridge- items.ipynb? name = endpoint)]
585
616
@@ -590,14 +621,16 @@ auth_mode: key
590
621
Using the `MLClient` created earlier, we' ll now create the Endpoint in the workspace. This command will start the endpoint creation and return a confirmation response while the endpoint creation continues.
591
622
592
623
593
- # [CLI v2 ](#tab/CLI-v2 )
624
+ # [Azure CLI ](#tab/cli )
594
625
595
626
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
596
627
```azurecli
597
628
az ml online- endpoint create -- file .\create_endpoint.yml --workspace-name [YOUR_AZURE_WORKSPACE] --resource-group [YOUR_AZURE_RESOURCE_GROUP] --subscription [YOUR_AZURE_SUBSCRIPTION]
598
629
```
599
630
600
- # [Python SDK v2 (preview)](#tab/SDK-v2)
631
+ # [Python SDK](#tab/python)
632
+
633
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
601
634
602
635
[! Notebook- python[] (~ / azureml- examples- main/ sdk/ jobs/ automl- standalone- jobs/ automl- image- object - detection- task- fridge- items/ automl- image- object - detection- task- fridge- items.ipynb? name = create_endpoint)]
603
636
-- -
@@ -607,7 +640,7 @@ az ml online-endpoint create --file .\create_endpoint.yml --workspace-name [YOUR
607
640
A deployment is a set of resources required for hosting the model that does the actual inferencing. We' ll create a deployment for our endpoint using the `ManagedOnlineDeployment` class. You can use either GPU or CPU VM SKUs for your deployment cluster.
608
641
609
642
610
- # [CLI v2 ](#tab/CLI-v2 )
643
+ # [Azure CLI ](#tab/cli )
611
644
612
645
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
613
646
@@ -631,7 +664,9 @@ readiness_probe:
631
664
initial_delay: 2000
632
665
```
633
666
634
- # [Python SDK v2 (preview)](#tab/SDK-v2)
667
+ # [Python SDK](#tab/python)
668
+
669
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
635
670
636
671
[! Notebook- python[] (~ / azureml- examples- main/ sdk/ jobs/ automl- standalone- jobs/ automl- image- object - detection- task- fridge- items/ automl- image- object - detection- task- fridge- items.ipynb? name = deploy)]
637
672
-- -
@@ -641,31 +676,35 @@ readiness_probe:
641
676
642
677
Using the `MLClient` created earlier, we' ll now create the deployment in the workspace. This command will start the deployment creation and return a confirmation response while the deployment creation continues.
643
678
644
- # [CLI v2 ](#tab/CLI-v2 )
679
+ # [Azure CLI ](#tab/cli )
645
680
646
681
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
647
682
648
683
```azurecli
649
684
az ml online- deployment create -- file .\create_deployment.yml --workspace-name [YOUR_AZURE_WORKSPACE] --resource-group [YOUR_AZURE_RESOURCE_GROUP] --subscription [YOUR_AZURE_SUBSCRIPTION]
650
685
```
651
686
652
- # [Python SDK v2 (preview)](#tab/SDK-v2)
687
+ # [Python SDK](#tab/python)
688
+
689
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
653
690
654
691
[! Notebook- python[] (~ / azureml- examples- main/ sdk/ jobs/ automl- standalone- jobs/ automl- image- object - detection- task- fridge- items/ automl- image- object - detection- task- fridge- items.ipynb? name = create_deploy)]
655
692
-- -
656
693
657
694
# ## update traffic:
658
695
By default the current deployment is set to receive 0 % traffic. you can set the traffic percentage current deployment should receive. Sum of traffic percentages of all the deployments with one end point shouldn' t exceed 100%.
659
696
660
- # [CLI v2 ](#tab/CLI-v2 )
697
+ # [Azure CLI ](#tab/cli )
661
698
662
699
[! INCLUDE [cli v2](../ ../ includes/ machine- learning- cli- v2.md)]
663
700
664
701
```azurecli
665
702
az ml online- endpoint update -- name ' od-fridge-items-endpoint' -- traffic ' od-fridge-items-mlflow-deploy=100' -- workspace- name [YOUR_AZURE_WORKSPACE ] -- resource- group [YOUR_AZURE_RESOURCE_GROUP ] -- subscription [YOUR_AZURE_SUBSCRIPTION ]
666
703
```
667
704
668
- # [Python SDK v2 (preview)](#tab/SDK-v2)
705
+ # [Python SDK](#tab/python)
706
+
707
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
669
708
670
709
[! Notebook- python[] (~ / azureml- examples- main/ sdk/ jobs/ automl- standalone- jobs/ automl- image- object - detection- task- fridge- items/ automl- image- object - detection- task- fridge- items.ipynb? name = update_traffic)]
671
710
-- -
@@ -707,12 +746,15 @@ Review detailed code examples and use cases in the [GitHub notebook repository f
707
746
708
747
709
748
# # Code examples
710
- # [CLI v2](#tab/CLI-v2)
749
+
750
+ # [Azure CLI](#tab/cli)
711
751
712
752
Review detailed code examples and use cases in the [azureml- examples repository for automated machine learning samples](https:// github.com/ Azure/ azureml- examples/ tree/ sdk- preview/ cli/ jobs/ automl- standalone- jobs).
713
753
714
754
715
- # [Python SDK v2 (preview)](#tab/SDK-v2)
755
+ # [Python SDK](#tab/python)
756
+
757
+ [! INCLUDE [sdk v2](../ ../ includes/ machine- learning- sdk- v2.md)]
716
758
717
759
Review detailed code examples and use cases in the [GitHub notebook repository for automated machine learning samples](https:// github.com/ Azure/ azureml- examples/ tree/ sdk- preview/ sdk/ jobs/ automl- standalone- jobs).
718
760
0 commit comments