如果您打算使用 Vertex AI SDK for Python,請確認初始化用戶端的服務帳戶具有 Vertex AI 服務代理 (roles/aiplatform.serviceAgent) IAM 角色。
您將設定 Google Cloud 專案,以便使用 Vertex AI。接著建立 Cloud Storage 值區,並複製圖片檔案,用於訓練 AutoML 圖片分類模型。
本教學課程包含多個頁面:
各頁面都假設您已按照本教學課程先前頁面的指示操作。
事前準備
使用 Vertex AI 功能前,請先完成下列步驟。
- 
      In the Google Cloud console, go to the project selector page. 
- 
        Select or create a Google Cloud project. Roles required to select or create a project - Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
- 
      Create a project: To create a project, you need the Project Creator
      (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
 
- 
  
    Verify that billing is enabled for your Google Cloud project. 
- 開啟 Cloud Shell。 Cloud Shell 是一種互動式殼層環境,可讓您透過網路瀏覽器管理專案和資源。 Google Cloud 前往 Cloud Shell
- 在 Cloud Shell 中,將目前的專案設為專案 ID,並儲存在 projectid殼層變數中: Google Cloudgcloud config set project PROJECT_ID && projectid=PROJECT_ID && echo $projectid 
- 
  
  
    
      Enable the IAM, Compute Engine, Notebooks, Cloud Storage, and Vertex AI APIs. Roles required to enable APIs To enable APIs, you need the Service Usage Admin IAM role ( roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.
- 
    
        Make sure that you have the following role or roles on the project: roles/aiplatform.user, roles/storage.admin Check for the roles- 
              In the Google Cloud console, go to the IAM page. Go to IAM
- Select the project.
- 
              In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator. 
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
 Grant the roles- 
              In the Google Cloud console, go to the IAM page. 前往 IAM
- 選取專案。
- 按一下 「授予存取權」。
- 
              在「New principals」(新增主體) 欄位中,輸入您的使用者 ID。 這通常是 Google 帳戶的電子郵件地址。 
- 在「Select a role」(選取角色) 清單中,選取角色。
- 如要授予其他角色,請按一下 「新增其他角色」,然後新增每個其他角色。
- 按一下 [Save]。
 roles/aiplatform.user) IAM 角色可讓您存取及使用 Vertex AI 中的所有資源。您必須具備儲存空間管理員 (roles/storage.admin) 角色,才能在 Cloud Storage 中儲存文件訓練資料集。後續步驟請按照本教學課程的下一頁操作,使用Google Cloud 控制台建立圖片分類資料集,並匯入託管在公開 Cloud Storage bucket 中的圖片。 
-