Detecting emotion with Machine Learning

Machine Learning is a very hot topic these days. Getting started can be fast and easy. In this video post, I walk through the steps to build a simple Universal Windows Application (UWP) that connects to the Microsoft Cognitive Services and the Emotion API.

The Microsoft Cognitive Services are a set of APIs that enable your apps to leverage powerful algorithms using just a few lines of code. They work across lots of various devices and platforms such as iOS, Android, and Windows, keep improving and are easy to set up.


In the demo we use the Emotion API to take a facial expression of an image, we capture as input. The API returns the confidence across a set of emotions for each face in the image, as well as a bounding box for each of the faces found in the image or stream. The emotions detected are anger, contempt, disgust, fear, happiness, neutral, sadness, and surprise. These emotions are understood to be cross-culturally and universally communicated with particular facial expressions.

The demo above is based around UWP and uses C# as the programming language. If you are looking for a NodeJS and JavaScript solution, I suggest this excellent video by Rami Sayar

Some links of interest:

Microsoft Cognitive Services Website:

Emotion API  Documentation:

Cognitive Services Application Gallery:

Happy Coding!

Comments (0)

Skip to main content