Skip to content

Commit 463f39e

Browse files
Freshness, in progress.
1 parent d2defc9 commit 463f39e

File tree

1 file changed

+42
-39
lines changed

1 file changed

+42
-39
lines changed

articles/machine-learning/how-to-prepare-datasets-for-automl-images.md

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,52 @@
11
---
22
title: Prepare data for computer vision tasks
33
titleSuffix: Azure Machine Learning
4-
description: Image data preparation for Azure Machine Learning automated ML to train computer vision models on classification, object detection, and segmentation
4+
description: Learn about image data preparation for Azure Machine Learning to train computer vision models on classification, object detection, and segmentation.
55
author: ssalgadodev
66
ms.author: ssalgado
77
ms.service: azure-machine-learning
88
ms.subservice: automl
99
ms.topic: how-to
10-
ms.custom: template-how-to, update-code, sdkv2,
10+
ms.custom: template-how-to, update-code, sdkv2
1111
ms.reviewer: rvadthyavath
12-
ms.date: 03/26/2024
12+
ms.date: 09/03/2024
13+
#customer intent: As a data scientist, I want to prepare image data for training computer vision models.
1314
---
1415

1516
# Prepare data for computer vision tasks with automated machine learning
1617

1718
[!INCLUDE [dev v2](includes/machine-learning-dev-v2.md)]
1819

19-
2020
> [!IMPORTANT]
2121
> Support for training computer vision models with automated ML in Azure Machine Learning is an experimental public preview feature. 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/).
2222
23-
In this article, you learn how to prepare image data for training computer vision models with [automated machine learning in Azure Machine Learning](concept-automated-ml.md).
23+
In this article, you learn how to prepare image data for training computer vision models with [automated machine learning in Azure Machine Learning](concept-automated-ml.md).
2424

25-
To generate models for computer vision tasks with automated machine learning, you need to bring labeled image data as input for model training in the form of an `MLTable`.
25+
To generate models for computer vision tasks with automated machine learning, you need to bring labeled image data as input for model training in the form of an `MLTable`.
2626

