Building Crowd Counting Model using AI Builder

Photo by Skitterphoto on Pexels.com

Counting the number of people in a photo or video feed is one of the interesting problems in the world of AI, and for a good reason because “number of people/given area” is a useful metric for number of practice purposes. For example:

  1. Retail: Knowing foot traffic in a specific store area or floor indicates how impactful the discount promotion is, or how popular a particular brand/product is
  2. LGAs/councils/city governments: Lot of smart cities want to know near real-time information on how many people are in a particular public space, park, or tourist spot to ensure adequate resources are available to ensure city services are functioning correctly
  3. Police/law enforcement/emergency services: Knowing the crowd size, helps emergency services to deploy resources appropriately

Also worth mentioning, like any other use of AI models, this is an area where functioning under the theme of AI for good is very important.

Data and tool

To experiment how AI Builder can help in crowd counting with #nocode approach, the first to-do is to secure data. Kaggle is one of the best resources for publicly available data. You can search and find a lot of data sets related to any topic. I found this one interesting and downloaded the data set on my laptop.

The tool is an AI Builder Object Detection model.

Let’s dive in…

  1. Goto Power Apps maker portal and click on AI Builder on the left. Click on Object Detection (it is under preview at the moment).
  1. A new window will open, give a name to your model
  1. You can select objects from CDS or your local machine.
  1. Select device..
  1. ..and add images (downloaded previously from Kaggle dataset). Images will upload
  1. Mention which object(s) you want AI model to auto-detect. In our case, this is only ‘Person’
  1. Next, we need to identify the object (Person – in our case) in each of the images. Click on each image..
  1. and tag all the persons
  1. AI Builder screen will show your progress on this tagging exercise
  1. When all the images are tagged, click on ‘Done tagging’
  1. Click Next
  1. This data will be then fed into training the model
  1. When the training will complete (may take a few minutes), it will show the degree of accuracy

It is not ideal but is not too bad for a #nocode experiment. Click on Publish. There are two ways to use this model; in a Power Automate Flow or in a Power Apps app. For this experiment, we will create a quick Canvas App. Click on Power Apps.

  1. This will open a familiar Power Apps maker portal. Add a button with the label ‘Analyze’ and a Data table.
  1. Behind a button, set output of the AI model to a ‘Persons’ collection
  1. Bind Data table with ‘Persons’ collection
  1. Save and experiment. Select image, let the AI model run and click on Analyze.

The model is returning the number of objects (persons) it identified with quite an impressive accuracy.

Please do let me know your feedback, always love to hear back from #PowerApps community. Happy Power-apping!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.