Building a Traffic Monitoring AI application for a Smart City with Azure Percept

Published Aug 03 2021 10:09 AM 4,172 Views
New Contributor

Screenshot 2021-08-03 100359.jpg

 

Many smart cities are thinking about generating traffic insights using edge AI and video as a sensor.  These traffic insights can range from simpler insights such as vehicle counting and traffic pattern distribution over time to more advanced insights such as detecting stalled vehicles and alerting the authorities.

 

In this blog, I show how I am using an Azure Percept dev kit to build a sample traffic monitoring application using the reference sources and samples in GitHub provided by Microsoft along with the Azure IoT and Percept ecosystem.

 

I wanted to build a traffic monitoring application that would classify vehicles into cars, trucks, bicycles etc. and count each vehicle category to generate insights such as traffic density and vehicle type distribution over time. I wanted the traffic monitoring AI application to show me the traffic pattern distribution in a dashboard updated in real-time.  I also wanted to generate alerts and visualize a short video clip whenever an interesting event occurs (for example number of trucks exceed a threshold value).  In addition, a smart city manager would be able to pull up a live video stream when heavy traffic congestion is detected.

 

Here’s what I needed to get started

 

 

Azure-Percept.jpg

 

Azure Percept ($349 in the Microsoft store): https://www.microsoft.com/store/build/azure-percept/8v2qxmzbz9vc

HOST: NXP iMX8m processor

Vision AI: Intel Movidius Myriad X (MA2085) vision processing unit (VPU)

 

  • Inseego 5G MiFi ® M2000 mobile hotspot (reliable cloud connection for uploading events and videos)

inseego_5g_mifi_m2000_2_.png

 

Radio: Qualcomm ® snapdragon ™ x55 modem

Carrier/plan: T-Mobile 5g Magenta plan

https://www.t-mobile.com/tablet/inseego-5g-mifi-m2000

 

Key Azure Services/Technologies used

 

Overall setup and description

 

Step 1: Unbox and setup the Azure Percept

 

This step takes about 5-10 minutes when all goes well.  You can find the setup instructions here https://docs.microsoft.com/azure/azure-percept/quickstart-percept-dk-set-up.

Here are some screenshots that I captured as I went through my Azure Percept device setup process.

 

Screenshot 2021-08-03 093740.jpg

 

Key points to remember during the device setup are to make sure you note down the IP address of the Azure Percept and setup your ssh username and password so you can ssh into the Azure Percept from your host machine.

During the setup, you can create a new Azure IoT Hub instance in the Cloud or you can use an existing Azure IoT hub that you may already have in your Azure subscription.

 

Step 2: Ensure good cloud connectivity (uplink/downlink speed for events, videos and live streaming)

 

The traffic monitoring AI application I am building is intended for outdoor environments where wired connections are not always feasible or available.  Video connectivity is necessary for live streaming or uploading video clips when network connectivity is available.  For this demo, the Azure Percept device will be connecting to the cloud using a 5G device to upload events and video clips.  Make sure that the video uplink speeds over 5G are good enough for video clip uploads as well as live streaming.  Here is a screenshot of the speed test for the Inseego 5G MiFi ® M2000 mobile hotspot from T-Mobile that I am using for my setup.

 

Picture4.jpg

 

Step 3: Reference architecture

 

Here is a high-level architecture diagram of a traffic monitoring application built with Azure Percept and Azure services.  For this project, I used the Azure Percept dev kit with the single USB-connected camera (as opposed to external IP cameras) and Azure Video Analyzer.

 

Screenshot 2021-08-03 094021.jpg

 

Step 4: Build Azure eye module docker container for ARM 64

 

You will want to make a few customizations to the Azure Eye Module C++ source code tailored to your traffic monitoring application (for example, you can make customizations to only send vehicle detection events to IoT hub or you can build your own custom parser class for custom vehicle detection models).  For this project, I am using the SSD parser class with the default SSD object detection model in the Azure Eye Module.

To build a customized Azure Eye Module, first download the Azure Eye Module reference source code from GitHub. On your host machine, clone the following repo:

 

 

git clone https://github.com/microsoft/azure-percept-advanced-development.git

 

 

On your host machine, open a command shell and use the following command to build the Azure Eye Module docker container.  Note that you will need docker desktop running prior to running this command (I am using a Windows host):

 

docker buildx build  --platform linux/arm64  --tag azureeyemodule-xc -f Dockerfile.arm64v8  --load

 

 

Once docker image is built, tag it and push it to your ACR.

 

Step 5: Build Objectcounter docker container for arm64

 

Download the Object Counter reference source code from github. On your host machine, clone the following repo:

 

git clone https://github.com/Azure-Samples/live-video-analytics-iot-edge-python

 

 

Navigate to the folder live-video-analytics-iot-edge-python\src\edge\modules\objectCounter

Build the docker container and push it to your ACR:

 

 

docker build  -f docker/Dockerfile.arm64 –no-cache .  -t objectcounter:0.0.1-arm64v8
docker login  -u <your_acr_name>  -p <your_acr_password>  <your_acr_name>.azurecr.io
docker push <your_acr_name>.azurecr.io/objectcounter:0.0.1-arm64v8

 

