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/iot-edge/tutorial-deploy-custom-vision.md
+25-25Lines changed: 25 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ services: iot-edge
5
5
author: kgremban
6
6
manager: philmea
7
7
ms.author: kgremban
8
-
ms.date: 10/15/2019
8
+
ms.date: 01/15/2020
9
9
ms.topic: tutorial
10
10
ms.service: iot-edge
11
11
ms.custom: mvc
@@ -38,31 +38,31 @@ In this tutorial, you learn how to:
38
38
>[!TIP]
39
39
>This tutorial is a simplified version of the [Custom Vision and Azure IoT Edge on a Raspberry Pi 3](https://github.com/Azure-Samples/Custom-vision-service-iot-edge-raspberry-pi) sample project. This tutorial was designed to run on a cloud VM and uses static images to train and test the image classifier, which is useful for someone just starting to evaluate Custom Vision on IoT Edge. The sample project uses physical hardware and sets up a live camera feed to train and test the image classifier, which is useful for someone who wants to try a more detailed, real-life scenario.
40
40
41
-
Before beginning this tutorial, you should have gone through the previous tutorial to set up your environment for Linux container development: [Develop IoT Edge modules for Linux devices](tutorial-develop-for-linux.md). By completing that tutorial, you should have the following prerequisites in place:
41
+
Before beginning this tutorial, you should have gone through the previous tutorial to set up your environment for Linux container development: [Develop IoT Edge modules for Linux devices](tutorial-develop-for-linux.md). By completing that tutorial, you should have the following prerequisites in place:
42
42
43
43
* A free or standard-tier [IoT Hub](../iot-hub/iot-hub-create-through-portal.md) in Azure.
44
44
* A [Linux device running Azure IoT Edge](quickstart-linux.md)
45
45
* A container registry, like [Azure Container Registry](https://docs.microsoft.com/azure/container-registry/).
46
46
*[Visual Studio Code](https://code.visualstudio.com/) configured with the [Azure IoT Tools](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-tools).
47
47
*[Docker CE](https://docs.docker.com/install/) configured to run Linux containers.
48
48
49
-
To develop an IoT Edge module with the Custom Vision service, install the following additional prerequisites on your development machine:
49
+
To develop an IoT Edge module with the Custom Vision service, install the following additional prerequisites on your development machine:
50
50
51
51
*[Python](https://www.python.org/downloads/)
52
52
*[Git](https://git-scm.com/downloads)
53
-
*[Python extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
53
+
*[Python extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
54
54
55
55
## Build an image classifier with Custom Vision
56
56
57
57
To build an image classifier, you need to create a Custom Vision project and provide training images. For more information about the steps that you take in this section, see [How to build a classifier with Custom Vision](../cognitive-services/custom-vision-service/getting-started-build-a-classifier.md).
58
58
59
-
Once your image classifier is built and trained, you can export it as a Docker container and deploy it to an IoT Edge device.
59
+
Once your image classifier is built and trained, you can export it as a Docker container and deploy it to an IoT Edge device.
60
60
61
61
### Create a new project
62
62
63
63
1. In your web browser, navigate to the [Custom Vision web page](https://customvision.ai/).
64
64
65
-
2. Select **Sign in** and sign in with the same account that you use to access Azure resources.
65
+
2. Select **Sign in** and sign in with the same account that you use to access Azure resources.
66
66
67
67
3. Select **New project**.
68
68
@@ -82,39 +82,39 @@ Once your image classifier is built and trained, you can export it as a Docker c
82
82
83
83
### Upload images and train your classifier
84
84
85
-
Creating an image classifier requires a set of training images, as well as test images.
85
+
Creating an image classifier requires a set of training images, as well as test images.
86
86
87
-
1. Clone or download sample images from the [Cognitive-CustomVision-Windows](https://github.com/Microsoft/Cognitive-CustomVision-Windows) repo onto your local development machine.
87
+
1. Clone or download sample images from the [Cognitive-CustomVision-Windows](https://github.com/Microsoft/Cognitive-CustomVision-Windows) repo onto your local development machine.
2. Return to your Custom Vision project and select **Add images**.
93
+
2. Return to your Custom Vision project and select **Add images**.
94
94
95
-
3. Browse to the git repo that you cloned locally, and navigate to the first image folder, **Cognitive-CustomVision-Windows / Samples / Images / Hemlock**. Select all 10 images in the folder and then **Open**.
95
+
3. Browse to the git repo that you cloned locally, and navigate to the first image folder, **Cognitive-CustomVision-Windows / Samples / Images / Hemlock**. Select all 10 images in the folder and then **Open**.
96
96
97
-
4. Add the tag **hemlock** to this group of images and press **enter** to apply the tag.
97
+
4. Add the tag **hemlock** to this group of images and press **enter** to apply the tag.
98
98
99
-
5. Select **Upload 10 files**.
99
+
5. Select **Upload 10 files**.
100
100
101
101

102
102
103
103
6. When the images are uploaded successfully, select **Done**.
104
104
105
105
7. Select **Add images** again.
106
106
107
-
8. Browse to the second image folder, **Cognitive-CustomVision-Windows / Samples / Images / Japanese Cherry**. Select all 10 images in the folder and then **Open**.
107
+
8. Browse to the second image folder, **Cognitive-CustomVision-Windows / Samples / Images / Japanese Cherry**. Select all 10 images in the folder and then **Open**.
108
108
109
-
9. Add the tag **japanese cherry** to this group of images and press **enter** to apply the tag.
109
+
9. Add the tag **japanese cherry** to this group of images and press **enter** to apply the tag.
110
110
111
-
10. Select **Upload 10 files**. When the images are uploaded successfully, select **Done**.
111
+
10. Select **Upload 10 files**. When the images are uploaded successfully, select **Done**.
112
112
113
-
11. When both sets of images are tagged and uploaded, select **Train** to train the classifier.
113
+
11. When both sets of images are tagged and uploaded, select **Train** to train the classifier.
114
114
115
115
### Export your classifier
116
116
117
-
1. After training your classifier, select **Export** on the Performance page of the classifier.
117
+
1. After training your classifier, select **Export** on the Performance page of the classifier.
118
118
119
119

120
120
@@ -259,7 +259,8 @@ In this section, you add a new module to the same CustomVisionSolution and provi
259
259
print("Response from classification service: ("+str(response.status_code) +") "+ json.dumps(response.json()) +"\n")
260
260
exceptExceptionas e:
261
261
print(e)
262
-
print("Response from classification service: ("+str(response.status_code))
262
+
print("No response from classification service")
263
+
returnNone
263
264
264
265
return json.dumps(response.json())
265
266
@@ -278,7 +279,8 @@ In this section, you add a new module to the same CustomVisionSolution and provi
@@ -322,15 +324,15 @@ Instead of using a real camera to provide an image feed for this scenario, we're
322
324
323
325
3. Browse to your IoT Edge solution directory and paste the test image in the **modules** / **cameraCapture** folder. The image should be in the same folder as the main.py file that you edited in the previous section.
324
326
325
-
3. In Visual Studio Code, open the **Dockerfile.amd64** file for the cameraCapture module.
327
+
4. In Visual Studio Code, open the **Dockerfile.amd64** file for the cameraCapture module.
326
328
327
-
4. After the line that establishes the working directory, `WORKDIR /app`, add the following line of code:
329
+
5. After the line that establishes the working directory, `WORKDIR /app`, add the following line of code:
328
330
329
331
```Dockerfile
330
332
ADD ./test_image.jpg .
331
333
```
332
334
333
-
5. Save the Dockerfile.
335
+
6. Save the Dockerfile.
334
336
335
337
### Prepare a deployment manifest
336
338
@@ -354,7 +356,7 @@ The IoT Edge extension for Visual Studio Code provides a template in each IoT Ed
354
356
355
357
If you named your Custom Vision module something other than *classifier*, update the image-processing endpoint value to match.
356
358
357
-
5. At the bottom of the file, update the **routes** parameter for the $edgeHub module. You want to route the prediction results from cameraCapture to IoT Hub.
359
+
6. At the bottom of the file, update the **routes** parameter for the $edgeHub module. You want to route the prediction results from cameraCapture to IoT Hub.
358
360
359
361
```json
360
362
"routes": {
@@ -406,7 +408,6 @@ From Visual Studio Code, right-click on the name of your IoT Edge device and sel
406
408
407
409
The results from the Custom Vision module, which are sent as messages from the cameraCapture module, include the probability that the image is of either a hemlock or cherry tree. Since the image is hemlock, you should see the probability as 1.0.
408
410
409
-
410
411
## Clean up resources
411
412
412
413
If you plan to continue to the next recommended article, you can keep the resources and configurations that you created and reuse them. You can also keep using the same IoT Edge device as a test device.
@@ -415,7 +416,6 @@ Otherwise, you can delete the local configurations and the Azure resources that
In this tutorial, you trained a Custom Vision model and deployed it as a module onto an IoT Edge device. Then you built a module that can query the image classification service and report its results back to IoT Hub.
0 commit comments