Quickstart

This quickstart walks you through the process of:

  • Copying a set of images into Google Cloud Storage.
  • Creating a CSV listing the images and their labels.
  • Using AutoML Vision to create your dataset, and train and deploy your model.

Before you begin

  1. Sign in to your Google Account.

    If you don't already have one, sign up for a new account.

  2. In the GCP Console, go to the Manage resources page and select or create a new project.

    Go to the Manage resources page

  3. Make sure that billing is enabled for your project.

    Learn how to enable billing

  4. Enable the Cloud AutoML and Storage APIs.

    Enable the APIs

Create a Cloud Storage bucket

Use Cloud Shell, a browser-based Linux command line connected to your GCP Console project, to create your Cloud Storage bucket:

  1. Open Cloud Shell.

  2. Enter the following:

    PROJECT=$(gcloud config get-value project) && BUCKET="${PROJECT}-vcm"
    

    Note that the bucket name must be as above; other bucket names are not supported.

  3. Create your bucket:

    gsutil mb -p ${PROJECT} -c regional -l us-central1 gs://${BUCKET}
    

Add permissions for the AutoML Vision service account

Allow the AutoML Vision service accounts to access your Google Cloud project resources.

  1. In your Cloud Shell session, enter:

    PROJECT=$(gcloud config get-value project)
    gcloud projects add-iam-policy-binding $PROJECT \
       --member="serviceAccount:custom-vision@appspot.gserviceaccount.com" \
       --role="roles/ml.admin"
    gcloud projects add-iam-policy-binding $PROJECT \
       --member="serviceAccount:custom-vision@appspot.gserviceaccount.com" \
       --role="roles/storage.admin"
    

Copy the sample images into your bucket

Next, copy the flower dataset used in this Tensorflow blog post. The images are stored in a public Cloud Storage bucket, so you can copy them directly from there to your own bucket.

  1. In your Cloud Shell session, enter:

    gsutil -m cp -R gs://cloud-ml-data/img/flower_photos/ gs://${BUCKET}/img/
    

    The file copying takes about 20 minutes to complete.

Create the CSV file

The sample dataset contains a CSV file with all of the image locations and the labels for each image. You'll use that to create your own CSV file:

  1. Update the CSV file to point to the files in your own bucket:

    gsutil cat gs://${BUCKET}/img/flower_photos/all_data.csv | sed "s:cloud-ml-data:${BUCKET}:" > all_data.csv
    
  2. Copy the CSV file into your bucket:

    gsutil cp all_data.csv gs://${BUCKET}/csv/
    

Create your dataset

Visit the AutoML Vision UI to begin the process of creating your dataset and training your model.

When prompted, make sure to select the project that you used for your Cloud Storage bucket.

  1. From the AutoML Vision page, click NEW DATASET:

  2. Specify a name for this dataset. Click the + sign to continue.

  3. Specify the Cloud Storage URI of your CSV file. For this quickstart, the CSV file is at gs://your-project-123-vcm/csv/all_data.csv. Make sure to replace your-project-123 with your specific project ID.

    • Be sure to check Enable multi-label classification if you have images that are labeled with more than one label.
  4. Click CREATE DATASET. The import process takes a few minutes. When it completes, you are taken to the next page which has details on all of the images identified for your dataset, both labeled and unlabeled images. You can filter images by label by selecting a label under Filter labels. If you are using the flower dataset, you will see a warning alert which will notify you of repeated images or images with multiple labels (if multi-label is not enabled).

    • You can add additional images and update labels for new and existing images after you have imported a CSV file.

Train your model

Once your dataset has been created and processed, click the Train tab to initiate model training.

Click START TRAINING to continue.

Training is initiated for your model. Training your model should take about 10 minutes for this dataset. The service will email you once training has completed, or if any errors occur.

Once training is complete, your model is automatically deployed.

You can click the Evaluate tab to get more details on F1, Precision, and Recall scores. Click on each label under Filter labels to get details on true positives, false negatives and false positives.

Make a Prediction

Click the Predict tab for instructions on sending an image to your model for a prediction. You can also refer to Annotating images for examples.

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud AutoML Vision