You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用Google Vertex ImageDataset的import_data时如何指定标注集ID?

解决方案:指定现有标注集导入数据
  • 问题核心:调用import_data时若未指定目标标注集,Vertex AI会自动创建新标注集。要将数据导入已有的my_dataset_iod标注集,只需在import_data方法中添加annotation_set_id参数,传入你获取到的对应标注集ID即可。

  • 修改后的代码示例:

from google.cloud import storage
from google.cloud import aiplatform
from datetime import datetime
.....
        current_datetime = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
        jsonl_file_name = f"data_{current_datetime}.jsonl"
        jsonl_blob = bucket.blob(jsonl_file_name)
        jsonl_blob.upload_from_string(jsonl_string, content_type='application/jsonl')
        dataset = aiplatform.ImageDataset(f"projects/{project_id}/locations/us-central1/datasets/{dataset_id}")
        # 替换为你获取到的my_dataset_iod对应的annotationSetId
        target_annotation_set_id = "your_my_dataset_iod_annotation_set_id"
        dataset.import_data(
            gcs_source=[f"gs://{bucket_name}/{jsonl_file_name}"],
            import_schema_uri='gs://google-cloud-aiplatform/schema/dataset/ioformat/image_bounding_box_io_format_1.0.0.yaml',
            annotation_set_id=target_annotation_set_id
        )
  • 说明:annotation_set_id参数接受字符串格式的标注集ID,传入后,导入的图像及标注数据会直接追加到指定的现有标注集中,不会再自动生成新的标注集。

内容的提问来源于stack exchange,提问作者Will

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 17:38:28