データセットの取得(ベータ版)

指定した Google Cloud プロジェクトからデータセットを取得します。

コードサンプル

Python

Data Labeling Service のクライアント ライブラリをインストールして使用する方法については、Data Labeling Service のクライアント ライブラリをご覧ください。詳細については、Data Labeling Service の Python API のリファレンス ドキュメントをご覧ください。

Data Labeling Service に対する認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

def get_dataset(dataset_resource_name):
    """Gets a dataset for the given Google Cloud project."""
    from google.cloud import datalabeling_v1beta1 as datalabeling

    client = datalabeling.DataLabelingServiceClient()

    response = client.get_dataset(request={"name": dataset_resource_name})

    print(f"The dataset resource name: {response.name}\n")
    print(f"Display name: {response.display_name}")
    print(f"Description: {response.description}")
    print("Create time:")
    print(f"\tseconds: {response.create_time.timestamp_pb().seconds}")
    print(f"\tnanos: {response.create_time.timestamp_pb().nanos}")

次のステップ

他の Google Cloud プロダクトに関連するコードサンプルの検索およびフィルタ検索を行うには、Google Cloud のサンプルをご覧ください。