Applying Google Cloud Vision AI

3 hours
  • 7 Learning Objectives

About this Hands-on Lab

Increasingly, businesses are turning to machine learning to automate processes such as categorization to cut costs and increase efficiency. Google Cloud AutoML Vision is the ideal service for developing custom classification features, as you can train an individual machine learning model with your own data. In this lesson, we’ll take publicly available images from a *New York Times* project that created a machine learning model with hundreds of dog breeds. To keep our study compact, we’ll focus on just four breeds – but even with that limitation, the intense computing nature of training a machine learning model requires time.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Enable the Cloud Vision API
  1. From the Google Cloud console’s main navigation, choose APIs & Services > Library.
  2. Search for "Vision", and select Cloud Vision API.
  3. If necessary, click Enable.
Create Cloud Storage Bucket
  1. From the Google Cloud navigation, choose Storage > Browser.
  2. Click Create Bucket.
  3. Enter a unique name for your bucket, and click Continue.
  4. In the Choose where to store your data section, choose the Region location type option and select us-central1 (Iowa) from the Location list.
  5. Click Continue.
  6. Choose Standard as the default storage class, and click Continue.
  7. Make sure Fine-grained is chosen as the Access control option, and click Continue.
  8. Leave the Advanced Settings options at their default settings, and click Create.
Copy Asset Files to Cloud Storage Bucket
  1. Activate the Cloud Shell.

  2. Retrieve the working files:

    git clone
  3. Open the Cloud Shell Editor.

  4. Expand the content-gc-ai-services-deepdive/ai-vision/dogs folder, and open dogs.csv.

  5. Select [PATH], and choose Edit > Replace.

  6. In the Replace field, enter the path to your newly created bucket, followed by /dogs, like this: gs://<BUCKET_NAME>/dogs.

  7. In the Cloud Shell, change directories:

    cd content-gc-ai-services-deepdive/ai-vision/dogs
  8. Copy the files from your Cloud Shell to your bucket:

    gsutil -m cp -r * gs://<BUCKET_NAME>/dogs/
  9. Confirm the copy by returning to the Cloud Storage browser and refreshing the bucket.

Create AutoML Vision Dataset
  1. From the main Google Cloud navigation, choose Vision > Dashboard.
  2. Under AutoML Vision, choose Image Classification – Get started.
  3. Accept the conditions for using AutoML.
  4. On setup page, click Set Up Now.
  5. Choose project.
  6. From the Datasets page, choose New Dataset.
  7. Enter a name for your dataset, like la_dogs.
  8. Choose the Single-Label Classification option.
  9. Click Create Dataset.
Import Data
  1. In the Import section, choose the Select a CSV file on Cloud Storage option.
  2. Click Browse, select the dogs/dogs.csv file in your bucket, and click Select.
  3. Click Continue.
  4. Switch to the Images tab. (It will take about five minutes for the images to populate.)
Train and Deploy Model
  1. After all images have been imported, switch to the Train tab.
  2. Click Start Training.
  3. In the Train New Model panel, make sure the Cloud hosted option is selected and click Continue.
  4. Enter the desired number of node hours in the Budget field.
  5. Select the Deploy model to 1 node after training checkbox.
  6. Click Start Training.
Test Model
  1. After the model has completed training, go to the Evaluate tab to review the details.

  2. In the Cloud Shell, download the testing files:

    cloudshell download visionml-test-images/*
  3. Click Download when requested.

  4. Navigate to the desired folder on your system, and click Save for each file.

  5. In the Vision dashboard, switch to Test & Use and click Upload Images.

  6. Review results.

Additional Resources

Your company's new app allows users to post pictures of their dogs. You've been tasked with setting up the initial ML model to identify four different breeds. The images and CSV file with labeling information have been provided. After creating the dataset, importing the data, and training the model, you'll need to test it with a few sample images.

You’ll need to accomplish the following steps to complete your task:

  1. Enable AutoML Vision API.
  2. Create Cloud Storage bucket.
  3. Copy files to bucket.
  4. Create AutoML Vision dataset.
  5. Import data.
  6. Train and deploy model.
  7. Test model.

Note: Training the ML model in this lab can take two hours or more.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!