Azure Cognitive Services

Created: 17 May 2017, last update: 30 Jan 2022

Using Microsoft Azure Cognitive Services to describe media

Images without a alt tag give a warning in Sitecore. Should be nice if the upload suggest a description if not filled in. So I try to integrate Azure Cognitive service with the upload functionality in Sitecore.

First I found out is Microsoft a good choice for this job, Because other cloud services do not have a description only tags. However Cloudsight has a very good description but it is slower, I think I need a fast services to make it user friendly.
see Image recognition with standard cloud services for comparison.

Also I found all those services are english only. It should be in any language, so I also add a Translation services.

 

About the c# code, this poc use the raw API and not the library so lesser dependencies. There is also a Computer Vision API Client Library, a thin C# client wrapper for the Microsoft Computer Vision API. Project Oxford, but with dependecies on Newtonsoft.Json this conflict with the version your Sitecore use. To get it running create in Azure a Computer Vision API and a Translator Text API and copy the keys to the config file.

To make it fast use an endpoint in the fastest region for you (not the free pricing tier), also compress the image lesser bytes is faster, this is also an nice addition to this code. note, for now there is no check on size, language, file type of whatever only the happy flow is tested. About the current version don't use it on production.

see: GitHub

More about Sitecore Cognitive Services see the approach of Mark Stiles
https://www.markstiles.net/blog/2017/2/22/sitecore-cognitive-services/