I made several source code changes to main.py in the objectCounter module to customize my own objectCounter docker container.  For example, I only send a video event trigger to the signal gate processor (to capture video recording of a few seconds around an event) when a certain vehicle category exceeds a threshold count. I also made customizations so that object counter can understand inference events from SSD (in-built detection engine that comes with AzureEye Module) or a custom YOLOv3 model that is external to the AzureEye module (You can read about how to run an external YOLOv3 model in my previous blog post here

https://gorovian.000webhostapp.com/?exam=t5/internet-of-things/set-up-your-own-end-to-end-package-deliver...)

 

Step 6: Azure Video Analyzer For Edge Devices

 

To be able to save video recordings around interesting event detections, you will need the Azure Video Analyzer module.

You may choose to build your own custom AVA docker container from here:

https://github.com/Azure/video-analyzer.git

You can read more about the AVA and how to deploy it to an edge device here

https://docs.microsoft.com/en-us/azure/azure-video-analyzer/video-analyzer-docs/deploy-iot-edge-devi...

 

Step 7: Configure message routes between the Azure IoT edge modules

 

The different modules (Azure Percept Module, ObjectCounter Module and AVA Module) interact with each other through MQTT messages. 

 

Summary of the routes:

  • Azure Percept module sends the inference detection events to IoT hub which is configured to further route the messages either to blob storage or a database (for dashboards and analytics in the cloud). 
  • Azure Percept module sends the detection events to objectCounter module that implements business logic (such as object counts and aggregations which are used to trigger video recordings via the AVA module)
  • ObjectCounter module sends the aggregations and triggers to IoT hub which is configured to further route the messages either to blob storage or a database (for dashboards and analytics in the cloud). 
  • ObjectCounter module sends the event triggers to AVA so that AVA can start recording event clips

 

Here are a couple of screenshots to show how to route messages from IoT Hub to an endpoint:

 

Screenshot 2021-08-03 095308.jpg

 

Screenshot 2021-08-03 095340.jpg

 

Here is a sample inference detection event that IoT hub receives from the Azure Percept Module

 

 

Body":{
  "timestamp": 145831293577504,
  "inferences": [
    {
      "type": "entity",
      "entity": {
        "tag": {
          "value": "person",
          "confidence": 0.62337005
        },
        "box": {
          "l": 0.38108632,
          "t": 0.4768717,
          "w": 0.19651619,
          "h": 0.30027097
        }
      }
    }
  ]

 

 

Step 8: Set up the graph topology for AVA

 

There are multiple ways to build your own custom graph topology based on the use cases and application requirements.  Here is how I configured the graph topology for my sample traffic monitoring AI application.

 

 

 "sources": [
        {
          "@type": "#Microsoft.Media.MediaGraphRtspSource",
          "name": "rtspSource",
          "endpoint": {
            "@type": "#Microsoft.Media.MediaGraphUnsecuredEndpoint",
            "url": "${rtspUrl}",
            "credentials": {
              "@type": "#Microsoft.Media.MediaGraphUsernamePasswordCredentials",
              "username": "${rtspUserName}",
              "password": "${rtspPassword}"
            }
          }
        },
        {
          "@type": "#Microsoft.Media.MediaGraphIoTHubMessageSource",
          "name": "iotMessageSource",
          "hubInputName": "${hubSourceInput}"
        }
      ],
      "processors": [
        {
          "@type": "#Microsoft.Media.MediaGraphSignalGateProcessor",
          "name": "signalGateProcessor",
          "inputs": [
            {
              "nodeName": "iotMessageSource"
            },
            {
              "nodeName": "rtspSource"
            }
          ],
          "activationEvaluationWindow": "PT3S",
          "activationSignalOffset": "-PT1S",
          "minimumActivationTime": "PT3S",
          "maximumActivationTime": "PT4S"
        }
      ],
      "sinks": [  
        {
          "@type": "#Microsoft.Media.MediaGraphFileSink",
          "name": "fileSink",
          "inputs": [
            {
              "nodeName": "signalGateProcessor",
              "outputSelectors": [
                {
                  "property": "mediaType",
                  "operator": "is",
                  "value": "video"
                }
              ]
            }
          ],
          "fileNamePattern": "MP4-StreetViewAssetFromEVR-AVAEdge-${System.DateTime}",
          "maximumSizeMiB":"512",
          "baseDirectoryPath":"/var/media"
        }
      ]
    }
  }

 

 

If you are using a pre-recorded input video file (.mkv or .mp4) instead of live frames from the USB-connected camera module, then update the rtspUrl to grab frames via the RTSPsim module:

 

 

"name": "rtspUrl",
"value": "rtsp://rtspsim:554/media/inv.mkv"

 

 

I use the following RTSPSim container module provided by Microsoft to stream a pre-recorded video file:

 

 

mcr.microsoft.com/lva-utilities/rtspsim-live555:1.2

 

 

If you are using live frames from the USB-connected camera, then grab the live rtsp stream from Azure Percept Module:

 

 

"name": "rtspUrl",
"value": "rtsp://AzurePerceptModule:8554/h264"

 

 

