If you plan to use the Vertex AI SDK for Python, make sure that the service account
initializing the client has the
Vertex AI Service Agent
roles/aiplatform.serviceAgent) IAM role.
You'll set up your Google Cloud project to use Vertex AI. Then create a Cloud Storage bucket and copy image files to use for training an AutoML image classification model.
This tutorial has several pages:
Set up your project and environment.
Each page assumes that you have already performed the instructions from the previous pages of the tutorial.
Before you begin
Complete the following steps before using Vertex AI functionality.
In the Google Cloud console, go to the project selector page.
Select or create a Google Cloud project.
- Open Cloud Shell. Cloud Shell is an interactive shell environment for Google Cloud that lets you manage your projects and resources from your web browser. Go to Cloud Shell
- In the Cloud Shell, set the current project to your Google Cloud
project ID and store it in the
gcloud config set project PROJECT_ID && projectid=PROJECT_ID && echo $projectidReplace PROJECT_ID with your project ID. You can locate your project ID in the Google Cloud console. For more information, see Find your project ID.
Enable the IAM, Compute Engine, Notebooks, Cloud Storage, and Vertex AI APIs:
gcloud services enable iam.googleapis.com
compute.googleapis.com notebooks.googleapis.com storage.googleapis.com aiplatform.googleapis.com
Grant roles to your Google Account. Run the following command once for each of the following IAM roles:
gcloud projects add-iam-policy-binding PROJECT_ID --member="user:EMAIL_ADDRESS" --role=ROLE
The Vertex AI User (
PROJECT_IDwith your project ID.
EMAIL_ADDRESSwith your email address.
ROLEwith each individual role.
roles/aiplatform.user) IAM role provides access to use all resources in Vertex AI. The Storage Admin (
roles/storage.admin) role you store the document's training dataset in Cloud Storage.
Follow the next page of this tutorial to use the Google Cloud console to create an image classification dataset and import images hosted in a public Cloud Storage bucket.