您必须先为您的项目启用 AI Platform 数据标签服务,然后才能使用该服务。
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Data Labeling API.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Data Labeling API.
- 安装 Google Cloud CLI 和 Google Cloud CLI。
- 按照说明创建服务账号并为该账号下载密钥文件。
- 将
GOOGLE_APPLICATION_CREDENTIALS
环境变量设置为您在创建服务账号时所下载的服务账号密钥文件的路径。export GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE
- 将
PROJECT_ID
环境变量设置为项目 ID。 Data Labeling API 调用和资源名称中包含您的项目 ID。export PROJECT_ID=YOUR_PROJECT_ID
PROJECT_ID
环境变量提供了一种指定此 ID 的便捷方式。 - 将您的用户账号和服务账号添加到 Data Labeling Editor IAM 角色中。
- 将 YOUR_USERID@YOUR_DOMAIN 替换为您的用户账号。
- 将 SERVICE_ACCOUNT_NAME 替换为新服务账号的名称,例如
service-account1@myproject.iam.gserviceaccount.com
。
gcloud auth login gcloud projects add-iam-policy-binding $PROJECT_ID
--member="user:YOUR_USERID@YOUR_DOMAIN"
--role="roles/datalabeling.editor" gcloud projects add-iam-policy-binding $PROJECT_ID
--member="serviceAccount:SERVICE_ACCOUNT_EMAIL"
--role="roles/datalabeling.editor" - 创建一个 Google Cloud Storage 存储分区,以存储您想要添加标签的数据和提供给标签添加者的说明。