Monday, September 13, 2021

Scale an Azure Percept DK configuration to multiple devices

Azure Percept DK is an easy-to-use platform for creating edge AI solutions. It combines different Azure services (e.g., Azure Cognitive Services and Machine Learning) to deliver real-time audio and vision insights. The device comes pre-built with Azure Percept Studio, a service which makes deploying on this device even easier to do. To find out more about the Azure Percept DK visit this page.

 

Previously, we successfully managed deploying a custom azure stream analytics edge module on the Azure Percept DK. Now, our question was – how do we replicate the modules with their configuration on multiple Azure Percept DK at large scale? One way is to deploy and configure each module on devices separately - but this would be very time consuming. The answer to this is: Azure IoT Edge automatic deployments.

 

Azure IoT Edge provides two different methods to configure modules for IoT Edge devices. The method we are outlining today is to create a deployment manifest and then apply the configuration to a particular device by its name. The configuration can be applied on multiple devices at the same time by using device twin tags.

 

All you need to do is to provide the device connection string (from IoT Hub) to your end Azure Percept DK user. You can go through the Azure Percept DK setup and use this connection string to get connected to Azure IoT hub. The reference architecture containing the AzureEye, StreamAnalytics, HostIp, ImageCapturing and WebStream modules is showed in the diagram below:

 

Sargithan_Senthil_1-1631451963726.jpeg

 

We can talk hours about the features of Azure Percept DK, but now it’s time to get things working. In order to get started, log onto the Azure portal, navigate to your IoT Hub resource and follow the below instructions:

 

  1. In IoT Hub main page, under Automatic Device Management section click on ‘IoT Edge’
  2. Select ‘IoT Edge Deployments’ tab and click on ‘Add Deployment’
  3. Specify the deployment name and add labels if needed

Sargithan_Senthil_2-1631451963707.png

 

4. Go on the ‘modules’ tab

5. Under IoT Edge Modules click on add and select ‘IoT Edge Module’. Give it a name, in this case: azureeyemodule and paste the Image URI under ‘Module Settings’ tab (links available at the end of the document)

Sargithan_Senthil_3-1631451963710.png

 

6. Select ‘Container Create Option’ tab and paste the Docker container configuration

 

Sargithan_Senthil_4-1631451963712.png

 

7. Select the ‘Module Twin Settings’ tab and paste the module twin desired properties. Set the property to “properties.desired”

Sargithan_Senthil_5-1631451963715.png

8. Save the newly created IoT Edge Module by selecting the ‘add’ button

 

9. If deploying ASA Edge follow this step, otherwise skip this step: Add the Azure Stream Analytics Edge module by selecting the ‘Azure Stream Analytics’ Module option, select the Edge Job you want to deploy and click ‘Save’

 

Sargithan_Senthil_6-1631451963730.png

 

10. Add the ImageCapturingModule by following the same steps shown for azureyeemodule

 

Sargithan_Senthil_22-1631452367759.png

 

11. Select the ‘Environment Variables’ tab and specify 3 variables as shown in the screenshot below

Sargithan_Senthil_23-1631452399029.png

12. Press on ‘Add’ to save the module

 

13. Add the HostIpModule by following the same steps as for the ImageCapturingModule

Sargithan_Senthil_24-1631452505829.png

 

 

14. Select ‘Container Create Option’ tab and paste the Docker container configuration

 

Sargithan_Senthil_25-1631452538523.png

 

15. Click ‘Add’

 

16. Add the WebStreamModule by following the same steps as shown above

 

Sargithan_Senthil_26-1631452601495.png

 

 

Sargithan_Senthil_27-1631452640364.png

 

Sargithan_Senthil_28-1631452657741.png

 

17. Click ‘Add’ to save the module

 

18. Select the ‘Routes’ tab to specify how the device will route the data (we are specifying two routes – one route from azureeyemodule to the ASA job and the second route from ASA job to IoT Hub)

 

Sargithan_Senthil_30-1631452790145.png

19. Optionally, you can specify some metrics to monitor IoT Edge deployments. In our case we have specified one metric to state if the device has been successfully configured

 

Sargithan_Senthil_31-1631452847182.png

 

20. Click on ‘Target Devices’ tab and specify the priority number for the deployment (higher values indicate higher priority) and the target condition by specifying the device/s you want to apply the deployment manifest on (in our case deviceid = ‘Percept_Excalibur’). You can click on view devices to check if the target condition is correct.

 

Sargithan_Senthil_32-1631452879816.png

21. Select ‘Review + create’ tab – if the validation passed, you are ready to create the deployment manifest by clicking on the create button.

 

