Power Platform: Mobile app to Count objects in an image: 1 simple line of Code

This article I can relate with my previous article in which I used one of the AI builder component – >Form Processing. In this article I will use another very interesting Power Platform AI Builder component and develop a Canvas app to use it on any mobile device.

This kind of app can be used for Retail Merchandising Audits where field service agents make sure that the product is positioned in the way that makes it most appealing to the consumer also how many and what items are on the shelf. Automatic input will reduce human errors and will save the agents time.

Another real time scenario could be where a company which provides items on rental and upon return staff count all the items to make sure that customer has completely returned all the items back to them or their warehouse. Suppose these items numbers are usually bigger and its time consuming for staff to count and input data in the system every time customer returns it .

I will show in this article that how easy it is to develop such application with power platform with few easy steps.

Lets start the implementation!

1. Train AI Builder Component.

I will first train AI builder’s Object Identification component by providing the images of my objects. It’s important to upload enough images to train AI model. At least 15 images should be uploaded for each object. With fewer images, there’s a strong risk that your model will learn concepts that are just noise, or not relevant. Training your model with more images should increase the accuracy. provide images with different angles, backgrounds, object size, groups, and other variants.

You need to have Power Platform license. If you don’t have you can start by creating office 365 trial on this URL. Https://Portal.office.com. You can follow instructions in below URL to setup power apps environment. https://docs.microsoft.com/en-us/power-platform/admin/create-environment

Once you have all setup you can click on AI Builder and then Build. Select Object Identification.

No alt text provided for this image

Provide any name to your Builder

No alt text provided for this image

There are options available on first screen. We will start with Common Objects

No alt text provided for this image

If you already have entities and objects in CDS database then you can select “Select from database” option. Otherwise just select + Add new object and create new objects. In this example to keep it simple I will create new.

No alt text provided for this image

Here you can add objects you want to identify by AI builder. I have given few names below.

No alt text provided for this image

When you click next it asks you to upload images.

No alt text provided for this image

Now upload images for each objects as mentioned above at least 15 for each object.

No alt text provided for this image

Interesting fact is that if you will upload same image with a different name. AI builder will detect it and will not upload.

No alt text provided for this image

After upload you will see a screen where you have to tag object in each image.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

AI builder will also show you the number of images tagged for each object.

No alt text provided for this image

Click next and click on Train. It will take a few minutes.

No alt text provided for this image

After training you will see AI builder will show you its performance in percentage. This performance score indicates how well the model did on the images you uploaded.

No alt text provided for this image

You can click on Quick Test button to quickly test your configured AI builder.

No alt text provided for this image

I have provided one image and you can see it has detected all three objects and also showing the accuracy percentage,

No alt text provided for this image

2. Use in a Canvas app for any mobile device.

To develop a canvas app using this builder click on use model button or create an app from scratch by clicking Apps on main left menu of power platform.

Select Insert and then select Object Detector from AI Builder menu

No alt text provided for this image

Select the newly created AI Builder component from AI models list

No alt text provided for this image

After selection. You will see a detect button. Click on detect button and then select any image to test your builder.

No alt text provided for this image

Now to see the count select Insert from the menu again and then from Gallery menu select Vertical or Horizontal gallery. It will drop a gallery on the canvas app form. Click on one of the image thumbnail in the gallery and then delete it.

No alt text provided for this image

One Single line of Code : Click on the gallery on canvas app form. After selecting the gallery type the circled text as mentioned in image below. The Object detector is the object name of your AI builder which can be seen on left hand side under screen one. You will see counts appearing on the gallery.

No alt text provided for this image

Click on File and Save this app. You can test this app by clicking play button.

No alt text provided for this image

This app can be used on mobile devices by downloading Power Apps Mobile app on the mobile device IOS or Android https://powerapps.microsoft.com/en-us/downloads/

Follow instructions from here to configure this app on mobile.

https://docs.microsoft.com/en-us/powerapps/user/run-canvas-and-model-apps-on-mobile.

Try it yourself.