Counting Objects in an Image with an Object Recognition Power App

Harshani Perera, 08 November 2019

Following on from my blog about Object Recognition using the Microsoft Power Apps AI Builder, we created an AI Model to detect bananas.

In this blog, we will create an App using a similar Model so that you can easily use it to detect objects. The following steps will show you how to do this.

Step 1: Login to PowerAppshttps://make.powerapps.com/with your account.

Step 2: Once you are in PowerApps, on the left pane go to AI Builder (preview) and select Models. Find your model and select it. You will see the following page.

Step 3: Click Create app button > Select Canvas app from blank.

Step 4: Enter a name for your app and select the Phone Format.

Step 5: Click Insert > AI Builder (preview) > Object detector

Step 6: Select the AI model you want to connect to. I will select the Fruit Detector model which I have previously created to detect Pineapples.

The following will be displayed.

Step 7: Now I will show you how you can display the name of fruit and the count on the App.


Display the Name of Fruit and the Count.

  1. Go to Insert > Click Data table

  1. Move the table down below. Select the table and on the function fx, type ObjectDetector1.VisionObjects

  1. Click Edit fields link on the right > Click Add field > Select displayName and count > Click Add

The App will look similar to the following image.

Step 8: You can format the App if needed. For this app, I updated the name so that it’s more meaningful than ‘displayName’

Step 9: Now let’s test the App by uploading an image with many pineapples. Click the Play button on the right.

Click Detect and upload the image from your computer.

The Model has detected 5 Pineapples.

Step 9: Save the App and Publish it by going to File > Save > Click Save

Now you have an app you can take a picture of that will detect the type and number of fruit. This can also be used to detect the number of other objects e.g. number of bottles in a shop inventory.