Android Object Detection Power App that we will build in this article

You might have an idea for an application that detects an object or image and not have anyone to build it. You might be a programmer and want to try out your ideas and Azure Custom Vision before you start writing code. No matter what your coding skills are, if you want to prototype an application with AI, Power Platform and it’s AI Builder feature is a fast and easy option.

This article explains what Power Platform is, as well as go through a step by step process to create a mobile app that takes a photo and detects objects. If you want to dive right in, skip to “How to detect objects from images?” section.

Check out the video below to see the app we will build to detect different Mixed Reality Headsets such as HoloLens version 1 and 2 Augmented Reality and Virtual Reality headsets and their hand controllers.

Azure Custom Vision Head-Mounted Display(HMD) detection app demo

What is Power Platform?

Power Platform is a set of tools, API’s and SDK’s that helps you analyze your data and build automations, applications and virtual agents with or without having to write any code.

Power Platform tools

What are Power Apps?

Power Apps, allows you to create applications with a drag and drop UI and easy integration of your data and 3rd party APIs through connectors.

A connector is a proxy or a wrapper around an API that allows the underlying service to talk to Microsoft Power Automate, Microsoft Power Apps, and Azure Logic Apps. It provides a way for users to connect their accounts and leverage a set of pre-built actions and triggers to build their apps and workflows. For example, you can use the Twitter connector to get tweet data and visualize it in a dashboard or use the Twilio connector to send your users text messages without having to be an expert in Twitter or Twilio APIs or having to write a line of code.

Check out the list of connectors for Power Apps to see all the APIs that are available. Notice Power Automate or Logic App connectors might not be the same.

What is AI Builder?

AI Builder is one of the additional features of Power Apps. With AI Builder, you can add intelligence to your apps even if you have no coding or data science skills.

Power Apps: AI Builder app view

What are some of the use cases for AI Builder?

You can use pre-trained models to:

  • Detect objects from images
  • Analyze your customers’ sentiment from feedback
  • Detect keywords from text
  • Extract specific information about your business from text

Is AI Builder the right choice?

Great question! There are so many tools out there and many ways to do the same thing. How do you know which one is the right solution before investing time and effort?

I have a rule of thumb when I want to build something, use whatever is available and easy to use first. When your needs exceed what the tool you are using covers, look into another solution or building it yourself.

Use the tool easiest to get started when you are building your idea. When your needs exceed the capabilities of the tool you are using, find a solution that enables you. Don’t invest in building things from scratch before you know it is worth it to do so.

For example, if you have an app idea, it is better to have a prototype running as easily as possible. You can test your ideas before investing your time into building custom designed UI or features. In our specific case, you can first prototype your app with the drag and drop UI of Power Apps and using prebuilt AI models. When your specific needs surface, such as recognizing a particular object or keyword, you can invest your time into creating your custom models to train for the object or keyword detection.

Can I use Power Apps and AI Builder for production?

Yes you can. As any tool that does things magically, AI Builder in Power Apps comes with a cost. That does not mean you can’t try your ideas out for free.

What will my production app cost?

If you want to go to production with Power Apps, it is a good idea to consider the costs. Thankfully there is an app for that. AI Builder Calculator lets you input what AI tools you will need and how many users will be accessing your app’s AI features and gives you the price it will cost you.

AI Builder Cost Calculator

What are preview features?

AI Builder was released for public preview on June 10, 2019 in Europe and the United States. Preview release features are subject to change and may have restricted functionality before the official release for general availability. Preview releases are not meant for production use. You can try them out and influence the final product by giving feedback.

The General Availability (GA) release will occur in a phased manner, with some features remaining in preview status while others are released for GA. You can check out the release status on the AI Builder documentation.

AI Builder preview features notice

What is Object Detection?

AI Builder Object detection is an AI model that you can train to detect objects in pictures. AI models usually require that you provide samples of data to train before you are able to perform predictions. Prebuilt models are pre-trained by using a set of samples that are provided by Microsoft, so they are instantly ready to be used in predictions.

Object detection can detect up to 500 different objects in a single model and support JPG, PNG, BMP image format or photos through the Power Apps control.

Try out Azure Computer Vision

You can try out and see how object detection works before having to create and accounts or apps yourself on the Azure Computer Vision page.

What can you do with Object Detection?

  • Object counting and inventory management
  • Brand logo recognition
  • Wildlife animal recognition

How to detect objects from images?

To start creating your AI model for your app, sign in to Power Apps and click on AI Builder on the left hand menu. Select Object Detection from the “Refine Model for your business needs” option.

Build Object Detection on Power Apps — AI Builder

