Hello 视频数据:设置项目和环境

如果您计划使用 Python 版 Vertex AI SDK,请确保初始化客户端的服务账号具有 Vertex AI Service Agent (roles/aiplatform.serviceAgent) IAM 角色。

本教程包含多个页面:

  1. 设置项目。

  2. 创建视频分类数据集

  3. 训练 AutoML 视频分类模型。

  4. 部署模型以进行批量预测

  5. 清理项目。

每个页面均假定您已经按照本教程中之前页面的说明操作。

设置您的项目和环境

在本教程中,请使用 Google Cloud Console 与 Google Cloud 进行交互。在使用 Vertex AI 功能之前,完成以下步骤。

  1. In the Google Cloud console, go to the project selector page.

    Go to project selector

  2. Select or create a Google Cloud project.

  3. 确保您的 Google Cloud 项目已启用结算功能

  4. 打开 Cloud Shell。Cloud Shell 是 Google Cloud 的交互式 Shell 环境,可让您通过网络浏览器管理项目和资源。
  5. 转到 Cloud Shell
  6. 在 Cloud Shell 中,将当前项目设置为您的 Google Cloud 项目 ID,并将其存储在 projectid shell 变量中:
      gcloud config set project PROJECT_ID &&
      projectid=PROJECT_ID &&
      echo $projectid
    PROJECT_ID 替换为项目 ID。您可以在 Google Cloud 控制台中找到项目 ID。如需了解详情,请参阅查找项目 ID
  7. 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
  8. Grant roles to your user account. Run the following command once for each of the following IAM roles: roles/aiplatform.user, roles/storage.admin

    gcloud projects add-iam-policy-binding PROJECT_ID --member="USER_IDENTIFIER" --role=ROLE
    • Replace PROJECT_ID with your project ID.
    • Replace USER_IDENTIFIER with the identifier for your user account. For example, user:myemail@example.com.

    • Replace ROLE with each individual role.
  9. Vertex AI User (roles/aiplatform.user) IAM 角色提供使用 Vertex AI 中所有资源的权限。借助 Storage Admin (roles/storage.admin) 角色,您可以将文档的训练数据集存储在 Cloud Storage 中。

后续步骤

按照本教程的下一页,使用 Google Cloud 控制台创建视频分类数据集。