Sargithan_Senthil_33-1631452959323.png

 

22. Now you can get the IoT Edge Device Connection string, using Azure IoT Hub, and pass it on to the Azure Percept DK user. The user will need to configure the Azure Percept DK to use the connection string

 

23. You should see the newly created deployment listed in ‘IoT Edge Deployments’ tab – wait a few minutes for the deployment manifest to be applied to the target device

 

 

Sargithan_Senthil_35-1631453067468.png

 

24. If successfully, the system metrics will report success

 

Sargithan_Senthil_37-1631453124423.png

 

25. The modules should be deployed on the device up and running showing no errors

 

Sargithan_Senthil_38-1631453158983.png

 

 

--------------------------------------------------------------------------------------------------------------------------------------------------------

 

Learn how to create automatic deployments on Azure Percept DK:

 

Azureeyemodule settings

IoT Edge Module Name: azureeyemodule

Image URI: mcr.microsoft.com/azureedgedevices/azureeyemodule:preload-devkit

 

Container Create Options:

 

 

{ 
    "ExposedPorts": { 
        "8554/tcp": {} 
    }, 
    "HostConfig": { 
        "Binds": [ 
            "/dev/bus/usb:/dev/bus/usb" 
        ], 
        "DeviceCgroupRules": [ 
            "c 189:* rmw" 
        ], 
        "PortBindings": { 
            "8554/tcp": [ 
                { 
                    "HostPort": "8554" 
                } 
            ] 
        } 
    } 
} 

 

 

 

Module Twin Settings:

 

 

{ 
    "ExposedPorts": { 
        "8554/tcp": {} 
    }, 
    "HostConfig": { 
        "Binds": [ 
            "/dev/bus/usb:/dev/bus/usb" 
        ], 
        "DeviceCgroupRules": [ 
            "c 189:* rmw" 
        ], 
        "PortBindings": { 
            "8554/tcp": [ 
                { 
                    "HostPort": "8554" 
                } 
            ] 
        } 
    } 
} 

 

 

 

ImageCapturingModule

IoT Edge Module Name: ImageCapturingModule

Image URI: mcr.microsoft.com/azureedgedevices/imagecapturingmodule:latest-arm64v8

Environment Variables:

RTSP_IP – azureeyemodule

RTSP_PORT – 8554

RTSP_PATH – raw

 

HostIpModule

IoT Edge Module Name: HostIpModule

Image URI: mcr.microsoft.com/azureedgedevices/hostipmodule:latest-arm64v8

 

Container Create Options:

 

 

{ 
    "NetworkingConfig": { 
        "EndpointsConfig": { 
            "host": {} 
        } 
    }, 
    "HostConfig": { 
        "NetworkMode": "host" 
    } 
}

 

 

 

WebStreamModule

IoT Edge Module Name: WebStreamModule

Image URI: mcr.microsoft.com/azureedgedevices/webstreammodule:preload-devkit

Environment Variables:

RTSP_IP – azureeyemodule

RTSP_PORT – 8554

RTSP_PATH – raw

Container Create Options:

 

 

{ 
    "ExposedPorts": { 
        "2999/tcp": {}, 
        "3000/tcp": {}, 
        "3002/tcp": {}, 
        "3004/tcp": {}, 
        "3006/tcp": {}, 
        "3008/tcp": {}, 
        "3010/tcp": {} 
    }, 
    "HostConfig": { 
        "PortBindings": { 
            "2999/tcp": [ 
                { 
                    "HostPort": "2999" 
                } 
            ], 
            "3000/tcp": [ 
                { 
                    "HostPort": "3000" 
                } 
            ], 
            "3002/tcp": [ 
                { 
                    "HostPort": "3002" 
                } 
            ], 
            "3004/tcp": [ 
                { 
                    "HostPort": "3004" 
                } 
            ], 
            "3006/tcp": [ 
                { 
                    "HostPort": "3006" 
                } 
            ], 
            "3008/tcp": [ 
                { 
                    "HostPort": "3008" 
                } 
            ], 
            "3010/tcp": [ 
                { 
                    "HostPort": "3010" 
                } 
            ] 
        } 
    } 
} 

 

 

 

--------------------------------------------------------------------------------------------------------------------------------------------------------

Now Try out Azure Percept yourself

 

To get started on building your own solutions with Azure Percept, it’s easy to purchase a developer kit to try out pilot projects before deciding to deploy at scale. You also can visit the Azure Percept YouTube channel for videos about getting started with the developer kit.

Posted at https://sl.advdat.com/3hskpwn