Here is a brief explanation of the media graph topology that I use:

  • There are two source nodes in the graph. 
    • First source node is the RTSP source (the RTSP source can either serve live video frames from the Percept camera module or pre-recorded video frames served via the RTSPsim)
    • Second source node is the IoT message source (this is the output of the Object Counter Trigger)
  • There is one Processor node which is the signal gate processor.  This node takes the IoT message source and RTSP source as inputs and based on the object counter trigger, the signal gate requests the AVA module to create a 5 second video recording of the detected event (-PT1S to +PT4S)
  • There is one Sink node, which is the fileSink.  This could also be an AMS asset sink.  However, currently, AMS asset sink has a limitation of minimum 30 seconds video clip duration.  Hence, I used a fileSink to save a 5 second clip and then used an external thread to upload the locally saved .mp4 files to Azure blob storage.  Note that for on-demand live streaming, I use Azure AMS.

 

You can learn more about Azure Media Graphs here:

https://docs.microsoft.com/azure/media-services/live-video-analytics-edge/media-graph-concept

You can learn more about how to configure signal gates for event based video recording here:

https://docs.microsoft.com/azure/media-services/live-video-analytics-edge/configure-signal-gate-how-...

 

Step 9: Dashboard to view events, videos and insights

 

You can use any web app (e.g. react.js based) and create APIs to build a traffic monitoring dashboard that shows real-time detections and video recordings from Azure IoT hub and Azure blob storage. Here is an example of a dashboard:

 

Screenshot 2021-08-03 095922.jpg

 

Here are some examples of what the Azure Percept detected for a few live and pre-recorded videos:

 

Screenshot 2021-08-03 100050.jpg

 

(Media Credit: NVIDIA DeepStream SDK)

 

Screenshot 2021-08-03 100031.jpg

 

(Media Credit: NVIDIA DeepStream SDK)

 

Screenshot 2021-08-03 100008.jpg

 

Screenshot 2021-08-03 095946.jpg

 

In conclusion, in just a few days, I was able to set up a quick Proof of Concept of a sample traffic monitoring AI application using Azure Percept, Azure services and Inseego 5G MiFi ® M2000 mobile hotspot! 

 

Learn more about the Azure Percept at https://azure.microsoft.com/services/azure-percept/

 

Note: The views and opinions expressed in this article are those of the author and do not necessarily reflect an official position of Inseego Corp.

 

2 Comments
Occasional Visitor

This is awesome. I would be interested to know how you weather proofed the Azure Percept device please. Is there an enclosure we can get for it? 

New Contributor

Hi Jay, a custom enclosure will have to be built to weather proof the system

