2

我是 Microsoft Custom Vision 的新手,我正在使用 jupyter notebooks/python 集成 Microsoft Azure Custom Vision API。我能够上传图像,自动标记它们并训练第一次迭代。但是,当我尝试下载训练迭代/模型的 Docker 文件时,我在尝试导出模型时遇到了困难。使用函数export_iteration我最终得到了一个mst.rest.pipeline.clientrawresponse 对象。我认为目前它只存储在导出队列中。如何访问此队列元素以将其下载到本地系统?

PS:我正在使用通用(紧凑)模型格式,因此它应该是可导出的。

示例代码:

# Initalize the Training Client 
training_key = "your-training-key"
ENDPOINT = "your-endpoint" 

c_plat = CustomVisionTrainingClient(training_key,ENDPOINT)
# List all projects you have
projects = c_plat.get_projects()

#Always take the newest project and its newest iteration and export it 
iterations = c_plat.get_iterations(projects[0].id)
c_plat.export_iteration(project_id=projects[0].id, iteration_id=iterations[0].id, platform = "DockerFile", raw=True, flavor = "ARM")

4

1 回答 1

2

经过反复试验,我找到了解决方案:

    #Always takes the newest project and its newest iteration
    iterations = c_plat.get_iterations(projects[0].id)
    response = c_plat.export_iteration(project_id=projects[0].id, iteration_id=iterations[0].id, platform = "DockerFile", raw=False, flavor="ARM")

    # Opnening the uri
    import webbrowser
    webbrowser.open(c_plat.get_exports(project_id=projects[0].id, iteration_id=iterations[0].id)[0].download_uri)

这会在新选项卡中打开 uri 并开始自动下载。希望这可能对其他人有所帮助。

干杯!

于 2020-04-08T12:54:50.340 回答