如何将数据导入数据集并在Google Cloud AutoML中重新训练自定义模型 [英] How to import data to Dataset and retrain custom model in Google Cloud AutoML

查看:72
本文介绍了如何将数据导入数据集并在Google Cloud AutoML中重新训练自定义模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是GCP的新开发人员,并且了解Google Cloud AutoML自定义模型.但是我在使用AutoML Vision时遇到两个问题.

I'm a new developer with GCP and I learn about Google Cloud AutoML Custom Model. but I have 2 problems with AutoML Vision.

1.我无法将数据从云存储中的csv文件导入数据集.我正在使用C#调用RestAPI,但它的错误404.下面是我的代码.

var uri = "https://automl.googleapis.com/v1beta1/projects/{project-id}/locations/us-central1/datasets/{dataset-id}:import";

        var request = (HttpWebRequest)WebRequest.Create(uri);
        request.Method = "POST";
        request.ContentType = "application/json";
        request.Headers.Add("Authorization", "Bearer " + _token);

        using (var streamWriter = new StreamWriter(request.GetRequestStream()))
        {
            string json = "{\"inputUris\":\"gs://{bucket-name}/Vehicles/csv/{csv-file-name}.csv\"}";
            Console.WriteLine(json);
            streamWriter.Write(json);
            streamWriter.Flush();
            streamWriter.Close();
        }

        try
        {
            var httpResponse = (HttpWebResponse)request.GetResponse();
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                var result = streamReader.ReadToEnd();
                Console.WriteLine(result);
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }

2.如何使用C#或RestAPI重新训练自定义模型

例如:用户上传带有图片标签的新图片.然后创建一个csv文件并上传到云存储.因此,我想使用该csv文件导入数据集,然后仅对自定义模型重新训练csv文件中的图像(将新的图像训练添加到旧模型中).

For example: the user uploads a new image of something with a label for that image. then create a csv file and upload to cloud storage. So I would like import Dataset using that csv file then retrain custom model only the image inside csv file (Add new image training to old model).

推荐答案

除了@Awais答案,正确的调用api是

In adition to @Awais answer, The correct call api is

https://automl.googleapis.com/v1beta1/projects/{id-project}/locations/us-central1/datasets/{id-dataset}:importData

,此功能的正确json格式有效载荷为

and the correct json format payload for this function is

{
    "inputConfig": {
        "gcsSource": {
            "inputUris": [
                "gs://my-bucket-vcm/uploads/app/csv/19_03_2019_18_16_35.csv"
            ]
        }
    }
}

来源

这篇关于如何将数据导入数据集并在Google Cloud AutoML中重新训练自定义模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