27-
You can create an `MLTable` from labeled training data in JSONL format.
28-
If your labeled training data is in a different format (like, pascal VOC or COCO), you can use a [conversion script](https://github.com/Azure/azureml-examples/blob/v1-archive/v1/python-sdk/tutorials/automl-with-azureml/image-object-detection/coco2jsonl.py) to first convert it to JSONL, and then create an `MLTable`. Alternatively, you can use Azure Machine Learning's [data labeling tool](how-to-create-image-labeling-projects.md) to manually label images, and export the labeled data to use for training your AutoML model.
27+
You can create an `MLTable` from labeled training data in JSONL format. If your labeled training data is in a different format (like, Pascal Visual Object Classes (VOC) or COCO), you can use a [conversion script](https://github.com/Azure/azureml-examples/blob/v1-archive/v1/python-sdk/tutorials/automl-with-azureml/image-object-detection/coco2jsonl.py) to first convert it to JSONL, and then create an `MLTable`. Alternatively, you can use Azure Machine Learning's data labeling tool to manually label images, and export the labeled data to use for training your AutoML model.
2928

3029
## Prerequisites
3130

32-
* Familiarize yourself with the accepted [schemas for JSONL files for AutoML computer vision experiments](reference-automl-images-schema.md).
31+
- Familiarize yourself with the accepted [schemas for JSONL files for AutoML computer vision experiments](reference-automl-images-schema.md).
32+
33+
## Get labeled data
3334

34-
## Get labeled data
3535
In order to train computer vision models using AutoML, you need to first get labeled training data. The images need to be uploaded to the cloud and label annotations need to be in JSONL format. You can either use the Azure Machine Learning Data Labeling tool to label your data or you could start with prelabeled image data.
3636

37-
### Using Azure Machine Learning Data Labeling tool to label your training data
38-
If you don't have prelabeled data, you can use Azure Machine Learning's [data labeling tool](how-to-create-image-labeling-projects.md) to manually label images. This tool automatically generates the data required for training in the accepted format.
37+
### Use Azure Machine Learning Data Labeling tool to label your training data
38+
39+
If you don't have prelabeled data, you can use Azure Machine Learning's data labeling tool to manually label images. This tool automatically generates the data required for training in the accepted format. For more information, see [Set up an image labeling project](how-to-create-image-labeling-projects.md).
3940

40-
It helps to create, manage, and monitor data labeling tasks for
41+
It helps to create, manage, and monitor data labeling tasks for:
4142

42-
+ Image classification (multi-class and multi-label)
43-
+ Object detection (bounding box)
44-
+ Instance segmentation (polygon)
43+
- Image classification (multi-class and multi-label)
44+
- Object detection (bounding box)
45+
- Instance segmentation (polygon)
4546

46-
If you already have labeled data you want to use, you can [export your labeled data as an Azure Machine Learning Dataset](how-to-manage-labeling-projects.md#export-the-labels) and then access the dataset under 'Datasets' tab in Azure Machine Learning studio. This exported dataset can then be passed as an input using `azureml:<tabulardataset_name>:<version>` format. Here's an example of how to pass existing dataset as input for training computer vision models.
47+
If you already labeled data you want to use, you can export your labeled data as an Azure Machine Learning Dataset and access the dataset under the **Datasets** tab in Azure Machine Learning studio. This exported dataset can then be passed as an input using `azureml:<tabulardataset_name>:<version>` format. For more information, see [Export the labels](how-to-manage-labeling-projects.md#export-the-labels).
48+
49+
Here's an example of how to pass existing dataset as input for training computer vision models.
4750

4851
# [Azure CLI](#tab/cli)
4952

@@ -77,18 +80,18 @@ Refer to CLI/SDK tabs for reference.
7780

7881
---
7982

80-
### Using prelabeled training data from local machine
81-
If you have labeled data that you would like to use to train your model, you need to upload the images to Azure. You can upload the your images to the default Azure Blob Storage of your Azure Machine Learning Workspace and register it as a [data asset](how-to-create-data-assets.md).
83+
### Use prelabeled training data from local machine
8284

83-
The following script uploads the image data on your local machine at path "./data/odFridgeObjects" to datastore in Azure Blob Storage. It then creates a new data asset with the name "fridge-items-images-object-detection" in your Azure Machine Learning Workspace.
85+
If you labeled data that you would like to use to train your model, you need to upload the images to Azure. You can upload your images to the default Azure Blob Storage of your Azure Machine Learning Workspace and register it as a *data asset*. For more information, see [Create and manage data assets](how-to-create-data-assets.md).
8486

87+
The following script uploads the image data on your local machine at path *./data/odFridgeObjects* to datastore in Azure Blob Storage. It then creates a new data asset with the name `fridge-items-images-object-detection` in your Azure Machine Learning Workspace.
8588

86-
If there already exists a data asset with the name "fridge-items-images-object-detection" in your Azure Machine Learning Workspace, it updates the version number of the data asset and points it to the new location where the image data uploaded.
89+
If there already exists a data asset with the name `fridge-items-images-object-detection` in your Azure Machine Learning Workspace, it updates the version number of the data asset and points it to the new location where the image data uploaded.
8790

8891
# [Azure CLI](#tab/cli)
8992
[!INCLUDE [cli v2](includes/machine-learning-cli-v2.md)]
9093

91-
Create an .yml file with the following configuration.
94+
Create an *.yml* file with the following configuration.
9295

9396
```yml
9497
$schema: https://azuremlschemas.azureedge.net/latest/data.schema.json
@@ -98,30 +101,30 @@ path: ./data/odFridgeObjects
98101
type: uri_folder
99102
```
100103
101-
To upload the images as a data asset, you run the following CLI v2 command with the path to your .yml file, workspace name, resource group, and subscription ID.
104+
To upload the images as a data asset, you run the following CLI v2 command with the path to your *.yml* file, workspace name, resource group, and subscription ID.
102105
103106
```azurecli
104107
az ml data create -f [PATH_TO_YML_FILE] --workspace-name [YOUR_AZURE_WORKSPACE] --resource-group [YOUR_AZURE_RESOURCE_GROUP] --subscription [YOUR_AZURE_SUBSCRIPTION]
105108
```
106109

107110
# [Python SDK](#tab/python)
108111

109-
[!INCLUDE [sdk v2](includes/machine-learning-sdk-v2.md)]
112+
[!INCLUDE [sdk v2](includes/machine-learning-sdk-v2.md)]
110113

111114
[!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=upload-data)]
112115

113116
# [Studio](#tab/Studio)
114117

115-
![Animation showing how to register a dataset from local files](media\how-to-prepare-datasets-for-automl-images\ui-dataset-local.gif)
118+
:::image type="content" source="media\how-to-prepare-datasets-for-automl-images\ui-dataset-local.gif" alt-text="Animation showing how to register a dataset from local files.":::
116119

117120
---
118121

119-
If you already have your data present in an existing datastore and want to create a data asset out of it, you can do so by providing the path to the data in the datastore, instead of providing the path of your local machine. Update the code [above](#using-prelabeled-training-data-from-local-machine) with the following snippet.
122+
If you already have your data present in an existing datastore and want to create a data asset out of it, you provide the path to the data in the datastore, instead of the path of your local machine. Update [the prededing code](#using-prelabeled-training-data-from-local-machine) with the following snippet.
120123

121124
# [Azure CLI](#tab/cli)
122125
[!INCLUDE [cli v2](includes/machine-learning-cli-v2.md)]
123126

124-
Create an .yml file with the following configuration.
127+
Create a *.yml* file with the following configuration.
125128

126129
```yml
127130
$schema: https://azuremlschemas.azureedge.net/latest/data.schema.json
@@ -133,7 +136,6 @@ type: uri_folder
133136
134137
# [Python SDK](#tab/python)
135138
136-
137139
```Python
138140
my_data = Data(
139141
path="azureml://subscriptions/<my-subscription-id>/resourcegroups/<my-resource-group>/workspaces/<my-workspace>/datastores/<my-datastore>/paths/<path_to_image_data_folder>",
@@ -145,24 +147,25 @@ my_data = Data(
145147

146148
# [Studio](#tab/Studio)
147149

148-
![Animation showing how to register a dataset from data already present in datastore](media\how-to-prepare-datasets-for-automl-images\ui-dataset-datastore.gif)
150+
:::image type="content" source="media\how-to-prepare-datasets-for-automl-images\ui-dataset-datastore.gif" alt-text="Animation showing how to register a dataset from data already present in datastore.":::
149151

150152
---
151153

152-
Next, you need to get the label annotations in JSONL format. The schema of labeled data depends on the computer vision task at hand. Refer to [schemas for JSONL files for AutoML computer vision experiments](reference-automl-images-schema.md) to learn more about the required JSONL schema for each task type.
154+
Next, you need to get the label annotations in JSONL format. The schema of labeled data depends on the computer vision task at hand. To learn more about the required JSONL schema for each task type, see [Data schemas to train computer vision models with automated machine learning](reference-automl-images-schema.md).
153155

154156
If your training data is in a different format (like, pascal VOC or COCO), [helper scripts](https://github.com/Azure/azureml-examples/blob/v1-archive/v1/python-sdk/tutorials/automl-with-azureml/image-object-detection/coco2jsonl.py) to convert the data to JSONL are available in [notebook examples](https://github.com/Azure/azureml-examples/blob/main/sdk/python/jobs/automl-standalone-jobs).
155157

156-
Once you created jsonl file following the above steps, you can register it as a data asset using UI. Make sure you select `stream` type in schema section as shown in this animation.
158+
After you create the *.jsonl* file following the preceding steps, you can register it as a data asset using UI. Make sure you select `stream` type in schema section as shown in this animation.
157159

158-
![Animation showing how to register a data asset from the jsonl files](media\how-to-prepare-datasets-for-automl-images\ui-dataset-jsnol.gif)
160+
:::image type="content" source="media\how-to-prepare-datasets-for-automl-images\ui-dataset-jsnol.gif" alt-text="Animation showing how to register a data asset from the jsonl files.":::
159161

160162
### Using prelabeled training data from Azure Blob storage
161-
If you have your labeled training data present in a container in Azure Blob storage, then you can access it directly from there by [creating a datastore referring to that container](how-to-datastore.md#create-an-azure-blob-datastore).
163+
164+
If your labeled training data is present in a container in Azure Blob storage, you can access it directly from there by [creating a datastore referring to that container](how-to-datastore.md#create-an-azure-blob-datastore).
162165

163166
## Create MLTable
164167

165-
Once you have your labeled data in JSONL format, you can use it to create `MLTable` as shown in this yaml snippet. MLtable packages your data into a consumable object for training.
168+
After your labeled data is in JSONL format, you can use it to create `MLTable` as shown in this yaml snippet. MLtable packages your data into a consumable object for training.
166169

167170
```yaml
168171
paths:
@@ -177,10 +180,10 @@ transformations:
177180
column_type: stream_info
178181
```
179182
180-
You can then pass in the `MLTable` as a [data input for your AutoML training job](./how-to-auto-train-image-models.md#consume-data).
183+
You can then pass in the `MLTable` as a data input for your AutoML training job. For more information, see [Set up AutoML to train computer vision models](./how-to-auto-train-image-models.md#consume-data).
181184

182-
## Next steps
185+
## Related content
183186

184-
* [Train computer vision models with automated machine learning](how-to-auto-train-image-models.md).
185-
* [Train a small object detection model with automated machine learning](how-to-use-automl-small-object-detect.md).
186-
* [Tutorial: Train an object detection model (preview) with AutoML and Python](tutorial-auto-train-image-models.md).
187+
- [Train computer vision models with automated machine learning](how-to-auto-train-image-models.md).
188+
- [Train a small object detection model with automated machine learning](how-to-use-automl-small-object-detect.md).
189+
- [Tutorial: Train an object detection model (preview) with AutoML and Python](tutorial-auto-train-image-models.md).

0 commit comments

Comments
 (0)