【问题标题】:How to solve "Incorrectly defined MiniBatchable Datastore" error when training network训练网络时如何解决“Incorrectly defined MiniBatchable Datastore”错误
【发布时间】:2019-12-15 21:42:57
【问题描述】:

我正在尝试使用卷积神经网络(使用 MATLAB 的 Deep Network Designer 设计)从图像数据集中识别花朵(对于机器学习来说非常新,还没有上过课程,只是在玩弄一些东西)。我已将图像和标签存储在名为 auimds 的增强数据存储中,但是当我运行 trainNetwork 时,出现以下错误:

使用 trainNetwork 时出错(第 150 行) 错误定义的 MiniBatchable 数据存储。第 261 行 C:\Program Files\MATLAB\R2018b\toolbox\matlab\datatypes@table\table.m 的读取方法出错:参数数量错误。

训练器出错(第 2 行) net = trainNetwork(auimds,lgraph_1,options);

这是产生错误的代码:

options = trainingOptions('sgdm');
net = trainNetwork(auimds,lgraph_1,options);

这是创建 auimds 的代码的相关部分。 “paths”是图像路径列表,“labels”是标签列表,“folders”是包含图像的文件夹名称列表。图片根据包含文件夹的名称被赋予标签:

counter = 1;
for i=1:length(paths)
    files = dir(fullfile(paths(i),'*.jpg'));
    for j=1:length(files)
        labels(counter) = folders(i).name;
        counter = counter + 1;
    end
end
imds = imageDatastore(paths,'Labels',labels);
auimds = augmentedImageDatastore([200,200],imds);

【问题讨论】:

    标签: matlab deep-learning


    【解决方案1】:

    对于遇到此问题的任何人,我通过将标签设置为分类来解决它。

    imds = imageDatastore(paths,'Labels', categorical(labels));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-28
      • 2020-07-14
      • 2019-06-22
      • 2018-10-19
      • 2016-03-22
      • 2023-03-24
      相关资源
      最近更新 更多