Name your new AI model with a unique name. Select Common Objects and proceed to next section.

Train your custom vision model screen for Object Detection.

Name the objects that you are going to detect.

Name each objects to be detected

Upload images that contain the object you will detect. To start with you can upload 15 images for each object.

Training image format and size for object detection

Make sure each object has approximately the same amount of images tagged. If you have more examples of one object, the training data will be likely to detect that object when it is not.

False positive HoloLens 2 detection

Tag your objects by selecting a square that your object is in and choosing the name of the object.

Tagging objects

Once you are done choose Done Tagging and Train. Training process will take some time.

You can choose to not use images after you upload and tag them

If you choose to not use an image or clear any tags, you can do that at any time by going back to your model under the AI Builder on the left hand side menu and choose your model and choose edit.

AI Builder will give you a Performance score over 100 and a way to quickly test your model before publishing. You can edit your models and retrain to improve your performance. Next section will give you some best practices to improve your performance.

Performance score of trained model

How to improve Custom Vision Model performance?

Getting the best model performance for your business can be a rather iterative process. Results can vary depending on the customizations you make to the model, and the training data you provide.

To help facilitate this process, AI Builder allows you to have multiple versions of your model so you can use your model and continue to improve it at the same time.

What are some best practices for training for object detection?

  • Use diverse images to train with all possible use cases. For example if you are training your data to detect a VR headset, use images of the headset used in different environments as well as the out of the box images. If you only train with images with people wearing the headset, your model would not recognize images of the same device when it is in its box.
HoloLens version 1 and 2 training picture with different background and view angle
HoloLens 2 training data
  • Use images with variety of backgrounds. Photos in context are better than photos in front of the neutral backgrounds.
HoloLens and VR headset data with different background
  • Use training images that have different lighting. For example, include images images taken with flash, high exposure, and so on.
HoloLens training data with low light
  • Use images of objects in varied sizes. Different sizing helps the model generalize better.
  • Use images taken from different angles. If all your photos are from a set of fixed cameras such as surveillance cameras, assign a different label to each camera. This can help avoid modeling unrelated objects such as lampposts as the key feature. Assign camera labels even if the cameras capture the same objects.
HoloLens training image with different size and angle

How to share your Custom Vision models?

By default, only you can see the models you create and publish. This feature allows you to test them and use them within apps and flows without exposing them.

If you want others to use your model, you can share it with specific users, groups, or your whole organization.

How to use your Custom Vision model in a Power App?

Once you are happy with you model’s performance, you can add it to a new app by choosing Use model and New app.

Use your model in a new Power App

You will be redirected to Power App editor and an Object Detection component that uses your model will be added automatically. In the editor, you can add new pages to navigate, design and customize your pages.

Your AI model used in the Object Detection component

Once you are happy with the design, you can publish and share your app. You can use your new app by downloading Power Apps from Apple, Android or Microsoft stores. Once you sign in, your app will be listed in the mobile Power Apps.

Power App in Android Play Store

What’s next?

Now you have your app’s prototype, you can add more features, get feedback and test your app.

Should I keep using my power app or rebuild it?

When your needs change, you can consider refactoring your application to a serverless backend and a custom built UI. If the app is working fine for you and your users, you can continue using and improving overtime using Power Apps.

What would be the changes that require the upgrade? There are two possibilities for the changed requirements for your app:

  • Feature
  • Budget

How to create a custom feature for Power Apps?

Ready made tools are always limited to the features the product team decides to include. If you are writing custom code, you can add any feature that you need. Thankfully, for the features that are not implemented yet, it is always possible to author a custom connector that you can use with or without Power Apps.

A connector is a proxy or a wrapper around an API that allows the underlying service to talk to Microsoft Power Automate, Microsoft Power Apps, and Azure Logic Apps. It provides a way for users to connect their accounts and leverage a set of pre-built actions and triggers to build their apps and workflows.

Check out the list of Power Apps Connectors and how to build a custom connector yourself.

How to compare costs for Power Apps and Logic Apps?

Once you start using your app, you will have a better idea about the number of users accessing AI capabilities and the number of images that you need to train. You can use AI Builder Cost Calculator and Logic App Cost Calculator to compare options. You can check any other service price through Azure Product Cost Calculator.

Additional Resources

Thank you for your attention! Leave a comment below for your AI application use cases and the tutorials you would like to see.

--

--

Ayşegül Yönet
Microsoft Azure

Senior Azure Cloud Developer Advocate at Microsoft and focuses on Cognitive Services, Spatial Computing and WebXR. She is a co-chair of W3C Immersive Web