Membuat set data untuk video
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Membuat set data untuk video menggunakan metode create_dataset.
Jelajahi lebih lanjut
Untuk dokumentasi mendetail yang menyertakan contoh kode ini, lihat artikel berikut:
Contoh kode
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],[],[],[],null,["Creates a dataset for video using the create_dataset method.\n\nCode sample \n\nJava\n\n\nBefore trying this sample, follow the Java setup instructions in the\n[Vertex AI quickstart using\nclient libraries](/vertex-ai/docs/start/client-libraries).\n\n\nFor more information, see the\n[Vertex AI Java API\nreference documentation](/java/docs/reference/google-cloud-aiplatform/latest/com.google.cloud.aiplatform.v1).\n\n\nTo authenticate to Vertex AI, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n\n import com.google.api.gax.longrunning.OperationFuture;\n import com.google.cloud.aiplatform.v1.CreateDatasetOperationMetadata;\n import com.google.cloud.aiplatform.v1.Dataset;\n import com.google.cloud.aiplatform.v1.DatasetServiceClient;\n import com.google.cloud.aiplatform.v1.DatasetServiceSettings;\n import com.google.cloud.aiplatform.v1.LocationName;\n import java.io.IOException;\n import java.util.concurrent.ExecutionException;\n import java.util.concurrent.TimeUnit;\n import java.util.concurrent.TimeoutException;\n\n public class CreateDatasetVideoSample {\n\n public static void main(String[] args)\n throws IOException, InterruptedException, ExecutionException, TimeoutException {\n // TODO(developer): Replace these variables before running the sample.\n String project = \"YOUR_PROJECT_ID\";\n String datasetVideoDisplayName = \"YOUR_DATASET_VIDEO_DISPLAY_NAME\";\n createDatasetSample(datasetVideoDisplayName, project);\n }\n\n static void createDatasetSample(String datasetVideoDisplayName, String project)\n throws IOException, InterruptedException, ExecutionException, TimeoutException {\n DatasetServiceSettings datasetServiceSettings =\n DatasetServiceSettings.newBuilder()\n .setEndpoint(\"us-central1-aiplatform.googleapis.com:443\")\n .build();\n\n // Initialize client that will be used to send requests. This client only needs to be created\n // once, and can be reused for multiple requests. After completing all of your requests, call\n // the \"close\" method on the client to safely clean up any remaining background resources.\n try (DatasetServiceClient datasetServiceClient =\n DatasetServiceClient.create(datasetServiceSettings)) {\n String location = \"us-central1\";\n String metadataSchemaUri =\n \"gs://google-cloud-aiplatform/schema/dataset/metadata/video_1.0.0.yaml\";\n LocationName locationName = LocationName.of(project, location);\n Dataset dataset =\n Dataset.newBuilder()\n .setDisplayName(datasetVideoDisplayName)\n .setMetadataSchemaUri(metadataSchemaUri)\n .build();\n\n OperationFuture\u003cDataset, CreateDatasetOperationMetadata\u003e datasetFuture =\n datasetServiceClient.createDatasetAsync(locationName, dataset);\n System.out.format(\"Operation name: %s\\n\", datasetFuture.getInitialFuture().get().getName());\n System.out.println(\"Waiting for operation to finish...\");\n Dataset datasetResponse = datasetFuture.get(300, TimeUnit.SECONDS);\n\n System.out.println(\"Create Dataset Video Response\");\n System.out.format(\"Name: %s\\n\", datasetResponse.getName());\n System.out.format(\"Display Name: %s\\n\", datasetResponse.getDisplayName());\n System.out.format(\"Metadata Schema Uri: %s\\n\", datasetResponse.getMetadataSchemaUri());\n System.out.format(\"Metadata: %s\\n\", datasetResponse.getMetadata());\n System.out.format(\"Create Time: %s\\n\", datasetResponse.getCreateTime());\n System.out.format(\"Update Time: %s\\n\", datasetResponse.getUpdateTime());\n System.out.format(\"Labels: %s\\n\", datasetResponse.getLabelsMap());\n }\n }\n }\n\nNode.js\n\n\nBefore trying this sample, follow the Node.js setup instructions in the\n[Vertex AI quickstart using\nclient libraries](/vertex-ai/docs/start/client-libraries).\n\n\nFor more information, see the\n[Vertex AI Node.js API\nreference documentation](/nodejs/docs/reference/aiplatform/latest).\n\n\nTo authenticate to Vertex AI, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n /**\n * TODO(developer): Uncomment these variables before running the sample.\\\n * (Not necessary if passing values as arguments)\n */\n\n // const datasetDisplayName = \"YOUR_DATASTE_DISPLAY_NAME\";\n // const project = 'YOUR_PROJECT_ID';\n // const location = 'YOUR_PROJECT_LOCATION';\n\n // Imports the Google Cloud Dataset Service Client library\n const {DatasetServiceClient} = require('@google-cloud/aiplatform');\n\n // Specifies the location of the api endpoint\n const clientOptions = {\n apiEndpoint: 'us-central1-aiplatform.googleapis.com',\n };\n\n // Instantiates a client\n const datasetServiceClient = new DatasetServiceClient(clientOptions);\n\n async function createDatasetVideo() {\n // Configure the parent resource\n const parent = `projects/${project}/locations/${location}`;\n // Configure the dataset resource\n const dataset = {\n displayName: datasetDisplayName,\n metadataSchemaUri:\n 'gs://google-cloud-aiplatform/schema/dataset/metadata/video_1.0.0.yaml',\n };\n const request = {\n parent,\n dataset,\n };\n\n // Create Dataset Request\n const [response] = await datasetServiceClient.createDataset(request);\n console.log(`Long running operation: ${response.name}`);\n\n // Wait for operation to complete\n await response.promise();\n const result = response.result;\n\n console.log('Create dataset video response');\n console.log(`Name : ${result.name}`);\n console.log(`Display name : ${result.displayName}`);\n console.log(`Metadata schema uri : ${result.metadataSchemaUri}`);\n console.log(`Metadata : ${JSON.stringify(result.metadata)}`);\n console.log(`Labels : ${JSON.stringify(result.labels)}`);\n }\n createDatasetVideo();\n\nPython\n\n\nBefore trying this sample, follow the Python setup instructions in the\n[Vertex AI quickstart using\nclient libraries](/vertex-ai/docs/start/client-libraries).\n\n\nFor more information, see the\n[Vertex AI Python API\nreference documentation](/python/docs/reference/aiplatform/latest).\n\n\nTo authenticate to Vertex AI, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n from google.cloud import aiplatform\n\n\n def create_dataset_video_sample(\n project: str,\n display_name: str,\n location: str = \"us-central1\",\n api_endpoint: str = \"us-central1-aiplatform.googleapis.com\",\n timeout: int = 300,\n ):\n # The AI Platform services require regional API endpoints.\n client_options = {\"api_endpoint\": api_endpoint}\n # Initialize client that will be used to create and send requests.\n # This client only needs to be created once, and can be reused for multiple requests.\n client = aiplatform.gapic.DatasetServiceClient(client_options=client_options)\n dataset = {\n \"display_name\": display_name,\n \"metadata_schema_uri\": \"gs://google-cloud-aiplatform/schema/dataset/metadata/video_1.0.0.yaml\",\n }\n parent = f\"projects/{project}/locations/{location}\"\n response = client.create_dataset(parent=parent, dataset=dataset)\n print(\"Long running operation:\", response.operation.name)\n create_dataset_response = response.result(timeout=timeout)\n print(\"create_dataset_response:\", create_dataset_response)\n\nTerraform\n\n\nTo learn how to apply or remove a Terraform configuration, see\n[Basic Terraform commands](/docs/terraform/basic-commands).\n\n\nFor more information, see the\n[Terraform provider reference documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs).\n\n resource \"google_vertex_ai_dataset\" \"video_dataset\" {\n display_name = \"video-dataset\"\n metadata_schema_uri = \"gs://google-cloud-aiplatform/schema/dataset/metadata/video_1.0.0.yaml\"\n region = \"us-central1\"\n }\n\nWhat's next\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=aiplatform)."]]