In the previous post, we extracted a list of image URLs.
In this post we will perform the AI Insights vision transformation on the list of image URLs.
Important: Power BI Premium Capacity is required for AI Insights feature. You will need to be signed into the PowerBI Desktop to use the feature.
There can be many Image Tags produced from the AI Vision transformation for a single image. So we will create another table and use the ImageId to establish a one to many relationship between the two tables.
The AI Vision Insights returns the following outputs:
Column Name | Description |
Tag images.Tags | comma separated list of all tables sorted from highest confidence value to the least. |
Tag images.Json | JSON value of all the tags with their corresponding confidence value. |
Tag images.Tag | single Tag string |
Tag images.Confidence | corresponding Confidence value for the Tag |
Tag images.ErrorMessage | AI Vision was unable to process the image and the Error message is captured in this field. |
5. Remove Following columns: "Tag images.Json","ImageURL", "WebURL"
6. Rename the following columns
Old Column Name |
New Column Name |
Tag images.Tags |
Tags |
Tag images.Tag |
Tag |
Tag images.Confidence |
Confidence |
Tag images.ErrorMessage |
Error |
7. Sort the column by Imageid
8. Modify the address formula to also sort by a second column, the Confidence.
= Table.Sort(#"Removed Columns",{{"ImageId", Order.Ascending},{"Confidence", Order.Descending}})
The ImageTags_VisionInsight now contains the Tags and the Confidence Percent.
Entire PowerQuery Script for the ImageTags_VisionInsight table is:
let
Source = Images,
#"Applied Tag images" = AIFunctions.PostProcess(Table.AddColumn(Source, "Tag images", each #"Tag images"([ImageURL], "en")), "Tag images", "CognitiveServices.TagImagesanytext") meta [FunctionBrowser="Vision"],
#"Renamed Columns" = Table.RenameColumns(#"Applied Tag images",{{"Tag images.Tags", "Tags"}, {"Tag images.Tag", "Tag"}, {"Tag images.Confidence", "Confidence"}, {"Tag images.ErrorMessage", "Error"}}),
#"Removed Columns" = Table.RemoveColumns(#"Renamed Columns",{"Tag images.Json","ImageURL", "WebURL"}),
#"Sorted Rows" = Table.Sort(#"Removed Columns",{{"ImageId", Order.Ascending},{"Confidence", Order.Descending}})
in
#"Sorted Rows"
Summary
Power BI AI Vision Insights is very easy to use for identifying objects and analyzing images, but requires Power BI Premium Capacity.
In the next post we will create two DAX Measures, one for Tag and the other for the Confidence. The DAX measures will then be used in the Matrix visual.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.