Image Recognition using Google Vision API

September 20, 2018
What is Image recognition?


Image recognition is the concept employed by machine learning companies which focuses on identifying the objects, places, peoples and several other variables in the image. Basically, in image recognition, the first step is image classification. In image classification, the system extracts the important data/information and features from the images. For example, in the below image if you want to extract cat from the background you will notice a significant variation in RGB pixel values. The task in Image Classification is to take an array of pixels that represents a single image and assign a label to it.


  • General Approaches to Image Classification:

Unsupervised Classification – Unsupervised classification (commonly referred to as clustering) is the method of partitioning remote sensor image data in multispectral feature space and extracting land-cover information

Supervised Classification – Supervised classification is the technique used by machine learning companies for the quantitative analysis of remote sensing image data. It can be divided into two types-

  • Training phase – in this phase the classification algorithm is provided to identify classes uniquely and a respective number of pixels is assigned to a particular class in which the particular image belongs.
  • Classification phase – In this, the algorithm uses the training data files and by looking each pixel in the trained classes, assign classes to each pixel.
  • Image Recognition Techniques

In mobile, web and software development there are a lot of techniques are present like-Tensorflow projects by Google, DeepFace by Facebook and on the other side, hosted APIs like Google Cloud Vision, Microsoft computer vision API. These API’s are paid.

Here we will discuss Google Cloud Vision API in android. In this, we will learn how we will use the mobile device camera to identify the images.

  • How does Google Cloud Vision API work?

Google Cloud Vision API will identify images from pre-trained models on large datasets of images and then it classifies the images into thousands of categories to detect the objects, places, people and faces in the images and then prints the results with the confidence value.

If you want to use the Google Cloud Vision API, Google has introduced the API for developers. Developers can use this API in C#, GO, JAVA, NODE.JS, PHP, PYTHON, RUBY. This API takes input an image, and the results back you the output in the form of BatchAnnotateImagesResponse.

How to use the Google Vision API?


  • Setting up the Google Vision API
  1.  To use the Google Vision API, you have to sign up for a Google Compute Engine Account. GCE is free to try but you will need a credit card to sign up.
  2. Then create a project in the developer console.
  3. Click on the credentials drop down menu and select OAuth Client ID: AND Select application type as Android. Enter your SHA1 fingerprint AND the package name of your app: It must be the same as the one declared in the build.gradle of your app. Then get yourself an API key from the left-hand menu.
  4. Enable the API on your project (go to this URL and click Enable the API):

Now you’re ready to go! Now we will see how Google”s API gives us output using a mobile”s camera.

In build. gradle add below dependencies


We will use the Google API Client library Code because we are using the OAuth request.  So first we need to obtain the auth token from Google.



Now we have got the parameters to call the Cloud Vision API and receive the results.





Hire the best Machine Learning Developer!


Join us at Signity Solutions, one of the top machine learning companies in India. We have the best machine learning developers in the country. Consider outsourcing to India and reap out the benefits associated with the machine learning consulting.

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *


Send us your requirements. We will get back to you with a free quote..


Signity Solutions Pvt. Ltd. Netsmartz House, 3rd Floor, Plot #10, Rajiv Gandhi IT Park, Chandigarh 160101 IN.

United States

Signity Solutions Pvt. Ltd.33 Wood Avenue South, Suite 600 Iselin, New Jersey NJ 08830.

Contact Us

AU : +61-39088 0326

U.K: +44-2031295421

U.S.A : +1-619-309-4653