%3CLINGO-SUB%20id%3D%22lingo-sub-2616869%22%20slang%3D%22en-US%22%3ERe%3A%20Building%20a%20Traffic%20Monitoring%20AI%20application%20for%20a%20Smart%20City%20with%20Azure%20Percept%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2616869%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20is%20awesome.%20I%20would%20be%20interested%20to%20know%20how%20you%20weather%20proofed%20the%20Azure%20Percept%20device%20please.%20Is%20there%20an%20enclosure%20we%20can%20get%20for%20it%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2617607%22%20slang%3D%22en-US%22%3ERe%3A%20Building%20a%20Traffic%20Monitoring%20AI%20application%20for%20a%20Smart%20City%20with%20Azure%20Percept%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2617607%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Jay%2C%20a%20custom%20enclosure%20will%20have%20to%20be%20built%20to%20weather%20proof%20the%20system%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2596644%22%20slang%3D%22en-US%22%3EBuilding%20a%20Traffic%20Monitoring%20AI%20application%20for%20a%20Smart%20City%20with%20Azure%20Percept%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2596644%22%20slang%3D%22en-US%22%3E%3CP%20align%3D%22center%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Screenshot%202021-08-03%20100359.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300239i9A731362DA0BA2EF%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-08-03%20100359.jpg%22%20alt%3D%22Screenshot%202021-08-03%20100359.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMany%20smart%20cities%20are%20thinking%20about%20generating%20traffic%20insights%20using%20edge%20AI%20and%20video%20as%20a%20sensor.%26nbsp%3B%20These%20traffic%20insights%20can%20range%20from%20simpler%20insights%20such%20as%20vehicle%20counting%20and%20traffic%20pattern%20distribution%20over%20time%20to%20more%20advanced%20insights%20such%20as%20detecting%20stalled%20vehicles%20and%20alerting%20the%20authorities.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20blog%2C%20I%20show%20how%20I%20am%20using%20an%20Azure%20Percept%20dev%20kit%20to%20build%20a%20sample%20traffic%20monitoring%20application%20using%20the%20reference%20sources%20and%20samples%20in%20GitHub%20provided%20by%20Microsoft%20along%20with%20the%20Azure%20IoT%20and%20Percept%20ecosystem.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20wanted%20to%20build%20a%20traffic%20monitoring%20application%20that%20would%20classify%20vehicles%20into%20cars%2C%20trucks%2C%20bicycles%20etc.%20and%20count%20each%20vehicle%20category%20to%20generate%20insights%20such%20as%20traffic%20density%20and%20vehicle%20type%20distribution%20over%20time.%20I%20wanted%20the%20traffic%20monitoring%20AI%20application%20to%20show%20me%20the%20traffic%20pattern%20distribution%20in%20a%20dashboard%20updated%20in%20real-time.%26nbsp%3B%20I%20also%20wanted%20to%20generate%20alerts%20and%20visualize%20a%20short%20video%20clip%20whenever%20an%20interesting%20event%20occurs%20(for%20example%20number%20of%20trucks%20exceed%20a%20threshold%20value).%26nbsp%3B%20In%20addition%2C%20a%20smart%20city%20manager%20would%20be%20able%20to%20pull%20up%20a%20live%20video%20stream%20when%20heavy%20traffic%20congestion%20is%20detected.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--385638010%22%20id%3D%22toc-hId--385638041%22%3EHere%E2%80%99s%20what%20I%20needed%20to%20get%20started%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAn%20%3CA%20href%3D%22https%3A%2F%2Fazure.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EAzure%20subscription%3C%2FA%3E%20(with%20full%20access%20to%20Azure%20services)%3C%2FLI%3E%0A%3CLI%3EAn%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fazure-percept%2Foverview-azure-percept-dk%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Percept%20DK%3C%2FA%3E%20(Edge%20Vision%2FAI%20device%20with%20Azure%20IoT%20Edge)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20align%3D%22center%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Azure-Percept.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300211i0C49AFAE59375BF8%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Azure-Percept.jpg%22%20alt%3D%22Azure-Percept.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20Percept%20(%24349%20in%20the%20Microsoft%20store)%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fstore%2Fbuild%2Fazure-percept%2F8v2qxmzbz9vc%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fstore%2Fbuild%2Fazure-percept%2F8v2qxmzbz9vc%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EHOST%3A%20NXP%20iMX8m%20processor%3C%2FP%3E%0A%3CP%3EVision%20AI%3A%20Intel%20Movidius%20Myriad%20X%20(MA2085)%20vision%20processing%20unit%20(VPU)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EInseego%205G%20MiFi%20%C2%AE%20M2000%20mobile%20hotspot%20(reliable%20cloud%20connection%20for%20uploading%20events%20and%20videos)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20align%3D%22center%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22inseego_5g_mifi_m2000_2_.png%22%20style%3D%22width%3A%20625px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300212i749272375A22DA5A%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22inseego_5g_mifi_m2000_2_.png%22%20alt%3D%22inseego_5g_mifi_m2000_2_.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERadio%3A%20Qualcomm%20%C2%AE%20snapdragon%20%E2%84%A2%20x55%20modem%3C%2FP%3E%0A%3CP%3ECarrier%2Fplan%3A%20T-Mobile%205g%20Magenta%20plan%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.t-mobile.com%2Ftablet%2Finseego-5g-mifi-m2000%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fwww.t-mobile.com%2Ftablet%2Finseego-5g-mifi-m2000%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-2101874823%22%20id%3D%22toc-hId-2101874792%22%3EKey%20Azure%20Services%2FTechnologies%20used%3C%2FH2%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fiot_hub%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20IoT%20Hub%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fiot-edge%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20IoT%20Edge%3C%2FA%3E%20(edgeAgent%2C%20edgeHub%20docker%20containers)%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fazure-percept-advanced-development%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Percept%20Eye%20Module%3C%2FA%3E%26nbsp%3B%20(Azure%20Percept%20Module)%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fproducts%2Fvideo-analyzer%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Video%20Analyzer%3C%2FA%3E%20(AVA)%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fblob_storage%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Blob%20Storage%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fcontainer-registry%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Container%20Registry%3C%2FA%3E%20(ACR)%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fmedia-services%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Media%20Services%3C%2FA%3E%20(AMS)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-294420360%22%20id%3D%22toc-hId-294420329%22%3EOverall%20setup%20and%20description%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-984981834%22%20id%3D%22toc-hId-984981803%22%3EStep%201%3A%20Unbox%20and%20setup%20the%20Azure%20Percept%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20step%20takes%20about%205-10%20minutes%20when%20all%20goes%20well.%26nbsp%3B%20You%20can%20find%20the%20setup%20instructions%20here%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fazure-percept%2Fquickstart-percept-dk-set-up%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fazure-percept%2Fquickstart-percept-dk-set-up.%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EHere%20are%20some%20screenshots%20that%20I%20captured%20as%20I%20went%20through%20my%20Azure%20Percept%20device%20setup%20process.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20align%3D%22center%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202021-08-03%20093740.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300227i40CF414DAB9D1C59%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-08-03%20093740.jpg%22%20alt%3D%22Screenshot%202021-08-03%20093740.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EKey%20points%20to%20remember%20during%20the%20device%20setup%20are%20to%20make%20sure%20you%20note%20down%20the%20IP%20address%20of%20the%20Azure%20Percept%20and%20setup%20your%20ssh%20username%20and%20password%20so%20you%20can%20ssh%20into%20the%20Azure%20Percept%20from%20your%20host%20machine.%3C%2FP%3E%0A%3CP%3EDuring%20the%20setup%2C%20you%20can%20create%20a%20new%20Azure%20IoT%20Hub%20instance%20in%20the%20Cloud%20or%20you%20can%20use%20an%20existing%20Azure%20IoT%20hub%20that%20you%20may%20already%20have%20in%20your%20Azure%20subscription.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--822472629%22%20id%3D%22toc-hId--822472660%22%3EStep%202%3A%20Ensure%20good%20cloud%20connectivity%20(uplink%2Fdownlink%20speed%20for%20events%2C%20videos%20and%20live%20streaming)%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20traffic%20monitoring%20AI%20application%20I%20am%20building%20is%20intended%20for%20outdoor%20environments%20where%20wired%20connections%20are%20not%20always%20feasible%20or%20available.%26nbsp%3B%20Video%20connectivity%20is%20necessary%20for%20live%20streaming%20or%20uploading%20video%20clips%20when%20network%20connectivity%20is%20available.%26nbsp%3B%20For%20this%20demo%2C%20the%20Azure%20Percept%20device%20will%20be%20connecting%20to%20the%20cloud%20using%20a%205G%20device%20to%20upload%20events%20and%20video%20clips.%26nbsp%3B%20Make%20sure%20that%20the%20video%20uplink%20speeds%20over%205G%20are%20good%20enough%20for%20video%20clip%20uploads%20as%20well%20as%20live%20streaming.%26nbsp%3B%20Here%20is%20a%20screenshot%20of%20the%20speed%20test%20for%20the%20Inseego%205G%20MiFi%20%C2%AE%20M2000%20mobile%20hotspot%20from%20T-Mobile%20that%20I%20am%20using%20for%20my%20setup.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Picture4.jpg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300220i2F361AA357039A3A%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Picture4.jpg%22%20alt%3D%22Picture4.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1665040204%22%20id%3D%22toc-hId-1665040173%22%3EStep%203%3A%20Reference%20architecture%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20is%20a%20high-level%20architecture%20diagram%20of%20a%20traffic%20monitoring%20application%20built%20with%20Azure%20Percept%20and%20Azure%20services.%26nbsp%3B%20For%20this%20project%2C%20I%20used%20the%20Azure%20Percept%20dev%20kit%20with%20the%20single%20USB-connected%20camera%20(as%20opposed%20to%20external%20IP%20cameras)%20and%20Azure%20Video%20Analyzer.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20align%3D%22center%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202021-08-03%20094021.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300225i575FC0A526309224%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-08-03%20094021.jpg%22%20alt%3D%22Screenshot%202021-08-03%20094021.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--142414259%22%20id%3D%22toc-hId--142414290%22%3EStep%204%3A%20Build%20Azure%20eye%20module%20docker%20container%20for%20ARM%2064%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20will%20want%20to%20make%20a%20few%20customizations%20to%20the%20Azure%20Eye%20Module%20C%2B%2B%20source%20code%20tailored%20to%20your%20traffic%20monitoring%20application%20(for%20example%2C%20you%20can%20make%20customizations%20to%20only%20send%20vehicle%20detection%20events%20to%20IoT%20hub%20or%20you%20can%20build%20your%20own%20custom%20parser%20class%20for%20custom%20vehicle%20detection%20models).%26nbsp%3B%20For%20this%20project%2C%20I%20am%20using%20the%20SSD%20parser%20class%20with%20the%20default%20SSD%20object%20detection%20model%20in%20the%20Azure%20Eye%20Module.%3C%2FP%3E%0A%3CP%3ETo%20build%20a%20customized%20Azure%20Eye%20Module%2C%20first%20download%20the%20Azure%20Eye%20Module%20reference%20source%20code%20from%20GitHub.%20On%20your%20host%20machine%2C%20clone%20the%20following%20repo%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Egit%20clone%20https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fazure-percept-advanced-development.git%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOn%20your%20host%20machine%2C%20open%20a%20command%20shell%20and%20use%20the%20following%20command%20to%20build%20the%20Azure%20Eye%20Module%20docker%20container.%26nbsp%3B%20Note%20that%20you%20will%20need%20docker%20desktop%20running%20prior%20to%20running%20this%20command%20(I%20am%20using%20a%20Windows%20host)%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Edocker%20buildx%20build%20%20--platform%20linux%2Farm64%20%20--tag%20azureeyemodule-xc%20-f%20Dockerfile.arm64v8%20%20--load%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20docker%20image%20is%20built%2C%20tag%20it%20and%20push%20it%20to%20your%20ACR.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1949868722%22%20id%3D%22toc-hId--1949868753%22%3EStep%205%3A%20Build%20Objectcounter%20docker%20container%20for%20arm64%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDownload%20the%20Object%20Counter%20reference%20source%20code%20from%20github.%20On%20your%20host%20machine%2C%20clone%20the%20following%20repo%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Egit%20clone%20https%3A%2F%2Fgithub.com%2FAzure-Samples%2Flive-video-analytics-iot-edge-python%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENavigate%20to%20the%20folder%20live-video-analytics-iot-edge-python%5Csrc%5Cedge%5Cmodules%5CobjectCounter%3C%2FP%3E%0A%3CP%3EBuild%20the%20docker%20container%20and%20push%20it%20to%20your%20ACR%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Edocker%20build%20%20-f%20docker%2FDockerfile.arm64%20%E2%80%93no-cache%20.%20%20-t%20objectcounter%3A0.0.1-arm64v8%0Adocker%20login%20%20-u%20%3CYOUR_ACR_NAME%3E%20%20-p%20%3CYOUR_ACR_PASSWORD%3E%20%20%3CYOUR_ACR_NAME%3E.azurecr.io%0Adocker%20push%20%3CYOUR_ACR_NAME%3E.azurecr.io%2Fobjectcounter%3A0.0.1-arm64v8%3C%2FYOUR_ACR_NAME%3E%3C%2FYOUR_ACR_NAME%3E%3C%2FYOUR_ACR_PASSWORD%3E%3C%2FYOUR_ACR_NAME%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20made%20several%20source%20code%20changes%20to%20main.py%20in%20the%20objectCounter%20module%20to%20customize%20my%20own%20objectCounter%20docker%20container.%26nbsp%3B%20For%20example%2C%20I%20only%20send%20a%20video%20event%20trigger%20to%20the%20signal%20gate%20processor%20(to%20capture%20video%20recording%20of%20a%20few%20seconds%20around%20an%20event)%20when%20a%20certain%20vehicle%20category%20exceeds%20a%20threshold%20count.%20I%20also%20made%20customizations%20so%20that%20object%20counter%20can%20understand%20inference%20events%20from%20SSD%20(in-built%20detection%20engine%20that%20comes%20with%20AzureEye%20Module)%20or%20a%20custom%20YOLOv3%20model%20that%20is%20external%20to%20the%20AzureEye%20module%20(You%20can%20read%20about%20how%20to%20run%20an%20external%20YOLOv3%20model%20in%20my%20previous%20blog%20post%20here%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Finternet-of-things%2Fset-up-your-own-end-to-end-package-delivery-monitoring-ai%2Fba-p%2F2323165%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Finternet-of-things%2Fset-up-your-own-end-to-end-package-delivery-monitoring-ai%2Fba-p%2F2323165%3C%2FA%3E)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-537644111%22%20id%3D%22toc-hId-537644080%22%3EStep%206%3A%20Azure%20Video%20Analyzer%20For%20Edge%20Devices%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20be%20able%20to%20save%20video%20recordings%20around%20interesting%20event%20detections%2C%20you%20will%20need%20the%20Azure%20Video%20Analyzer%20module.%3C%2FP%3E%0A%3CP%3EYou%20may%20choose%20to%20build%20your%20own%20custom%20AVA%20docker%20container%20from%20here%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2Fvideo-analyzer.git%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FAzure%2Fvideo-analyzer.git%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EYou%20can%20read%20more%20about%20the%20AVA%20and%20how%20to%20deploy%20it%20to%20an%20edge%20device%20here%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-video-analyzer%2Fvideo-analyzer-docs%2Fdeploy-iot-edge-device%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-video-analyzer%2Fvideo-analyzer-docs%2Fdeploy-iot-edge-device%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1269810352%22%20id%3D%22toc-hId--1269810383%22%3EStep%207%3A%20Configure%20message%20routes%20between%20the%20Azure%20IoT%20edge%20modules%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20different%20modules%20(Azure%20Percept%20Module%2C%20ObjectCounter%20Module%20and%20AVA%20Module)%20interact%20with%20each%20other%20through%20MQTT%20messages.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESummary%20of%20the%20routes%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAzure%20Percept%20module%20sends%20the%20inference%20detection%20events%20to%20IoT%20hub%20which%20is%20configured%20to%20further%20route%20the%20messages%20either%20to%20blob%20storage%20or%20a%20database%20(for%20dashboards%20and%20analytics%20in%20the%20cloud).%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3EAzure%20Percept%20module%20sends%20the%20detection%20events%20to%20objectCounter%20module%20that%20implements%20business%20logic%20(such%20as%20object%20counts%20and%20aggregations%20which%20are%20used%20to%20trigger%20video%20recordings%20via%20the%20AVA%20module)%3C%2FLI%3E%0A%3CLI%3EObjectCounter%20module%20sends%20the%20aggregations%20and%20triggers%20to%20IoT%20hub%20which%20is%20configured%20to%20further%20route%20the%20messages%20either%20to%20blob%20storage%20or%20a%20database%20(for%20dashboards%20and%20analytics%20in%20the%20cloud).%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3EObjectCounter%20module%20sends%20the%20event%20triggers%20to%20AVA%20so%20that%20AVA%20can%20start%20recording%20event%20clips%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EHere%20are%20a%20couple%20of%20screenshots%20to%20show%20how%20to%20route%20messages%20from%20IoT%20Hub%20to%20an%20endpoint%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20align%3D%22center%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202021-08-03%20095308.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300229iE809E9191C4E48A3%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-08-03%20095308.jpg%22%20alt%3D%22Screenshot%202021-08-03%20095308.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20align%3D%22center%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202021-08-03%20095340.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300228i29F680EEF3896805%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-08-03%20095340.jpg%22%20alt%3D%22Screenshot%202021-08-03%20095340.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20is%20a%20sample%20inference%20detection%20event%20that%20IoT%20hub%20receives%20from%20the%20Azure%20Percept%20Module%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3EBody%22%3A%7B%0A%20%20%22timestamp%22%3A%20145831293577504%2C%0A%20%20%22inferences%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22type%22%3A%20%22entity%22%2C%0A%20%20%20%20%20%20%22entity%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22tag%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22value%22%3A%20%22person%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22confidence%22%3A%200.62337005%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%22box%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22l%22%3A%200.38108632%2C%0A%20%20%20%20%20%20%20%20%20%20%22t%22%3A%200.4768717%2C%0A%20%20%20%20%20%20%20%20%20%20%22w%22%3A%200.19651619%2C%0A%20%20%20%20%20%20%20%20%20%20%22h%22%3A%200.30027097%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%5D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-522539002%22%20id%3D%22toc-hId-522538971%22%3EStep%208%3A%20Set%20up%20the%20graph%20topology%20for%20AVA%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20are%20multiple%20ways%20to%20build%20your%20own%20custom%20graph%20topology%20based%20on%20the%20use%20cases%20and%20application%20requirements.%26nbsp%3B%20Here%20is%20how%20I%20configured%20the%20graph%20topology%20for%20my%20sample%20traffic%20monitoring%20AI%20application.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%20%22sources%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22%40type%22%3A%20%22%23Microsoft.Media.MediaGraphRtspSource%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22rtspSource%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22endpoint%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22%40type%22%3A%20%22%23Microsoft.Media.MediaGraphUnsecuredEndpoint%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22url%22%3A%20%22%24%7BrtspUrl%7D%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22credentials%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22%40type%22%3A%20%22%23Microsoft.Media.MediaGraphUsernamePasswordCredentials%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22username%22%3A%20%22%24%7BrtspUserName%7D%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22password%22%3A%20%22%24%7BrtspPassword%7D%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22%40type%22%3A%20%22%23Microsoft.Media.MediaGraphIoTHubMessageSource%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22iotMessageSource%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22hubInputName%22%3A%20%22%24%7BhubSourceInput%7D%22%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%22processors%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22%40type%22%3A%20%22%23Microsoft.Media.MediaGraphSignalGateProcessor%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22signalGateProcessor%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22inputs%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22nodeName%22%3A%20%22iotMessageSource%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22nodeName%22%3A%20%22rtspSource%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%22activationEvaluationWindow%22%3A%20%22PT3S%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22activationSignalOffset%22%3A%20%22-PT1S%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22minimumActivationTime%22%3A%20%22PT3S%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22maximumActivationTime%22%3A%20%22PT4S%22%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%22sinks%22%3A%20%5B%20%20%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22%40type%22%3A%20%22%23Microsoft.Media.MediaGraphFileSink%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22fileSink%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22inputs%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22nodeName%22%3A%20%22signalGateProcessor%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22outputSelectors%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22property%22%3A%20%22mediaType%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22operator%22%3A%20%22is%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22value%22%3A%20%22video%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%22fileNamePattern%22%3A%20%22MP4-StreetViewAssetFromEVR-AVAEdge-%24%7BSystem.DateTime%7D%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22maximumSizeMiB%22%3A%22512%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22baseDirectoryPath%22%3A%22%2Fvar%2Fmedia%22%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%0A%20%20%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20are%20using%20a%20pre-recorded%20input%20video%20file%20(.mkv%20or%20.mp4)%20instead%20of%20live%20frames%20from%20the%20USB-connected%20camera%20module%2C%20then%20update%20the%20rtspUrl%20to%20grab%20frames%20via%20the%20RTSPsim%20module%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%22name%22%3A%20%22rtspUrl%22%2C%0A%22value%22%3A%20%22rtsp%3A%2F%2Frtspsim%3A554%2Fmedia%2Finv.mkv%22%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20use%20the%20following%20RTSPSim%20container%20module%20provided%20by%20Microsoft%20to%20stream%20a%20pre-recorded%20video%20file%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3Emcr.microsoft.com%2Flva-utilities%2Frtspsim-live555%3A1.2%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20are%20using%20live%20frames%20from%20the%20USB-connected%20camera%2C%20then%20grab%20the%20live%20rtsp%20stream%20from%20Azure%20Percept%20Module%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%22name%22%3A%20%22rtspUrl%22%2C%0A%22value%22%3A%20%22rtsp%3A%2F%2FAzurePerceptModule%3A8554%2Fh264%22%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20is%20a%20brief%20explanation%20of%20the%20media%20graph%20topology%20that%20I%20use%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EThere%20are%20two%20source%20nodes%20in%20the%20graph.%26nbsp%3B%3CUL%3E%0A%3CLI%3EFirst%20source%20node%20is%20the%20RTSP%20source%20(the%20RTSP%20source%20can%20either%20serve%20live%20video%20frames%20from%20the%20Percept%20camera%20module%20or%20pre-recorded%20video%20frames%20served%20via%20the%20RTSPsim)%3C%2FLI%3E%0A%3CLI%3ESecond%20source%20node%20is%20the%20IoT%20message%20source%20(this%20is%20the%20output%20of%20the%20Object%20Counter%20Trigger)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3EThere%20is%20one%20Processor%20node%20which%20is%20the%20signal%20gate%20processor.%26nbsp%3B%20This%20node%20takes%20the%20IoT%20message%20source%20and%20RTSP%20source%20as%20inputs%20and%20based%20on%20the%20object%20counter%20trigger%2C%20the%20signal%20gate%20requests%20the%20AVA%20module%20to%20create%20a%205%20second%20video%20recording%20of%20the%20detected%20event%20(-PT1S%20to%20%2BPT4S)%3C%2FLI%3E%0A%3CLI%3EThere%20is%20one%20Sink%20node%2C%20which%20is%20the%20fileSink.%26nbsp%3B%20This%20could%20also%20be%20an%20AMS%20asset%20sink.%26nbsp%3B%20However%2C%20currently%2C%20AMS%20asset%20sink%20has%20a%20limitation%20of%20minimum%2030%20seconds%20video%20clip%20duration.%26nbsp%3B%20Hence%2C%20I%20used%20a%20fileSink%20to%20save%20a%205%20second%20clip%20and%20then%20used%20an%20external%20thread%20to%20upload%20the%20locally%20saved%20.mp4%20files%20to%20Azure%20blob%20storage.%26nbsp%3B%20Note%20that%20for%20on-demand%20live%20streaming%2C%20I%20use%20Azure%20AMS.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20learn%20more%20about%20Azure%20Media%20Graphs%20here%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fmedia-services%2Flive-video-analytics-edge%2Fmedia-graph-concept%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fmedia-services%2Flive-video-analytics-edge%2Fmedia-graph-concept%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EYou%20can%20learn%20more%20about%20how%20to%20configure%20signal%20gates%20for%20event%20based%20video%20recording%20here%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fmedia-services%2Flive-video-analytics-edge%2Fconfigure-signal-gate-how-to%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fmedia-services%2Flive-video-analytics-edge%2Fconfigure-signal-gate-how-to%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1284915461%22%20id%3D%22toc-hId--1284915492%22%3EStep%209%3A%20Dashboard%20to%20view%20events%2C%20videos%20and%20insights%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20use%20any%20web%20app%20(e.g.%20react.js%20based)%20and%20create%20APIs%20to%20build%20a%20traffic%20monitoring%20dashboard%20that%20shows%20real-time%20detections%20and%20video%20recordings%20from%20Azure%20IoT%20hub%20and%20Azure%20blob%20storage.%20Here%20is%20an%20example%20of%20a%20dashboard%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20align%3D%22center%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Screenshot%202021-08-03%20095922.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300231i4E4F4EE916EC390F%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-08-03%20095922.jpg%22%20alt%3D%22Screenshot%202021-08-03%20095922.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20are%20some%20examples%20of%20what%20the%20Azure%20Percept%20detected%20for%20a%20few%20live%20and%20pre-recorded%20videos%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20align%3D%22center%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Screenshot%202021-08-03%20100050.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300232i0A3A260050C08A86%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-08-03%20100050.jpg%22%20alt%3D%22Screenshot%202021-08-03%20100050.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E(Media%20Credit%3A%20NVIDIA%20DeepStream%20SDK)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20align%3D%22center%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Screenshot%202021-08-03%20100031.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300234i5536168B449A8566%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-08-03%20100031.jpg%22%20alt%3D%22Screenshot%202021-08-03%20100031.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E(Media%20Credit%3A%20NVIDIA%20DeepStream%20SDK)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20align%3D%22center%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Screenshot%202021-08-03%20100008.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300235iD3D69994AEB4FE07%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-08-03%20100008.jpg%22%20alt%3D%22Screenshot%202021-08-03%20100008.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20align%3D%22center%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Screenshot%202021-08-03%20095946.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300233i9F188CF441F0BD83%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-08-03%20095946.jpg%22%20alt%3D%22Screenshot%202021-08-03%20095946.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20conclusion%2C%20in%20just%20a%20few%20days%2C%20I%20was%20able%20to%20set%20up%20a%20quick%20Proof%20of%20Concept%20of%20a%20sample%20traffic%20monitoring%20AI%20application%20using%20Azure%20Percept%2C%20Azure%20services%20and%20Inseego%205G%20MiFi%20%C2%AE%20M2000%20mobile%20hotspot!%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELearn%20more%20about%20the%20Azure%20Percept%20at%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fazure-percept%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fazure.microsoft.com%2Fservices%2Fazure-percept%2F%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3ENote%3A%20The%20views%20and%20opinions%20expressed%20in%20this%20article%20are%20those%20of%20the%20author%20and%20do%20not%20necessarily%20reflect%20an%20official%20position%20of%20Inseego%20Corp.%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2596644%22%20slang%3D%22en-US%22%3E%3CP%3EUsing%20Azure%20Percept%2C%20I%20am%20building%20a%20sample%20traffic%20monitoring%20AI%20application%20for%20a%20smart%20city.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Traffic1.png%22%20style%3D%22width%3A%20444px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300207i4E1D4043EB1303A2%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Traffic1.png%22%20alt%3D%22Traffic1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2596644%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20IoT%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20IoT%20Edge%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Media%20Services%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Percept%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Video%20Analyzer%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EIoT%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Co-Authors
Version history
Last update:
‎Aug 06 2021 03:27 PM
www.000webhost.com