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
title: "Tutorial: Train image classification model: VS Code (preview)"
2
+
title: "Train Image Classification Model with VS Code Extension"
3
3
titleSuffix: Azure Machine Learning
4
-
description: Learn how to train an image classification model using TensorFlow and the Azure Machine Learning Visual Studio Code Extension
4
+
description: Learn how to train a TensorFlow image classification model using the Azure Machine Learning Visual Studio Code extension.
5
5
services: machine-learning
6
6
ms.service: azure-machine-learning
7
7
ms.subservice: core
8
8
ms.topic: tutorial
9
9
author: ssalgadodev
10
10
ms.author: ssalgado
11
11
ms.reviewer: tbombach
12
-
ms.date: 01/25/2024
12
+
ms.date: 04/03/2025
13
13
ms.custom:
14
14
- cliv2
15
15
- build-2023
16
16
- ignite-2023
17
17
#Customer intent: As a professional data scientist, I want to learn how to train an image classification model using TensorFlow and the Azure Machine Learning Visual Studio Code Extension.
18
18
---
19
19
20
-
# Tutorial: Train an image classification TensorFlow model using the Azure Machine Learning Visual Studio Code Extension (preview)
20
+
# Tutorial: Train an image classification model by using the Azure Machine Learning Visual Studio Code extension (preview)
Learn how to train an image classification model to recognize hand-written numbers using TensorFlow and the Azure Machine Learning Visual Studio Code Extension.
24
+
This article explains how to train an image classification model to recognize hand-written numbers by using TensorFlow and the Azure Machine Learning Visual Studio Code extension.
@@ -34,33 +34,32 @@ In this tutorial, you learn the following tasks:
34
34
35
35
## Prerequisites
36
36
37
-
- Azure subscription. If you don't have one, sign up to try the[free or paid version of Azure Machine Learning](https://azure.microsoft.com/free/). If you're using the free subscription, only CPU clusters are supported.
38
-
-Install [Visual Studio Code](https://code.visualstudio.com/docs/setup/setup-overview), a lightweight, cross-platform code editor.
39
-
- Azure Machine Learning studio Visual Studio Code extension. For install instructions, see the [Setup Azure Machine Learning Visual Studio Code extension guide](./how-to-setup-vs-code.md)
40
-
- CLI (v2). For installation instructions, see [Install, set up, and use the CLI (v2)](how-to-configure-cli.md)
41
-
-Clone the communitydriven repository
37
+
-An Azure subscription. If you don't have one, sign up for a[free or paid version of Azure Machine Learning](https://azure.microsoft.com/free/). If you're using the free subscription, only CPU clusters are supported.
38
+
-[Visual Studio Code](https://code.visualstudio.com/docs/setup/setup-overview), a lightweight, cross-platform code editor.
39
+
- Azure Machine Learning studio Visual Studio Code extension. For installation instructions, see [Setup Azure Machine Learning Visual Studio Code extension](./how-to-setup-vs-code.md).
40
+
- CLI (v2). For installation instructions, see [Install and set up the CLI (v2)](how-to-configure-cli.md)
41
+
- Clone the community-driven [Azure Machine Learning examples repository](https://github.com/Azure/azureml-examples):
The code for this tutorial uses TensorFlow to train an image classification machine learning model that categorizes handwritten digits from 0-9. It does so by creating a neural network that takes the pixel values of 28 px x 28 px image as input and outputs a list of 10 probabilities, one for each of the digits being classified. This is a sample of what the data looks like.
48
+
The code for this tutorial uses TensorFlow to train an image classification machine learning model that categorizes handwritten digits from 0-9. It does so by creating a neural network that takes the pixel values of 28x28-pixel images as input, and thenoutputs a list of 10 probabilities, one for each of the digits being classified. The following sample shows what the data looks like.
:::image type="content" source="media/tutorial-train-deploy-image-classification-model-vscode/digits.png" alt-text="Screenshot that shows a sample of MNIST digits.":::
51
51
52
52
## Create a workspace
53
53
54
-
The first thing you have to do to build an application in Azure Machine Learning is to create a workspace. A workspace contains the resources to train models and the trained models themselves. For more information, see [what is a workspace](./concept-workspace.md).
54
+
To build an application in Azure Machine Learning, you first need to create a workspace. A workspace contains the resources to train models and also the trained models themselves. For more information, see [What is an Azure Machine Learning workspace?](./concept-workspace.md)
55
55
56
-
1. Open the *azureml-examples/cli/jobs/single-step/tensorflow/mnist* directory from the community driven repositoryin Visual Studio Code.
56
+
1. In Visual Studio Code, open the *azureml-examples/cli/jobs/single-step/tensorflow/mnist* directory from the examples repository.
57
57
1. On the Visual Studio Code activity bar, selectthe**Azure** icon to open the Azure Machine Learning view.
58
-
1. In the Azure Machine Learning view, right-click your subscription node and select**CreateWorkspace**.
58
+
1. Under **Machine Learning**, right-click your subscription node and select**Createworkspace**.
:::image type="content" source="media/tutorial-train-deploy-image-classification-model-vscode/create-workspace.png" alt-text="Screenshot that shows the option to create a workspace.":::
62
61
63
-
1. A specification file appears. Configure the specification file with the following options.
62
+
1. A specification file appears. Configure the specification file with the following options and then save it.
@@ -78,14 +77,13 @@ The first thing you have to do to build an application in Azure Machine Learning
78
77
1. Right-click the specification file and select**AzureML: Execute YAML**. Creating a resource uses the configuration options defined in the YAML specification file and submits a job using the CLI (v2). At this point, a request to Azure is made to create a new workspace and dependent resources in your account. After a few minutes, the new workspace appears in your subscription node.
79
78
1. Set `TeamWorkspace` as your default workspace. Doing so places resources and jobs you create in the workspace by default. Select the **Set Azure Machine Learning Workspace** button on the Visual Studio Code status bar and follow the prompts to set`TeamWorkspace` as your default workspace.
80
79
81
-
For more information on workspaces, see [how to manage resources inVS Code](how-to-manage-resources-vscode.md).
80
+
For more information on workspaces, see [Manage Azure Machine Learning resources with the VS Code extension](how-to-manage-resources-vscode.md).
82
81
83
82
## Train the model
84
83
85
84
During the training process, a TensorFlow model is trained by processing the training data and learning patterns embedded within it for each of the respective digits being classified.
86
85
87
-
Like workspaces and compute targets, training jobs are defined using resource templates. For this sample, the specification is defined in the *job.yml* file, which looks like the following:
88
-
86
+
Like workspaces and compute targets, training jobs are defined using resource templates. For this sample, the specification is defined in the *job.yml* file, which is located in the *azureml-examples/cli/jobs/single-step/tensorflow/mnist* folder in the examples repository.
description: Train a basic neural network with TensorFlow on the MNIST dataset.
101
99
```
102
100
103
-
This specification file submits a training job called `tensorflow-mnist-example` to the recently created `gpu-cluster` computer target that runs the code in the *train.py* Python script. The environment used is one of the curated environments provided by Azure Machine Learning which contains TensorFlow and other software dependencies required to run the training script. For more information on curated environments, see [Azure Machine Learning curated environments](resource-curated-environments.md).
101
+
This specification file submits a training job called `tensorflow-mnist-example` to the recently created `gpu-cluster` computer target that runs the code in the *train.py* Python script. The environment used is one of the curated environments provided by Azure Machine Learning, which contains TensorFlow and other software dependencies required to run the training script. For more information on curated environments, see [Azure Machine Learning curated environments](resource-curated-environments.md).
104
102
105
103
To submit the training job:
106
104
@@ -111,14 +109,13 @@ At this point, a request is sent to Azure to run your experiment on the selected
111
109
112
110
When the dialog requesting to open an external website appears, select**Open**.
:::image type="content" source="media/tutorial-train-deploy-image-classification-model-vscode/track-experiment-progress.png" alt-text="Screenshot that shows the job's progress." lightbox="media/tutorial-train-deploy-image-classification-model-vscode/track-experiment-progress.png":::
116
113
117
-
When the model is done training, the status label next to the run node updates to "Completed".
114
+
When the model is done training, the status label next to the run node updates to *Completed*.
118
115
119
-
## Next steps
116
+
## Related content
120
117
121
-
* [Launch Visual Studio Code integrated with Azure Machine Learning (preview)](how-to-launch-vs-code-remote.md)
122
-
*For a walkthrough of how to edit, run, and debug code locally, see the [Python hello-world tutorial](https://code.visualstudio.com/docs/Python/Python-tutorial).
123
-
* [Run Jupyter Notebooks in Visual Studio Code](how-to-manage-resources-vscode.md) using a remote Jupyter server.
124
-
*For a walkthrough of how to train with Azure Machine Learning outside of Visual Studio Code, see [Tutorial: Train and deploy a model with Azure Machine Learning](tutorial-train-deploy-notebook.md).
118
+
* [Launch Visual Studio Code integrated with Azure Machine Learning](how-to-launch-vs-code-remote.md)
119
+
*[Get started with a Python tutorial](https://code.visualstudio.com/docs/Python/Python-tutorial)
120
+
* [Manage Azure Machine Learning resources with the VS Code extension](how-to-manage-resources-vscode.md)
121
+
*[Quickstart: Get started with Azure Machine Learning](tutorial-azure-ml-in-a-day.md)
0 commit comments