Image Analysis in Power BI – Using AI Vision Insights [2/4]
Published Jul 19 2022 12:38 PM 1,201 Views
Microsoft

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. 

Step B: Perform AI Vision Insights transformation

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. 

  1. Create a new table that references the Images table.   
    Reference.png
  2. Rename the new table to ImageTags_VisionInsight
  3. Invoke the AI Vision transformation and select the ImageURL as the Image column.AIVision.png
  4. Change the Privacy Level Settings PrivacySetting.png

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.  AIVision_results.png

 

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. 

 

Version history
Last update:
‎Jul 19 2022 12:37 PM
Updated by: