繁体   English   中英

从 Node.js 客户端库返回的 GCP AutoML 数据集 ID 与实际数据集 ID 不匹配

[英]GCP AutoML dataset id return from Node.js client library is mismatched the actual dataset id

以前,我使用 Node.js 客户端库创建数据集并在 GCP automl 上训练模型,一切正常。 但是,现在我面临“错误:5 NOT_FOUND:数据集不存在或无法与 AutoMl 一起使用”

之后,我意识到从创建数据集请求返回的数据集 ID 与实际数据集 ID不匹配(与 Web 界面相比)。 所以我无法以编程方式与数据集交互。

我的目标是使用该数据集 ID 上传图像并训练模型。 我缺少任何更新吗? 任何建议将不胜感激。

以下是来自https://cloud.google.com/vision/automl/docs/create-datasets 的使用 GCP Automl 创建数据集的参考代码。

 * TODO(developer): Uncomment these variables before running the sample.
 */
// const projectId = 'YOUR_PROJECT_ID';
// const location = 'us-central1';
// const displayName = 'YOUR_DISPLAY_NAME';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1;

// Instantiates a client
const client = new AutoMlClient();

async function createDataset() {
  // Construct request
  // Specify the classification type
  // Types:
  // MultiLabel: Multiple labels are allowed for one example.
  // MultiClass: At most one label is allowed per example.
  const request = {
    parent: client.locationPath(projectId, location),
    dataset: {
      displayName: displayName,
      imageClassificationDatasetMetadata: {
        classificationType: 'MULTILABEL',
      },
    },
  };

  // Create dataset
  const [operation] = await client.createDataset(request);

  // Wait for operation to complete.
  const [response] = await operation.promise();

  console.log(`Dataset name: ${response.name}`);
  console.log(`
    Dataset id: ${
      response.name
        .split('/')
        [response.name.split('/').length - 1].split('\n')[0]
    }`);
}

createDataset();

现在我使用了https://github.com/googleapis/nodejs-automl/blob/master/samples/vision_object_detection_create_dataset.js 中的示例代码,它运行良好。 是的,我应该在开始时使用它。 但是我们总是找到行不通的方法,在工作之前,对吗?

快乐编码并创造一个更美好的世界;)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM