Wednesday, November 10, 2021

Create an Object Recognition Machine Learning model - no code required!

Organize your closet with AI.png

This blog post is part 2 of a 4-part series. To catch up on previous posts, check out the links below:


So, you’ve set up your Power Apps account, explored some Microsoft Learn modules, and have some familiarity with the platform. Now what? In part 2 of this series, we’ll explore the AI Builder feature inside of Power Apps. Using AI Builder, we’ll train, test, and publish an AI model that will be able to sort your clothing into the correct category, all without writing a single line of code. Let’s get started!


Part 2: Training your Machine Learning Model


What is AI Builder?

AI Builder is a feature of the Microsoft Power Platform that enables you to automate processes and predict outcomes. Using AI Builder, you can quickly bring AI to your Power Apps using data from many types of data platforms, including SharePoint, Azure, or even files from your local computer. You can create an AI model using AI Builder without using any code! You can also use one of the prebuilt AI models, where you don’t need any data to build and train the model. Here are some of the things you can do with AI Builder:

  • Analyze text for classification, key phrases, language, and sentiment.
  • Predict whether something will happen.
  • Process text from images.
  • Recognize and count items in images.

In this blog post, I’ll show you how to build your own AI model and use that model for the last use case: recognizing and counting items in images.


How do I access AI Builder inside of my Power Apps account?

From the Power Apps home screen, select Models under the AI Builder menu on the left-hand side. The first thing you’ll need to do is select Start free trial in the light pink ribbon at the top, so that you can start playing with AI Builder inside of Power Apps. A trial enables you to use AI Builder features for free during the 30-day trial period. For more information about AI Builder licensing, see the AI Builder licensing documentation.




How do I build my own AI model with AI Builder?

After your trial is active, select Build an AI model. You’ll be presented with a list of different types of models, including prebuilt models and customizable models. Under Refine a model for your business needs, select Object Detection as the type of AI model you want to create.



Go ahead and name your model – I chose “My Closet” for the name of my object detection model. There are three steps to building an object detection model, and I’ll walk you through each one.

  1. Teach the model about your objects. We’ll need to define our object names, and upload 15+ images of each one. After you name your model and select Create, select Common objects for your model’s domain. Next, we’ll need to choose objects for our model to detect. Select Add new object  and add a new object name for each category in your closet. For my closet, I chose to do pants, tops, and dresses. When you’re finished adding your objects, select Next.
  1. Tag images and train your model. We’ll teach the model to identify the objects by tagging and labeling them. Then, we’ll train and test our model to make sure it’s working. Go through each image that you’ve uploaded and tag the objects in each image. The only requirements are that you must tag at least 15 images for each object (in my case, pants, tops, and dresses), but you can have multiple tags per image.


When you’re finished tagging all your images, select Done tagging in the upper-right hand corner of your screen. You’ll be presented with a Model summary, where you’ll be able to check out all of the stats about your model before you train it. If everything looks good, select Train. Depending on how many images you’ve uploaded, this step may take a while, so go grab a drink or snack and come back in a few!


After your model is trained, take a few minutes to test it out by selecting Quick test, and make sure it performs the way you’d like. For more information, and resources on how to interpret your model performance score, check out the documentation on how to Train and publish your object detection model.


performance.png quicktest.png

  1. Publish your new AI model. You’ve now created an AI model that can identify and count the objects you’ve defined – pants, tops, and dresses! After you’re happy with the results of your testing, select Publish.

Now that you have a trained and published AI model, experiment with adding it to a Power App or Power Automate flow by selecting the Use model button. Before next week’s blog post, go through the guide for Using an object detection component in Power Apps to make sure you are set up for success.


In part 3, we’ll make a Power App that uses our new AI model to categorize and count the objects in our closet! Looking forward to seeing you here next week!

Posted at