This blog post covers the topic of the third session on Middleware Friday
– a vLog initiative by Kent Weare brought to you by BizTalk360
. In this session, Kent Weare talks about “Azure Logic Apps and Cognitive Services Face API”. This is the first part of a multi part series of episodes on this topic.
to read the second part blog of this Middleware Friday episode series on Azure Logic Apps and Cognitive Services Face API.
Cognitive Services Vision API
The Vision API
is a state-of-the-art image processing algorithm that helps to moderate content automatically and build personalized apps by returning insights about faces, images and emotions. This API has several operations like Face Detection, Face Verification, Similar Face Search, Face Grouping, and Face Identification.
Let’s get started with the demo! For the demo purposes, Kent takes the example of an electronics store. I’ll try to replicate the same scenario with my examples to give you a real time experience :-). A security CCTV camera captures the faces of the shoppers who come in to the store. Once the pictures are taken, they are uploaded on to OneDrive. A Logic App consumes these images from OneDrive that will further be uploaded on to a Blob Storage. We will retrieve the URI that can be passed to the Cognitive Services Face API (by providing a public URI/URL that the Face API can pull from). The Face API will return a series of attributes that we will be storing on SQL Azure.
Create a Cognitive Services Account
: You need to create a Cognitive Services Account in Microsoft Azure before getting started with using the Face API feature.
- Sign in to the Azure Portal and navigate to ‘Cognitive Services‘
- Enter your Account Name
- Choose your Azure Subscription
- Select the API Type (in this case Face API)
- Choose your Location
- Choose your preferred pricing tier – F0 (20 calls per minute, 30K calls per month) or S0 (10 calls per second). Let’s choose the Free Tier (F0) for our purpose.
- Choose the Resource Group
- Agree to the terms and conditions and create your Cognitive Services account
Creating the Face API Logic App
The next step is to create the Face API Logic App. We will create a Logic App with the name MF-FaceAPI.
Once the Logic App is created, in the Logic App Designer, let’s start off with a Blank Logic App.
- We will first create a trigger for the file drop on OneDrive
- In the next step, we will create an action where the files from OneDrive are uploaded on to the blob storage. If you do not have a blob storage, you need to first create an Azure Storage account. In the ‘Create Blob’ connector, first connect with your Storage Account, and then provide the folder path, blob name, and blob content.
- Next, create an action to call the ‘Detect Faces (Preview)‘ API. For the purpose of this demo, we are simply taking the URL of the blob storage as the input so that the Face API can identify the pictures in the storage.
- In the last step, we will create a ‘For Each‘ action for the Face API operation that it will report the demographics information about the person in the picture to the Demographics table in the database. In this case, we will use SQL Azure. Therefore, you need to create a SQL Azure database first and then create a table with the following fields – ID, Gender, Age, Mustache, Beard, Sideburns, Sunglasses. The reason we are creating these database fields is that our Vision API will scan the picture to see if the person in the photo has any of these parameters and report the status into the database.
- That’s it! We have now created our Logic App. Time to run it and watch the fun :-). I am showing the real time execution of this Logic App that we created in the below recording file
Definitely takes less than a minute to identify your facial features and report the data to a SQL database. Interesting right? Then, hold on! There’s more coming in the next blog post as well. Kent also highlighted the community content from Steef-Jan Wiggers on “Using Azure Service Bus and BizTalk 2016 for messaging between enterprises“. You can watch the video of this session on Azure Logic Apps and Cognitive Services here.
You can give your feedback about Middleware Friday episodes, any special topic of interest, or any guest speaker whom you would like to see at Middleware Friday. Simply tweet at @MiddlewareFri
or drop an email to email@example.com
You can watch the Middleware Friday sessions here