Deploy a Vision AI Model with Visual Studio Code

What you will do

  • Configure VS Code for model deployment
  • Deploy a pre-built sample model container image to the Visual AI DevKit hardware

What you will need

  • Visual Studio (VS) Code with required extentions (Instructions)
  • Vision Dev Kit sample model - GitHub repository.
  • Azure IoT Hub and Azure IoT Edge device configured for your Vision AI DevKit hardware (Instructions)
  • Active Wi-Fi access point with Internet connectivity
  • ADB command line utility (Instructions)
  • (optional) HDMI cable and monitor to view video from the Visual AI DevKit.

Deploy the sample model container image to the Vision AI DevKit

  1. Download or Clone the latest Vision AI DevKit repository from GitHub.
  2. Launch Visual Studio Code, and select [File > Open Folder…] command to open the “VisionSample” directory as the workspace root.
  3. Right click the deployment.template.json file under the VisionSample\DeployContainerFromAML folder and select Generate IoT Edge Deployment Manifest to create a new deployment.json file under VisionSample\DeployContainerFromAML\config folder.
    Open deployment.template.json screen shot
  4. Click the [Explorer] icon, then click […] in the AZURE IOT HUB DEVICES section on the right side. Click Select IoT Hub to select your Azure IoT Hub.
  5. Expand the AZURE IOT HUB DEVICES section. Right-click your IoT Edge device, then select Create Deployment for Single Device. Click the deployment.json file under the VisionSample\DeployContainerFromAML\config folder, then click the Select Edge Deployment Manifest button to deploy the container image to the IoT Edge device (your Vision AI DevKit hardware). Open deployment.template.json from VSC Screenshot
    Open deployment.template.json from VSC Screenshot #2
  6. Configure the device as an IoT Edge device using the connection string for your Vision AI DevKit, obtained earlier.
  7. Monitor the deployment status for the AI Vision Kit device by the command lines
    adb shell docker ps
    adb shell docker logs edgeAgent
    

    Use ADB to monitor deployment status Screenshot

  8. Check object detection results using the command line

    adb shell iotedge logs <module name>
    (e.g. “adb shell iotedge logs VisionSampleImagenet”)
    

    Mobilenet-imagenet model can detect the 1000 object classes listed in the VisionSample\MachineLearning\models\mobilenet-imagenet\orig\output_labels.txt.

    Use ADB to module impage outputs Screenshot

In VS Code, select AZURE IOT HUB DEVICES > … > Select IoT Hub and then AZURE IOT HUB DEVICES > … > Start Monitoring D2C Message command to monitor the messages sent from the AI Vision DevKit to your Azure IoT Hub. Screenshot of message monitoring output

Verify output on the monitor

Connect the HDMI cable to the Vision AI DevKit hardware and your monitor. A few minutes after submitting your deployment, you should start to see video on the monitor with bounding boxes drawing around objects the camera can see and evaluate.

Note: You can also view the camera output using an RTSP compatible video player. See View RTSP video stream for more information.

Updated: