Image Sentiment & Label Analysis using Google Vision API

What’s better if you get to use the same technology which powers image search in Google photos for your use to get more out of the images or want to you use image metadata for any further application.

Google’s Cloud Vision API provides a service that allows developers to easily build image recognition and classification features into their applications with ease but in background it is all the powerful Machine Learning algorithms which Google specializes in.Using this API the ML layer is basically abstracted and allows you to use its all features with just API calls.

I tried my hands on this and the results were absolutely great !!. It detected sentiments of faces from the images and was great at identifying objects in the images. The great thing was the ease of use and the only thing that is must is having a account for Google Cloud platform which is again a 12th-month free trail if you want to explore this API and obviously any IDE (for coding, API supports comes for almost all important languages)

Here are some results :

The first pic I used was a highly monochrome image with quite a few faces in it, and it can be seen that the quality of picture was not that good, but to the surprise API detected almost all complete faces in the image along with its sentiments.

As of now the sentiment of the faces are mapped to four emotions only (Joy, Sorrow, Anger & Surprise) and are scaled on likelihood of values ( VERY_LIKELY ,VERY_UNLIKELY, POSSIBLE,LIKELY & UNLIKELY) depending on the confidence percentage from the underlying algorithm.

Results for Face 6 in the image, it shows the strong likelihood of the Joy with a confidence of 94%.

Results for Face 4 in the image, it shows the strong likelihood of the Possible sorrow with a confidence of 78%.

Apart from the sentiments from the faces, API also identifies labels from images to get you more information in terms of picture metadata.

Their were quite a few images I used to test its intelligence, and what better than food so here is plate of food. Let see what all we get out out of Vision API.

So, it even identified pickle (Condiment, in the results) in my plate, identified it is a Indian Cuisine and yes it’s definitely vegetarian. So quite good isn’t.

Apart from emotions and labels detection, Vision API provides a set of other features like Text, Language detection from images along with detecting inappropriate content in the images to moderate content in case of crowd sourced images on some website or applications. However am still to check these features.

On the pricing side it is free up to 1000 images/month for using any of the features, post 1000 images till 5 Million images it charges you $1.5/Month.

Try it yourself uploading a image here and read more in detail about it here.

Happy Learning !!


P.S. Contents of this blog post is imported from my blogs on my LinkedIn account, for latest on features and pricing please refer to Google Cloud documentation.