在Azure机器学习python SDK中传递给automl_classifier的图像数据遇到EmptyDataException错误

问题描述

我正在尝试使用https://docs.microsoft.com/en-us/azure/machine-learning/how-to-configure-environment#local

中提到的设置在conda环境中的本地PC上运行 azure automl (MacOS Catalina:10.15.6)。

目标是使用Azureureml对二进制颜色图像分类找到最佳的模型和参数。

培训数据示例:

train_data_img = train_data.copy()
for index in tqdm(train_data.index):
    img_file = train_data_img['image_file'][index]
    image = cv2.imread(img_file)
    img_resized = cv2.resize(image,(256,256))
    img_numpy = np.array(img_resized)
    train_data_img['np_image'][index] = img_numpy

print(train_data_img.head())
type(train_data_img)
                                               np_image  y
474   [[[0,0],[0,...  0
2121  [[[0,...  0
1836  [[[0,...  1
94    [[[0,...  0
663   [[[0,...  0

pandas.core.frame.DataFrame

在本地PC上运行automl的代码

automl_classifier=AutoMLConfig(
    task='classification',primary_metric='AUC_weighted',experiment_timeout_minutes=5,blocked_models=['XGBoostClassifier'],training_data=train_data_img,label_column_name=label,n_cross_validations=2)

from azureml.core.experiment import Experiment

ws = Workspace.from_config()

# Choose a name for the experiment and specify the project folder.
experiment_name = 'automl-classification'
project_folder = './sample_projects/automl-classification'

experiment = Experiment(ws,experiment_name)

run = experiment.submit(automl_config,show_output=True)
~/.conda/envs/myenv/lib/python3.7/site-packages/azureml/automl/runtime/training_utilities.py

在_extract_user_data中(用户脚本) (2211) 2212“未定义获取数据脚本和X,” -> 2213“未提供y输入。”,has_pii = False) 2214试试: 2215 output = user_script.get_data()#类型:Union [Dict [str,Any],Tuple [Any,Any,Any,Any]]

EmptyDataException: EmptyDataException:
  Message: Get data script was not defined and X,y inputs were not provided.
  InnerException: None
  ErrorResponse 
{
    "error": {
        "code": "UserError","inner_error": {
            "code": "InvalidData","inner_error": {
                "code": "EmptyData"
            }
        },"message": "Get data script was not defined and X,y inputs were not provided."
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)