快速入門:使用 Imagen 文字轉圖像功能產生及驗證圖片浮水印 (主控台)

瞭解如何使用 Vertex AI 的 Imagen 文字轉圖像生成功能,並驗證生成圖像上的數位浮水印 (SynthID)。本快速入門導覽課程說明如何在Google Cloud 控制台使用 Imagen 圖像生成功能。

Vertex AI 的 Imagen 定價取決於您使用的功能。詳情請參閱「定價」。

生成的狗圖像
使用 Vertex AI 的 Imagen,根據以下提示詞生成的圖片: 海灘上的法國鬥牛犬肖像,85mm f/2.8

事前準備

  1. 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.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Vertex AI API.

    Enable the API

  5. Make sure that you have the following role or roles on the project: Vertex AI User

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. 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.

    4. 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

    1. In the Google Cloud console, go to the IAM page.

      前往 IAM
    2. 選取專案。
    3. 按一下 「授予存取權」
    4. 在「New principals」(新增主體) 欄位中,輸入您的使用者 ID。 這通常是 Google 帳戶的電子郵件地址。

    5. 在「Select a role」(選取角色) 清單中,選取角色。
    6. 如要授予其他角色,請按一下 「新增其他角色」,然後新增每個其他角色。
    7. 按一下 [Save]
  6. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  7. Verify that billing is enabled for your Google Cloud project.

  8. Enable the Vertex AI API.

    Enable the API

  9. Make sure that you have the following role or roles on the project: Vertex AI User

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. 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.

    4. 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

    1. In the Google Cloud console, go to the IAM page.

      前往 IAM
    2. 選取專案。
    3. 按一下 「授予存取權」
    4. 在「New principals」(新增主體) 欄位中,輸入您的使用者 ID。 這通常是 Google 帳戶的電子郵件地址。

    5. 在「Select a role」(選取角色) 清單中,選取角色。
    6. 如要授予其他角色,請按一下 「新增其他角色」,然後新增每個其他角色。
    7. 按一下 [Save]
  10. 生成圖片並儲存本機副本

    使用 Google Cloud 控制台傳送文字轉圖像生成要求。

    1. 在 Google Cloud 控制台中,前往「Vertex AI」>「Media Studio」 頁面。

      前往媒體工作室

    2. 在「提示」(「在這裡撰寫提示」) 欄位中,輸入下列提示:

       portrait of a french bulldog at the beach, 85mm f/2.8
      
    3. 如果尚未選取,請在「參數」面板的「模型選項」方塊中選取 Imagen 3

    4. 如果未選取,請在「參數」面板的「長寬比」部分選取 1:1

    5. 在「結果數量」部分,將「結果數量」變更為 2

    6. 按一下「生成」

      生成的圖片會類似以下圖片:

      控制台中生成的圖片範例

    7. 如要儲存圖片的本機副本,請點選其中一張圖片。

    8. 在開啟的「圖片詳細資料」視窗中,按一下「匯出」

    9. 在「匯出圖片」對話方塊中,按一下「匯出」

    驗證圖片的數位浮水印

    生成含有浮水印的圖片後,您可以驗證新圖片的數位浮水印。

    1. 生成圖片,並儲存本機副本,做法與上一個步驟相同

    2. 在「圖片詳細資料」視窗中,按一下「匯出」

    3. 在下方面板中,按一下「驗證」

    4. 按一下「上傳圖片」

    5. 選取本機儲存的生成圖像。

      管理中心中生成圖像的已驗證浮水印範例

    恭喜!您剛才使用 Imagen 文字轉圖片生成功能,建立新穎的圖片,並驗證其中一張圖片的數位浮水印。

    清除所用資源

    如要避免系統向您的 Google Cloud 帳戶收取本頁所用資源的費用,請按照下列步驟操作。

    刪除專案

    1. In the Google Cloud console, go to the Manage resources page.

      Go to Manage resources

    2. In the project list, select the project that you want to delete, and then click Delete.
    3. In the dialog, type the project ID, and then click Shut down to delete the project.

    後續步驟