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:
- 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
- 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
- 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…
- Goto Power Apps maker portal and click on AI Builder on the left. Click on Object Detection (it is under preview at the moment).
- A new window will open, give a name to your model
- You can select objects from CDS or your local machine.
- Select device..
- ..and add images (downloaded previously from Kaggle dataset). Images will upload
- Mention which object(s) you want AI model to auto-detect. In our case, this is only ‘Person’
- Next, we need to identify the object (Person – in our case) in each of the images. Click on each image..
- and tag all the persons
- AI Builder screen will show your progress on this tagging exercise
- When all the images are tagged, click on ‘Done tagging’
- Click Next
- This data will be then fed into training the model
- 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.
- This will open a familiar Power Apps maker portal. Add a button with the label ‘Analyze’ and a Data table.
- Behind a button, set output of the AI model to a ‘Persons’ collection
- Bind Data table with ‘Persons’ collection
- 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!