我正在使用gapi访问google autoML api。我设法创建一个新的数据集,但很难将数据导入其中。
List of found errors: 1.Field: name; Message: Required field is invalid
我正在遵循 google automl 的指南,但他们没有提到字段名称。 https://cloud.google.com/video-intelligence/automl/docs/reference/rest/v1beta1/projects.locations.datasets/importData
有人成功使用了api并分享解决方案吗?
importCSVtoDataset() {
let projectId = 'projectID';
let serverLocation = 'us-central1';
let datasetName = 'dataset1';
let url = `https://automl.googleapis.com/v1beta1/projects/${projectId}/locations/${serverLocation}/datasets/${datasetName}:importData`;
let videoData = {
name: `projects/${projectId}/locations/${serverLocation}/datasets/${datasetName}`,
inputConfig: {
gcsSource: {
inputUris: [
'gs://reconnaitre-drone-os-vcm/uploads/csv/uploadthis_csv.csv'
]
}
}
}
this.afAuth.authenticateGoogleAPI().then(() => {
return gapi.client.request({
// Pick an endpoint based on the scope and api you defined.
path: url,
method: 'POST',
body: videoData,
})
.then(result => {
console.log("result from GET",result.body)
})
});
}
感谢这篇文章。 datasetName 应该是数据集 ID,而不是显示名称。
如果您使用 AutoML,则在 request.json 文件中,您需要使用 import_schema_uri video_OBJECTIVE_io_format_1.0.0.yaml 而不是 automl_video_OBJECTIVE_io_format_1.0.0.yaml。在此页面上,https://cloud.google.com/vertex-ai/docs/video-data/classification/prepare-data?authuser=1它表示使用此文件路径。也许尝试遵循链接中的格式。
{
"import_configs": [
{
"gcs_source": {
"uris": "IMPORT_FILE_URI"
},
"import_schema_uri" : "gs://google-cloud-aiplatform/schema/dataset/ioformat/video_OBJECTIVE_io_format_1.0.0.yaml"
}
]
}