azure-machine-learning-service - Azure ML FileDataset 已注册,但无法访问数据标签项目

标签 azure-machine-learning-service azureml-python-sdk

目标:使用来自较大 FileDataset 的随机采样生成下采样 FileDataset,以在数据标签项目中使用。


详细信息:我有一个包含数百万张图像的大型 FileDataset。每个文件名都包含有关其来源的“部分”的详细信息。一个部分可能包含数千张图像。我想随机选择特定数量的部分以及与这些部分关联的所有图像。然后将样本注册为新的数据集。

请注意,下面的代码不是直接复制和粘贴的,因为出于保密原因,文件路径和变量等元素已被重命名。

import azureml.core
from azureml.core import Dataset, Datastore, Workspace

# Load in work space from saved config file
ws = Workspace.from_config()

# Define full dataset of interest and retrieve it
dataset_name = 'complete_2017'
data = Dataset.get_by_name(ws, dataset_name)

# Extract file references from dataset as relative paths
rel_filepaths = data.to_path()

# Stitch back in base directory path to get a list of absolute paths
src_folder = '/raw-data/2017'
abs_filepaths = [src_folder + path for path in rel_filepaths]

# Define regular expression pattern for extracting source section
import re
pattern = re.compile('\/(S.+)_image\d+.jpg')

# Create new list of all unique source sections
sections = sorted(set([m.group(1) for m in map(pattern.match, rel_filepaths) if m]))

# Randomly select sections
num_sections = 5
set_seed = 221020
random.seed(set_seed)   # for repeatibility
sample_sections = random.choices(sections, k = num_sections)

# Extract images related to the selected sections
matching_images = [filename for filename in abs_filepaths if any(section in filename for section in sample_sections)]

# Define datastore of interest
datastore = Datastore.get(ws, 'ml-datastore')

# Convert string paths to Azure Datapath objects and relate back to datastore
from azureml.data.datapath import DataPath
datastore_path = [DataPath(datastore, filepath) for filepath in matching_images]

# Generate new dataset using from_files() and filtered list of paths
sample = Dataset.File.from_files(datastore_path)

sample_name = 'random-section-sample'
sample_dataset = sample.register(workspace = ws, name = sample_name, description = 'Sampled sections from full dataset using set seed.')

问题:我在 Python SDK 中编写的代码运行并且新的 FileDataset 注册,但是当我尝试查看数据集详细信息或将其用于数据标签项目时,我得到以下信息即使作为所有者也会出错。

Access denied: Failed to authenticate data access with Workspace system assigned identity. Make sure to add the identity as Reader of the data service.

此外,在详细信息选项卡下,数据集中的文件未知数据集中文件的总大小不可用>.

我在其他地方没有遇到过这个问题。我可以通过其他方式生成数据集,因此我怀疑这是代码的问题,因为我正在以非常规的方式处理数据。


附加说明:

  • Azure ML 版本为 1.15.0

最佳答案

虚拟网络背后的数据有可能吗?

关于azure-machine-learning-service - Azure ML FileDataset 已注册,但无法访问数据标签项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64546521/

相关文章:

azure - 如何使用 python 正确地将数据输出到 Azure ML Batch Endpoint?

azure - 在 aks 或 aci 中部署后如何编辑 Azure ML 条目或评分脚本文件

python-3.x - 如何从 Azure ML 中注册的容器实例读取 csv 文件

python - 导入错误: No module named cassandra in Azure Machine Learning Studio

AzureML 实验管道未将 CUDA 与 PyTorch 结合使用

azure - 检索 Azure ML v2 的当前作业

azure - hyperdrive运行成功后注册模型时添加模型描述

python - 如何将 Pycharm 和 git 与 azure 机器学习服务(工作区)集成

Azure SDK v2 MLTable 读取增量不出现

AzureML 模型注册